@bbn/bbn 1.0.186 → 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 +9 -10
- package/dist/bbn.js.map +1 -1
- package/dist/fn/object/mutateArray.js +7 -10
- 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) {
|
|
@@ -9311,9 +9315,7 @@ var mutateArray = function (a1, a2) {
|
|
|
9311
9315
|
var a1Ordered = [];
|
|
9312
9316
|
// Build a1Ordered to have the same order and contents as a2
|
|
9313
9317
|
a2.forEach(function (item) {
|
|
9314
|
-
|
|
9315
|
-
a1Ordered.push(item);
|
|
9316
|
-
}
|
|
9318
|
+
a1Ordered.push(item);
|
|
9317
9319
|
});
|
|
9318
9320
|
// Remove items from a1 that are not in a2
|
|
9319
9321
|
var i = a1.length;
|
|
@@ -9322,10 +9324,11 @@ var mutateArray = function (a1, a2) {
|
|
|
9322
9324
|
a1.splice(i, 1);
|
|
9323
9325
|
}
|
|
9324
9326
|
}
|
|
9325
|
-
|
|
9326
|
-
|
|
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])) {
|
|
9327
9330
|
// Find the index of the item in a1, if it exists
|
|
9328
|
-
var indexInA1 =
|
|
9331
|
+
var indexInA1 = (0,_search_js__WEBPACK_IMPORTED_MODULE_3__.search)(a1, a1Ordered[j]);
|
|
9329
9332
|
if (indexInA1 !== -1) {
|
|
9330
9333
|
// Move the item to the correct position if it already exists in a1
|
|
9331
9334
|
var itemToMove = a1.splice(indexInA1, 1)[0];
|
|
@@ -9336,10 +9339,6 @@ var mutateArray = function (a1, a2) {
|
|
|
9336
9339
|
a1.splice(j, 0, a1Ordered[j]);
|
|
9337
9340
|
}
|
|
9338
9341
|
}
|
|
9339
|
-
};
|
|
9340
|
-
// Insert or move items to match the order of a2
|
|
9341
|
-
for (var j = 0; j < a1Ordered.length; j++) {
|
|
9342
|
-
_loop_1(j);
|
|
9343
9342
|
}
|
|
9344
9343
|
// If a1 has extra items at the end (not present in a2), remove them
|
|
9345
9344
|
if (a1.length > a1Ordered.length) {
|