@oscarpalmer/atoms 0.196.1 → 0.198.0
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/filter.mjs +1 -0
- package/dist/array/find.mjs +2 -1
- package/dist/array/first.mjs +2 -1
- package/dist/array/group-by.mjs +2 -1
- package/dist/array/last.mjs +2 -1
- package/dist/array/move.mjs +6 -2
- package/dist/array/sort.mjs +8 -3
- package/dist/array/swap.mjs +2 -1
- package/dist/array/to-map.mjs +2 -1
- package/dist/array/to-record.mjs +2 -1
- package/dist/index.d.mts +747 -705
- package/dist/index.mjs +225 -123
- package/dist/internal/array/callbacks.mjs +1 -0
- package/dist/internal/array/index-of.mjs +2 -1
- package/dist/internal/function/assert.mjs +12 -5
- package/dist/internal/math/aggregate.d.mts +2 -2
- package/dist/internal/sized/map.mjs +3 -2
- package/dist/internal/value/compare.d.mts +1 -1
- package/dist/internal/value/compare.mjs +12 -8
- package/dist/internal/value/handlers.d.mts +1 -1
- package/dist/internal/value/has.mjs +2 -1
- package/dist/promise/index.mjs +2 -1
- package/dist/queue.mjs +2 -1
- package/dist/sized/set.mjs +5 -6
- package/dist/string/fuzzy.mjs +2 -1
- package/dist/string/normalize.mjs +2 -1
- package/dist/string/template.mjs +2 -1
- package/dist/value/clone.d.mts +53 -11
- package/dist/value/clone.mjs +134 -77
- package/dist/value/collection.mjs +3 -1
- package/dist/value/freeze.mjs +6 -2
- package/dist/value/merge.mjs +4 -2
- package/dist/value/transform.mjs +2 -1
- package/package.json +4 -3
package/dist/array/filter.mjs
CHANGED
package/dist/array/find.mjs
CHANGED
|
@@ -3,9 +3,10 @@ import { FIND_VALUE_ITEM, findValue } from "../internal/array/find.mjs";
|
|
|
3
3
|
function find(array, ...parameters) {
|
|
4
4
|
return findValue(FIND_VALUE_ITEM, array, parameters, false);
|
|
5
5
|
}
|
|
6
|
-
find.last = findLast;
|
|
7
6
|
function findLast(array, ...parameters) {
|
|
8
7
|
return findValue(FIND_VALUE_ITEM, array, parameters, true);
|
|
9
8
|
}
|
|
9
|
+
find.last = findLast;
|
|
10
|
+
Object.defineProperty(find, "last", { value: findLast });
|
|
10
11
|
//#endregion
|
|
11
12
|
export { find, findLast };
|
package/dist/array/first.mjs
CHANGED
|
@@ -3,9 +3,10 @@ import { findAbsoluteValueOrDefault } from "../internal/array/find.mjs";
|
|
|
3
3
|
function first(array, ...parameters) {
|
|
4
4
|
return findAbsoluteValueOrDefault(array, parameters, void 0, false, false);
|
|
5
5
|
}
|
|
6
|
-
first.default = firstOrDefault;
|
|
7
6
|
function firstOrDefault(array, defaultValue, ...parameters) {
|
|
8
7
|
return findAbsoluteValueOrDefault(array, parameters, defaultValue, true, false);
|
|
9
8
|
}
|
|
9
|
+
first.default = firstOrDefault;
|
|
10
|
+
Object.defineProperty(first, "default", { value: firstOrDefault });
|
|
10
11
|
//#endregion
|
|
11
12
|
export { first, firstOrDefault };
|
package/dist/array/group-by.mjs
CHANGED
|
@@ -3,9 +3,10 @@ import { groupValues } from "../internal/array/group.mjs";
|
|
|
3
3
|
function groupBy(array, first, second) {
|
|
4
4
|
return groupValues(array, first, second, false);
|
|
5
5
|
}
|
|
6
|
-
groupBy.arrays = groupArraysBy;
|
|
7
6
|
function groupArraysBy(array, first, second) {
|
|
8
7
|
return groupValues(array, first, second, true);
|
|
9
8
|
}
|
|
9
|
+
groupBy.arrays = groupArraysBy;
|
|
10
|
+
Object.defineProperty(groupBy, "arrays", { value: groupArraysBy });
|
|
10
11
|
//#endregion
|
|
11
12
|
export { groupArraysBy, groupBy };
|
package/dist/array/last.mjs
CHANGED
|
@@ -3,9 +3,10 @@ import { findAbsoluteValueOrDefault } from "../internal/array/find.mjs";
|
|
|
3
3
|
function last(array, ...parameters) {
|
|
4
4
|
return findAbsoluteValueOrDefault(array, parameters, void 0, false, true);
|
|
5
5
|
}
|
|
6
|
-
last.default = lastOrDefault;
|
|
7
6
|
function lastOrDefault(array, defaultValue, ...parameters) {
|
|
8
7
|
return findAbsoluteValueOrDefault(array, parameters, defaultValue, true, true);
|
|
9
8
|
}
|
|
9
|
+
last.default = lastOrDefault;
|
|
10
|
+
Object.defineProperty(last, "default", { value: lastOrDefault });
|
|
10
11
|
//#endregion
|
|
11
12
|
export { last, lastOrDefault };
|
package/dist/array/move.mjs
CHANGED
|
@@ -23,8 +23,6 @@ function move(array, from, to, key) {
|
|
|
23
23
|
else array.splice(next, 0, ...firstArray);
|
|
24
24
|
return array;
|
|
25
25
|
}
|
|
26
|
-
move.indices = moveIndices;
|
|
27
|
-
move.toIndex = moveToIndex;
|
|
28
26
|
/**
|
|
29
27
|
* Move an item from one index to another within an array
|
|
30
28
|
*
|
|
@@ -72,5 +70,11 @@ function moveToIndex(array, value, index, key) {
|
|
|
72
70
|
else array.splice(next, 0, ...values);
|
|
73
71
|
return array;
|
|
74
72
|
}
|
|
73
|
+
move.indices = moveIndices;
|
|
74
|
+
move.toIndex = moveToIndex;
|
|
75
|
+
Object.defineProperties(move, {
|
|
76
|
+
indices: { value: moveIndices },
|
|
77
|
+
toIndex: { value: moveToIndex }
|
|
78
|
+
});
|
|
75
79
|
//#endregion
|
|
76
80
|
export { move, moveIndices, moveToIndex };
|
package/dist/array/sort.mjs
CHANGED
|
@@ -126,9 +126,6 @@ function sortArray(array, sorters) {
|
|
|
126
126
|
const { length } = sorters;
|
|
127
127
|
return array.length > 1 ? array.sort((first, second) => getComparisonValue(first, second, sorters, length)) : array;
|
|
128
128
|
}
|
|
129
|
-
sort.getIndex = getSortedIndex;
|
|
130
|
-
sort.initialize = initializeSorter;
|
|
131
|
-
sort.is = isSorted;
|
|
132
129
|
const SORT_PEEK_PERCENTAGE = 10;
|
|
133
130
|
const SORT_THRESHOLD = 100;
|
|
134
131
|
const SORT_DIRECTION_ASCENDING = "ascending";
|
|
@@ -137,5 +134,13 @@ const modifiers = {
|
|
|
137
134
|
[SORT_DIRECTION_ASCENDING]: 1,
|
|
138
135
|
[SORT_DIRECTION_DESCENDING]: -1
|
|
139
136
|
};
|
|
137
|
+
sort.getIndex = getSortedIndex;
|
|
138
|
+
sort.initialize = initializeSorter;
|
|
139
|
+
sort.is = isSorted;
|
|
140
|
+
Object.defineProperties(sort, {
|
|
141
|
+
getIndex: { value: getSortedIndex },
|
|
142
|
+
initialize: { value: initializeSorter },
|
|
143
|
+
is: { value: isSorted }
|
|
144
|
+
});
|
|
140
145
|
//#endregion
|
|
141
146
|
export { SORT_DIRECTION_ASCENDING, SORT_DIRECTION_DESCENDING, getSortedIndex, initializeSorter, isSorted, sort };
|
package/dist/array/swap.mjs
CHANGED
|
@@ -9,7 +9,6 @@ function swap(array, first, second, third) {
|
|
|
9
9
|
if (Array.isArray(first) && Array.isArray(second)) return swapArrays(array, first, second, third);
|
|
10
10
|
return swapValues(array, first, second, third);
|
|
11
11
|
}
|
|
12
|
-
swap.indices = swapIndices;
|
|
13
12
|
function swapArrays(array, from, to, key) {
|
|
14
13
|
if (from.length === 0 || to.length === 0) return array;
|
|
15
14
|
if (from.length === 1 && to.length === 1) return swapValues(array, from[0], to[0], key);
|
|
@@ -58,5 +57,7 @@ function swapValues(array, from, to, key) {
|
|
|
58
57
|
if (first === second || first === -1 || second === -1) return array;
|
|
59
58
|
return swapIndices(array, first, second);
|
|
60
59
|
}
|
|
60
|
+
swap.indices = swapIndices;
|
|
61
|
+
Object.defineProperty(swap, "indices", { value: swapIndices });
|
|
61
62
|
//#endregion
|
|
62
63
|
export { swap };
|
package/dist/array/to-map.mjs
CHANGED
|
@@ -20,9 +20,10 @@ function getMapValues(array, first, second, arrays) {
|
|
|
20
20
|
function toMap(array, first, second) {
|
|
21
21
|
return getMapValues(array, first, second, false);
|
|
22
22
|
}
|
|
23
|
-
toMap.arrays = toMapArrays;
|
|
24
23
|
function toMapArrays(array, first, second) {
|
|
25
24
|
return getMapValues(array, first, second, true);
|
|
26
25
|
}
|
|
26
|
+
toMap.arrays = toMapArrays;
|
|
27
|
+
Object.defineProperty(toMap, "arrays", { value: toMapArrays });
|
|
27
28
|
//#endregion
|
|
28
29
|
export { toMap, toMapArrays };
|
package/dist/array/to-record.mjs
CHANGED
|
@@ -3,9 +3,10 @@ import { groupValues } from "../internal/array/group.mjs";
|
|
|
3
3
|
function toRecord(array, first, second) {
|
|
4
4
|
return groupValues(array, first, second, false);
|
|
5
5
|
}
|
|
6
|
-
toRecord.arrays = toRecordArrays;
|
|
7
6
|
function toRecordArrays(array, first, second) {
|
|
8
7
|
return groupValues(array, first, second, true);
|
|
9
8
|
}
|
|
9
|
+
toRecord.arrays = toRecordArrays;
|
|
10
|
+
Object.defineProperty(toRecord, "arrays", { value: toRecordArrays });
|
|
10
11
|
//#endregion
|
|
11
12
|
export { toRecord, toRecordArrays };
|