@d-matrix/utils 1.21.0 → 1.21.1
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/array.js +3 -1
- package/package.json +1 -1
package/dist/array.js
CHANGED
|
@@ -12,8 +12,10 @@ export function moveImmutable(array, fromIndex, toIndex) {
|
|
|
12
12
|
return newArray;
|
|
13
13
|
}
|
|
14
14
|
export function moveToStart(array, predicate) {
|
|
15
|
-
const newArray = [...array];
|
|
16
15
|
const index = array.findIndex(predicate);
|
|
16
|
+
if (index < 0)
|
|
17
|
+
return array;
|
|
18
|
+
const newArray = [...array];
|
|
17
19
|
moveMutable(newArray, index, 0);
|
|
18
20
|
return newArray;
|
|
19
21
|
}
|