@oscarpalmer/atoms 0.90.0 → 0.92.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/chunk.cjs +5 -2
- package/dist/array/chunk.js +2 -3
- package/dist/array/compact.cjs +5 -2
- package/dist/array/compact.js +2 -3
- package/dist/array/count.cjs +8 -5
- package/dist/array/count.js +5 -6
- package/dist/array/exists.cjs +7 -3
- package/dist/array/exists.js +4 -4
- package/dist/array/filter.cjs +7 -3
- package/dist/array/filter.js +4 -4
- package/dist/array/find.cjs +7 -3
- package/dist/array/find.js +4 -4
- package/dist/array/group-by.cjs +9 -6
- package/dist/array/group-by.js +6 -8
- package/dist/array/index-of.cjs +7 -3
- package/dist/array/index-of.js +4 -4
- package/dist/array/index.cjs +21 -17
- package/dist/array/index.js +19 -35
- package/dist/array/insert.cjs +8 -4
- package/dist/array/insert.js +5 -6
- package/dist/array/models.cjs +2 -1
- package/dist/array/shuffle.cjs +7 -3
- package/dist/array/shuffle.js +4 -4
- package/dist/array/sort.cjs +10 -6
- package/dist/array/sort.js +7 -7
- package/dist/array/splice.cjs +7 -3
- package/dist/array/splice.js +4 -4
- package/dist/array/to-map.cjs +9 -6
- package/dist/array/to-map.js +6 -7
- package/dist/array/to-record.cjs +7 -3
- package/dist/array/to-record.js +4 -4
- package/dist/array/unique.cjs +7 -3
- package/dist/array/unique.js +4 -4
- package/dist/color.cjs +276 -0
- package/dist/color.js +263 -0
- package/dist/emitter.cjs +15 -15
- package/dist/emitter.js +12 -16
- package/dist/function.cjs +18 -19
- package/dist/function.js +14 -22
- package/dist/i18n.cjs +8 -6
- package/dist/i18n.js +5 -7
- package/dist/index.cjs +72 -77
- package/dist/index.js +42 -144
- package/dist/internal/array/callbacks.cjs +5 -2
- package/dist/internal/array/callbacks.js +2 -3
- package/dist/internal/array/find.cjs +12 -10
- package/dist/internal/array/find.js +9 -12
- package/dist/internal/math/aggregate.cjs +5 -2
- package/dist/internal/math/aggregate.js +2 -3
- package/dist/internal/string/key.cjs +5 -2
- package/dist/internal/string/key.js +2 -3
- package/dist/internal/value/handle.cjs +7 -3
- package/dist/internal/value/handle.js +4 -4
- package/dist/internal/value/paths.cjs +5 -2
- package/dist/internal/value/paths.js +2 -3
- package/dist/is.cjs +9 -5
- package/dist/is.js +4 -15
- package/dist/logger.cjs +7 -3
- package/dist/logger.js +4 -4
- package/dist/math.cjs +7 -3
- package/dist/math.js +4 -8
- package/dist/models.cjs +2 -1
- package/dist/number.cjs +5 -2
- package/dist/number.js +2 -5
- package/dist/query.cjs +13 -9
- package/dist/query.js +7 -8
- package/dist/random.cjs +7 -3
- package/dist/random.js +4 -11
- package/dist/schema.cjs +5 -2
- package/dist/schema.js +2 -3
- package/dist/sized.cjs +33 -32
- package/dist/sized.js +30 -34
- package/dist/string/case.cjs +13 -9
- package/dist/string/case.js +6 -11
- package/dist/string/index.cjs +16 -58
- package/dist/string/index.js +3 -65
- package/dist/string/misc.cjs +59 -0
- package/dist/string/misc.js +50 -0
- package/dist/string/template.cjs +11 -7
- package/dist/string/template.js +7 -7
- package/dist/touch.cjs +4 -2
- package/dist/touch.js +3 -4
- package/dist/value/clone.cjs +8 -4
- package/dist/value/clone.js +5 -5
- package/dist/value/compare.cjs +12 -8
- package/dist/value/compare.js +5 -5
- package/dist/value/diff.cjs +13 -9
- package/dist/value/diff.js +8 -8
- package/dist/value/equal.cjs +7 -3
- package/dist/value/equal.js +4 -4
- package/dist/value/get.cjs +8 -4
- package/dist/value/get.js +5 -5
- package/dist/value/index.cjs +15 -11
- package/dist/value/index.js +12 -21
- package/dist/value/merge.cjs +8 -4
- package/dist/value/merge.js +5 -5
- package/dist/value/set.cjs +8 -4
- package/dist/value/set.js +5 -5
- package/dist/value/smush.cjs +11 -7
- package/dist/value/smush.js +5 -5
- package/dist/value/unsmush.cjs +8 -4
- package/dist/value/unsmush.js +5 -5
- package/package.json +7 -7
- package/src/color.ts +432 -0
- package/src/function.ts +1 -1
- package/src/index.ts +1 -1
- package/src/is.ts +1 -1
- package/src/query.ts +1 -1
- package/src/string/case.ts +1 -1
- package/src/string/index.ts +1 -95
- package/src/string/misc.ts +94 -0
- package/src/string/template.ts +1 -1
- package/src/value/compare.ts +1 -1
- package/src/value/diff.ts +1 -1
- package/src/value/smush.ts +1 -1
- package/types/color.d.cts +73 -0
- package/types/color.d.ts +69 -0
- package/types/index.d.cts +83 -220
- package/types/index.d.ts +1 -1
- package/types/models.d.cts +41 -40
- package/types/schema.d.cts +40 -39
- package/types/string/index.d.cts +14 -14
- package/types/string/index.d.ts +1 -26
- package/types/string/misc.d.cts +30 -0
- package/types/string/misc.d.ts +26 -0
- package/types/value/get.d.cts +41 -40
- package/types/value/index.d.cts +41 -40
- package/types/value/set.d.cts +41 -40
- package/types/value/smush.d.cts +41 -40
- package/dist/color/base.cjs +0 -43
- package/dist/color/base.js +0 -43
- package/dist/color/functions.cjs +0 -96
- package/dist/color/functions.js +0 -96
- package/dist/color/hex.cjs +0 -56
- package/dist/color/hex.js +0 -56
- package/dist/color/hsl.cjs +0 -75
- package/dist/color/hsl.js +0 -75
- package/dist/color/index.cjs +0 -34
- package/dist/color/index.js +0 -34
- package/dist/color/is.cjs +0 -27
- package/dist/color/is.js +0 -27
- package/dist/color/rgb.cjs +0 -81
- package/dist/color/rgb.js +0 -81
- package/src/color/base.ts +0 -79
- package/src/color/functions.ts +0 -137
- package/src/color/hex.ts +0 -74
- package/src/color/hsl.ts +0 -94
- package/src/color/index.ts +0 -29
- package/src/color/is.ts +0 -54
- package/src/color/rgb.ts +0 -101
- package/types/color/base.d.cts +0 -161
- package/types/color/base.d.ts +0 -32
- package/types/color/functions.d.cts +0 -181
- package/types/color/functions.d.ts +0 -23
- package/types/color/hex.d.cts +0 -165
- package/types/color/hex.d.ts +0 -35
- package/types/color/hsl.d.cts +0 -165
- package/types/color/hsl.d.ts +0 -55
- package/types/color/index.d.cts +0 -211
- package/types/color/index.d.ts +0 -10
- package/types/color/is.d.cts +0 -178
- package/types/color/is.d.ts +0 -20
- package/types/color/rgb.d.cts +0 -165
- package/types/color/rgb.d.ts +0 -59
package/dist/array/chunk.cjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
3
5
|
function chunk(array, size) {
|
|
4
6
|
if (!Array.isArray(array)) {
|
|
5
7
|
return [];
|
|
@@ -20,4 +22,5 @@ function chunk(array, size) {
|
|
|
20
22
|
}
|
|
21
23
|
return chunks;
|
|
22
24
|
}
|
|
25
|
+
|
|
23
26
|
exports.chunk = chunk;
|
package/dist/array/chunk.js
CHANGED
package/dist/array/compact.cjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
3
5
|
function compact(array, strict) {
|
|
4
6
|
if (!Array.isArray(array)) {
|
|
5
7
|
return [];
|
|
@@ -15,4 +17,5 @@ function compact(array, strict) {
|
|
|
15
17
|
}
|
|
16
18
|
return compacted;
|
|
17
19
|
}
|
|
20
|
+
|
|
18
21
|
exports.compact = compact;
|
package/dist/array/compact.js
CHANGED
package/dist/array/count.cjs
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const internal_array_find = require('../internal/array/find.cjs');
|
|
6
|
+
|
|
4
7
|
function count(array, ...parameters) {
|
|
5
|
-
var _a;
|
|
6
8
|
if (Array.isArray(parameters) && parameters.length === 1 && typeof parameters[0] !== "function") {
|
|
7
9
|
if (!Array.isArray(array)) {
|
|
8
10
|
return Number.NaN;
|
|
@@ -18,6 +20,7 @@ function count(array, ...parameters) {
|
|
|
18
20
|
}
|
|
19
21
|
return result;
|
|
20
22
|
}
|
|
21
|
-
return
|
|
23
|
+
return internal_array_find.findValues("all", array, parameters, true)?.length ?? Number.NaN;
|
|
22
24
|
}
|
|
25
|
+
|
|
23
26
|
exports.count = count;
|
package/dist/array/count.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { findValues } from
|
|
1
|
+
import { findValues } from '../internal/array/find.js';
|
|
2
|
+
|
|
2
3
|
function count(array, ...parameters) {
|
|
3
|
-
var _a;
|
|
4
4
|
if (Array.isArray(parameters) && parameters.length === 1 && typeof parameters[0] !== "function") {
|
|
5
5
|
if (!Array.isArray(array)) {
|
|
6
6
|
return Number.NaN;
|
|
@@ -16,8 +16,7 @@ function count(array, ...parameters) {
|
|
|
16
16
|
}
|
|
17
17
|
return result;
|
|
18
18
|
}
|
|
19
|
-
return
|
|
19
|
+
return findValues("all", array, parameters, true)?.length ?? Number.NaN;
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
};
|
|
21
|
+
|
|
22
|
+
export { count };
|
package/dist/array/exists.cjs
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const internal_array_find = require('../internal/array/find.cjs');
|
|
6
|
+
|
|
4
7
|
function exists(array, ...parameters) {
|
|
5
8
|
if (parameters.length === 1 && typeof parameters[0] !== "function") {
|
|
6
9
|
return Array.isArray(array) ? array.includes(parameters[0]) : false;
|
|
7
10
|
}
|
|
8
11
|
return internal_array_find.findValue("index", array, parameters) > -1;
|
|
9
12
|
}
|
|
13
|
+
|
|
10
14
|
exports.exists = exists;
|
package/dist/array/exists.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { findValue } from
|
|
1
|
+
import { findValue } from '../internal/array/find.js';
|
|
2
|
+
|
|
2
3
|
function exists(array, ...parameters) {
|
|
3
4
|
if (parameters.length === 1 && typeof parameters[0] !== "function") {
|
|
4
5
|
return Array.isArray(array) ? array.includes(parameters[0]) : false;
|
|
5
6
|
}
|
|
6
7
|
return findValue("index", array, parameters) > -1;
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
9
|
+
|
|
10
|
+
export { exists };
|
package/dist/array/filter.cjs
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const internal_array_find = require('../internal/array/find.cjs');
|
|
6
|
+
|
|
4
7
|
function filter(array, ...parameters) {
|
|
5
8
|
return internal_array_find.findValues("all", array, parameters);
|
|
6
9
|
}
|
|
10
|
+
|
|
7
11
|
exports.filter = filter;
|
package/dist/array/filter.js
CHANGED
package/dist/array/find.cjs
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const internal_array_find = require('../internal/array/find.cjs');
|
|
6
|
+
|
|
4
7
|
function find(array, ...parameters) {
|
|
5
8
|
return internal_array_find.findValue("value", array, parameters);
|
|
6
9
|
}
|
|
10
|
+
|
|
7
11
|
exports.find = find;
|
package/dist/array/find.js
CHANGED
package/dist/array/group-by.cjs
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const internal_array_callbacks = require('../internal/array/callbacks.cjs');
|
|
6
|
+
|
|
4
7
|
function groupBy(array, key, valueOrArrays, arrays) {
|
|
5
8
|
return groupValues(
|
|
6
9
|
array,
|
|
@@ -10,7 +13,6 @@ function groupBy(array, key, valueOrArrays, arrays) {
|
|
|
10
13
|
);
|
|
11
14
|
}
|
|
12
15
|
function groupValues(array, key, value, arrays) {
|
|
13
|
-
var _a, _b;
|
|
14
16
|
if (!Array.isArray(array) || array.length === 0) {
|
|
15
17
|
return {};
|
|
16
18
|
}
|
|
@@ -19,8 +21,8 @@ function groupValues(array, key, value, arrays) {
|
|
|
19
21
|
const { length } = array;
|
|
20
22
|
for (let index = 0; index < length; index += 1) {
|
|
21
23
|
const item = array[index];
|
|
22
|
-
const keyed =
|
|
23
|
-
const valued =
|
|
24
|
+
const keyed = callbacks?.key?.(item, index, array) ?? index;
|
|
25
|
+
const valued = callbacks?.value?.(item, index, array) ?? item;
|
|
24
26
|
if (arrays) {
|
|
25
27
|
const existing = record[keyed];
|
|
26
28
|
if (existing == null) {
|
|
@@ -34,5 +36,6 @@ function groupValues(array, key, value, arrays) {
|
|
|
34
36
|
}
|
|
35
37
|
return record;
|
|
36
38
|
}
|
|
39
|
+
|
|
37
40
|
exports.groupBy = groupBy;
|
|
38
41
|
exports.groupValues = groupValues;
|
package/dist/array/group-by.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { getCallbacks } from
|
|
1
|
+
import { getCallbacks } from '../internal/array/callbacks.js';
|
|
2
|
+
|
|
2
3
|
function groupBy(array, key, valueOrArrays, arrays) {
|
|
3
4
|
return groupValues(
|
|
4
5
|
array,
|
|
@@ -8,7 +9,6 @@ function groupBy(array, key, valueOrArrays, arrays) {
|
|
|
8
9
|
);
|
|
9
10
|
}
|
|
10
11
|
function groupValues(array, key, value, arrays) {
|
|
11
|
-
var _a, _b;
|
|
12
12
|
if (!Array.isArray(array) || array.length === 0) {
|
|
13
13
|
return {};
|
|
14
14
|
}
|
|
@@ -17,8 +17,8 @@ function groupValues(array, key, value, arrays) {
|
|
|
17
17
|
const { length } = array;
|
|
18
18
|
for (let index = 0; index < length; index += 1) {
|
|
19
19
|
const item = array[index];
|
|
20
|
-
const keyed =
|
|
21
|
-
const valued =
|
|
20
|
+
const keyed = callbacks?.key?.(item, index, array) ?? index;
|
|
21
|
+
const valued = callbacks?.value?.(item, index, array) ?? item;
|
|
22
22
|
if (arrays) {
|
|
23
23
|
const existing = record[keyed];
|
|
24
24
|
if (existing == null) {
|
|
@@ -32,7 +32,5 @@ function groupValues(array, key, value, arrays) {
|
|
|
32
32
|
}
|
|
33
33
|
return record;
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
groupValues
|
|
38
|
-
};
|
|
35
|
+
|
|
36
|
+
export { groupBy, groupValues };
|
package/dist/array/index-of.cjs
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const internal_array_find = require('../internal/array/find.cjs');
|
|
6
|
+
|
|
4
7
|
function indexOf(array, ...parameters) {
|
|
5
8
|
return internal_array_find.findValue("index", array, parameters);
|
|
6
9
|
}
|
|
10
|
+
|
|
7
11
|
exports.indexOf = indexOf;
|
package/dist/array/index-of.js
CHANGED
package/dist/array/index.cjs
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const array_insert = require('./insert.cjs');
|
|
6
|
+
const array_chunk = require('./chunk.cjs');
|
|
7
|
+
const array_compact = require('./compact.cjs');
|
|
8
|
+
const array_count = require('./count.cjs');
|
|
9
|
+
const array_exists = require('./exists.cjs');
|
|
10
|
+
const array_filter = require('./filter.cjs');
|
|
11
|
+
const array_find = require('./find.cjs');
|
|
12
|
+
const array_groupBy = require('./group-by.cjs');
|
|
13
|
+
const array_indexOf = require('./index-of.cjs');
|
|
14
|
+
const array_shuffle = require('./shuffle.cjs');
|
|
15
|
+
const array_sort = require('./sort.cjs');
|
|
16
|
+
const array_splice = require('./splice.cjs');
|
|
17
|
+
const array_toMap = require('./to-map.cjs');
|
|
18
|
+
const array_toRecord = require('./to-record.cjs');
|
|
19
|
+
const array_unique = require('./unique.cjs');
|
|
20
|
+
|
|
18
21
|
function flatten(array) {
|
|
19
22
|
if (!Array.isArray(array)) {
|
|
20
23
|
return [];
|
|
@@ -24,6 +27,7 @@ function flatten(array) {
|
|
|
24
27
|
function push(array, pushed) {
|
|
25
28
|
return array_insert.insertValues("push", array, pushed, array.length, 0);
|
|
26
29
|
}
|
|
30
|
+
|
|
27
31
|
exports.insert = array_insert.insert;
|
|
28
32
|
exports.chunk = array_chunk.chunk;
|
|
29
33
|
exports.compact = array_compact.compact;
|
package/dist/array/index.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { insertValues } from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { insertValues } from './insert.js';
|
|
2
|
+
export { insert } from './insert.js';
|
|
3
|
+
export { chunk } from './chunk.js';
|
|
4
|
+
export { compact } from './compact.js';
|
|
5
|
+
export { count } from './count.js';
|
|
6
|
+
export { exists } from './exists.js';
|
|
7
|
+
export { filter } from './filter.js';
|
|
8
|
+
export { find } from './find.js';
|
|
9
|
+
export { groupBy } from './group-by.js';
|
|
10
|
+
export { indexOf } from './index-of.js';
|
|
11
|
+
export { shuffle } from './shuffle.js';
|
|
12
|
+
export { sort } from './sort.js';
|
|
13
|
+
export { splice } from './splice.js';
|
|
14
|
+
export { toMap } from './to-map.js';
|
|
15
|
+
export { toRecord } from './to-record.js';
|
|
16
|
+
export { unique } from './unique.js';
|
|
17
|
+
|
|
17
18
|
function flatten(array) {
|
|
18
19
|
if (!Array.isArray(array)) {
|
|
19
20
|
return [];
|
|
@@ -23,22 +24,5 @@ function flatten(array) {
|
|
|
23
24
|
function push(array, pushed) {
|
|
24
25
|
return insertValues("push", array, pushed, array.length, 0);
|
|
25
26
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
compact,
|
|
29
|
-
count,
|
|
30
|
-
exists,
|
|
31
|
-
filter,
|
|
32
|
-
find,
|
|
33
|
-
flatten,
|
|
34
|
-
groupBy,
|
|
35
|
-
indexOf,
|
|
36
|
-
insert,
|
|
37
|
-
push,
|
|
38
|
-
shuffle,
|
|
39
|
-
sort,
|
|
40
|
-
splice,
|
|
41
|
-
toMap,
|
|
42
|
-
toRecord,
|
|
43
|
-
unique
|
|
44
|
-
};
|
|
27
|
+
|
|
28
|
+
export { flatten, push };
|
package/dist/array/insert.cjs
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const array_chunk = require('./chunk.cjs');
|
|
6
|
+
|
|
4
7
|
function insert(array, indexOrItems, items) {
|
|
5
8
|
return insertValues(
|
|
6
9
|
"insert",
|
|
7
10
|
array,
|
|
8
11
|
items == null ? indexOrItems : items,
|
|
9
|
-
typeof indexOrItems === "number" ? indexOrItems : array
|
|
12
|
+
typeof indexOrItems === "number" ? indexOrItems : array?.length,
|
|
10
13
|
0
|
|
11
14
|
);
|
|
12
15
|
}
|
|
@@ -35,5 +38,6 @@ function insertValues(type, array, items, start, deleteCount) {
|
|
|
35
38
|
}
|
|
36
39
|
return type === "insert" ? array : type === "splice" ? returned : array.length;
|
|
37
40
|
}
|
|
41
|
+
|
|
38
42
|
exports.insert = insert;
|
|
39
43
|
exports.insertValues = insertValues;
|
package/dist/array/insert.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { chunk } from
|
|
1
|
+
import { chunk } from './chunk.js';
|
|
2
|
+
|
|
2
3
|
function insert(array, indexOrItems, items) {
|
|
3
4
|
return insertValues(
|
|
4
5
|
"insert",
|
|
5
6
|
array,
|
|
6
7
|
items == null ? indexOrItems : items,
|
|
7
|
-
typeof indexOrItems === "number" ? indexOrItems : array
|
|
8
|
+
typeof indexOrItems === "number" ? indexOrItems : array?.length,
|
|
8
9
|
0
|
|
9
10
|
);
|
|
10
11
|
}
|
|
@@ -33,7 +34,5 @@ function insertValues(type, array, items, start, deleteCount) {
|
|
|
33
34
|
}
|
|
34
35
|
return type === "insert" ? array : type === "splice" ? returned : array.length;
|
|
35
36
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
insertValues
|
|
39
|
-
};
|
|
37
|
+
|
|
38
|
+
export { insert, insertValues };
|
package/dist/array/models.cjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
package/dist/array/shuffle.cjs
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const random = require('../random.cjs');
|
|
6
|
+
|
|
4
7
|
function shuffle(array) {
|
|
5
8
|
if (!Array.isArray(array)) {
|
|
6
9
|
return [];
|
|
@@ -16,4 +19,5 @@ function shuffle(array) {
|
|
|
16
19
|
}
|
|
17
20
|
return shuffled;
|
|
18
21
|
}
|
|
22
|
+
|
|
19
23
|
exports.shuffle = shuffle;
|
package/dist/array/shuffle.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { getRandomInteger } from
|
|
1
|
+
import { getRandomInteger } from '../random.js';
|
|
2
|
+
|
|
2
3
|
function shuffle(array) {
|
|
3
4
|
if (!Array.isArray(array)) {
|
|
4
5
|
return [];
|
|
@@ -14,6 +15,5 @@ function shuffle(array) {
|
|
|
14
15
|
}
|
|
15
16
|
return shuffled;
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
18
|
+
|
|
19
|
+
export { shuffle };
|
package/dist/array/sort.cjs
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const is = require('../is.cjs');
|
|
6
|
+
const value_compare = require('../value/compare.cjs');
|
|
7
|
+
|
|
5
8
|
function sort(array, first, second) {
|
|
6
9
|
if (!Array.isArray(array)) {
|
|
7
10
|
return [];
|
|
@@ -23,8 +26,8 @@ function sort(array, first, second) {
|
|
|
23
26
|
keyWithCallback.callback = (value) => value[key];
|
|
24
27
|
} else if (typeof key === "function") {
|
|
25
28
|
keyWithCallback.callback = key;
|
|
26
|
-
} else if (typeof
|
|
27
|
-
keyWithCallback.direction =
|
|
29
|
+
} else if (typeof key?.value === "function" || is.isKey(key?.value)) {
|
|
30
|
+
keyWithCallback.direction = key?.direction ?? direction;
|
|
28
31
|
keyWithCallback.callback = typeof key.value === "function" ? key.value : (value) => value[key.value];
|
|
29
32
|
}
|
|
30
33
|
if (typeof keyWithCallback.callback === "function") {
|
|
@@ -60,4 +63,5 @@ function sort(array, first, second) {
|
|
|
60
63
|
});
|
|
61
64
|
return sorted;
|
|
62
65
|
}
|
|
66
|
+
|
|
63
67
|
exports.sort = sort;
|
package/dist/array/sort.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { isKey } from
|
|
2
|
-
import { compare } from
|
|
1
|
+
import { isKey } from '../is.js';
|
|
2
|
+
import { compare } from '../value/compare.js';
|
|
3
|
+
|
|
3
4
|
function sort(array, first, second) {
|
|
4
5
|
if (!Array.isArray(array)) {
|
|
5
6
|
return [];
|
|
@@ -21,8 +22,8 @@ function sort(array, first, second) {
|
|
|
21
22
|
keyWithCallback.callback = (value) => value[key];
|
|
22
23
|
} else if (typeof key === "function") {
|
|
23
24
|
keyWithCallback.callback = key;
|
|
24
|
-
} else if (typeof
|
|
25
|
-
keyWithCallback.direction =
|
|
25
|
+
} else if (typeof key?.value === "function" || isKey(key?.value)) {
|
|
26
|
+
keyWithCallback.direction = key?.direction ?? direction;
|
|
26
27
|
keyWithCallback.callback = typeof key.value === "function" ? key.value : (value) => value[key.value];
|
|
27
28
|
}
|
|
28
29
|
if (typeof keyWithCallback.callback === "function") {
|
|
@@ -58,6 +59,5 @@ function sort(array, first, second) {
|
|
|
58
59
|
});
|
|
59
60
|
return sorted;
|
|
60
61
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
};
|
|
62
|
+
|
|
63
|
+
export { sort };
|
package/dist/array/splice.cjs
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const array_insert = require('./insert.cjs');
|
|
6
|
+
|
|
4
7
|
function splice(array, start, deleteCountOrItems, items) {
|
|
5
8
|
return array_insert.insertValues(
|
|
6
9
|
"splice",
|
|
@@ -10,4 +13,5 @@ function splice(array, start, deleteCountOrItems, items) {
|
|
|
10
13
|
typeof deleteCountOrItems === "number" ? deleteCountOrItems : 0
|
|
11
14
|
);
|
|
12
15
|
}
|
|
16
|
+
|
|
13
17
|
exports.splice = splice;
|
package/dist/array/splice.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { insertValues } from
|
|
1
|
+
import { insertValues } from './insert.js';
|
|
2
|
+
|
|
2
3
|
function splice(array, start, deleteCountOrItems, items) {
|
|
3
4
|
return insertValues(
|
|
4
5
|
"splice",
|
|
@@ -8,6 +9,5 @@ function splice(array, start, deleteCountOrItems, items) {
|
|
|
8
9
|
typeof deleteCountOrItems === "number" ? deleteCountOrItems : 0
|
|
9
10
|
);
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
12
|
+
|
|
13
|
+
export { splice };
|
package/dist/array/to-map.cjs
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const internal_array_callbacks = require('../internal/array/callbacks.cjs');
|
|
6
|
+
|
|
4
7
|
function toMap(array, keyOrArrays, valueOrArrays, arrays) {
|
|
5
|
-
var _a, _b;
|
|
6
8
|
if (!Array.isArray(array)) {
|
|
7
9
|
return /* @__PURE__ */ new Map();
|
|
8
10
|
}
|
|
@@ -12,8 +14,8 @@ function toMap(array, keyOrArrays, valueOrArrays, arrays) {
|
|
|
12
14
|
const { length } = array;
|
|
13
15
|
for (let index = 0; index < length; index += 1) {
|
|
14
16
|
const item = array[index];
|
|
15
|
-
const key =
|
|
16
|
-
const value =
|
|
17
|
+
const key = callbacks?.key?.(item, index, array) ?? index;
|
|
18
|
+
const value = callbacks?.value?.(item, index, array) ?? item;
|
|
17
19
|
if (asArrays) {
|
|
18
20
|
const existing = map.get(key);
|
|
19
21
|
if (existing == null) {
|
|
@@ -27,4 +29,5 @@ function toMap(array, keyOrArrays, valueOrArrays, arrays) {
|
|
|
27
29
|
}
|
|
28
30
|
return map;
|
|
29
31
|
}
|
|
32
|
+
|
|
30
33
|
exports.toMap = toMap;
|