utiller 1.0.131 → 1.0.132
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/utiller/index.js
CHANGED
|
@@ -553,13 +553,18 @@ var Utiller = /*#__PURE__*/function () {
|
|
|
553
553
|
}()
|
|
554
554
|
/** 如果是array,用 indexOf檢查each
|
|
555
555
|
* 如果是object,看有沒有這個key
|
|
556
|
-
* 如果是string, 就檢查有沒有包含
|
|
556
|
+
* 如果是string, 就檢查有沒有包含
|
|
557
|
+
* precisely 就是用findIndex,去比較value
|
|
558
|
+
*
|
|
559
|
+
* */
|
|
557
560
|
|
|
558
561
|
}, {
|
|
559
562
|
key: "has",
|
|
560
563
|
value: function has(collection, item) {
|
|
564
|
+
var precisely = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
565
|
+
|
|
561
566
|
if (_lodash["default"].isArray(collection)) {
|
|
562
|
-
return _lodash["default"].indexOf(collection, item) > -1;
|
|
567
|
+
if (precisely) return _lodash["default"].findIndex(collection, item) > -1;else return _lodash["default"].indexOf(collection, item) > -1;
|
|
563
568
|
}
|
|
564
569
|
|
|
565
570
|
if (_lodash["default"].isObject(item)) {
|
package/package.json
CHANGED