@bbn/bbn 1.0.187 → 1.0.188
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/dist/bbn.js +8 -7
- package/dist/bbn.js.map +1 -1
- package/dist/fn/object/mutateArray.js +6 -7
- package/package.json +1 -1
package/dist/bbn.js
CHANGED
|
@@ -9301,6 +9301,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9301
9301
|
/* harmony export */ });
|
|
9302
9302
|
/* harmony import */ var _type_isArray_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../type/isArray.js */ "./dist/fn/type/isArray.js");
|
|
9303
9303
|
/* harmony import */ var _string_hash_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../string/hash.js */ "./dist/fn/string/hash.js");
|
|
9304
|
+
/* harmony import */ var _type_isSame_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../type/isSame.js */ "./dist/fn/type/isSame.js");
|
|
9305
|
+
/* harmony import */ var _search_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./search.js */ "./dist/fn/object/search.js");
|
|
9306
|
+
|
|
9307
|
+
|
|
9304
9308
|
|
|
9305
9309
|
|
|
9306
9310
|
var mutateArray = function (a1, a2) {
|
|
@@ -9320,10 +9324,11 @@ var mutateArray = function (a1, a2) {
|
|
|
9320
9324
|
a1.splice(i, 1);
|
|
9321
9325
|
}
|
|
9322
9326
|
}
|
|
9323
|
-
|
|
9324
|
-
|
|
9327
|
+
// Insert or move items to match the order of a2
|
|
9328
|
+
for (var j = 0; j < a1Ordered.length; j++) {
|
|
9329
|
+
if ((j >= a1.length) || !(0,_type_isSame_js__WEBPACK_IMPORTED_MODULE_2__.isSame)(a1[j], a1Ordered[j])) {
|
|
9325
9330
|
// Find the index of the item in a1, if it exists
|
|
9326
|
-
var indexInA1 =
|
|
9331
|
+
var indexInA1 = (0,_search_js__WEBPACK_IMPORTED_MODULE_3__.search)(a1, a1Ordered[j]);
|
|
9327
9332
|
if (indexInA1 !== -1) {
|
|
9328
9333
|
// Move the item to the correct position if it already exists in a1
|
|
9329
9334
|
var itemToMove = a1.splice(indexInA1, 1)[0];
|
|
@@ -9334,10 +9339,6 @@ var mutateArray = function (a1, a2) {
|
|
|
9334
9339
|
a1.splice(j, 0, a1Ordered[j]);
|
|
9335
9340
|
}
|
|
9336
9341
|
}
|
|
9337
|
-
};
|
|
9338
|
-
// Insert or move items to match the order of a2
|
|
9339
|
-
for (var j = 0; j < a1Ordered.length; j++) {
|
|
9340
|
-
_loop_1(j);
|
|
9341
9342
|
}
|
|
9342
9343
|
// If a1 has extra items at the end (not present in a2), remove them
|
|
9343
9344
|
if (a1.length > a1Ordered.length) {
|