@oscarpalmer/atoms 0.75.0 → 0.76.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/js/array/chunk.cjs +2 -1
- package/dist/js/array/chunk.js +2 -1
- package/dist/js/array/count.cjs +10 -3
- package/dist/js/array/count.js +10 -3
- package/dist/js/array/exists.cjs +10 -3
- package/dist/js/array/exists.js +10 -3
- package/dist/js/array/filter.cjs +10 -3
- package/dist/js/array/filter.js +10 -3
- package/dist/js/array/find.cjs +10 -3
- package/dist/js/array/find.js +10 -3
- package/dist/js/array/group-by.cjs +18 -16
- package/dist/js/array/group-by.js +18 -16
- package/dist/js/array/index-of.cjs +10 -3
- package/dist/js/array/index-of.js +10 -3
- package/dist/js/array/index.cjs +2 -2
- package/dist/js/array/index.js +2 -2
- package/dist/js/array/insert.cjs +10 -4
- package/dist/js/array/insert.js +10 -4
- package/dist/js/array/splice.cjs +4 -4
- package/dist/js/array/splice.js +4 -4
- package/dist/js/array/to-map.cjs +11 -11
- package/dist/js/array/to-map.js +11 -11
- package/dist/js/array/to-record.cjs +3 -3
- package/dist/js/array/to-record.js +3 -3
- package/dist/js/array/unique.cjs +2 -2
- package/dist/js/array/unique.js +2 -2
- package/dist/js/colour/base.cjs +1 -1
- package/dist/js/colour/base.js +1 -1
- package/dist/js/colour/hex.cjs +2 -2
- package/dist/js/colour/hex.js +2 -2
- package/dist/js/colour/hsl.cjs +13 -7
- package/dist/js/colour/hsl.js +13 -7
- package/dist/js/colour/rgb.cjs +12 -6
- package/dist/js/colour/rgb.js +12 -6
- package/dist/js/emitter.cjs +8 -5
- package/dist/js/emitter.js +8 -5
- package/dist/js/function.cjs +6 -6
- package/dist/js/function.js +6 -6
- package/dist/js/index.cjs +0 -1
- package/dist/js/index.js +1 -2
- package/dist/js/internal/array/callbacks.cjs +23 -0
- package/dist/js/internal/array/callbacks.js +23 -0
- package/dist/js/internal/{array-find.cjs → array/find.cjs} +11 -12
- package/dist/js/internal/{array-find.js → array/find.js} +11 -12
- package/dist/js/logger.cjs +13 -13
- package/dist/js/logger.js +13 -13
- package/dist/js/query.cjs +0 -3
- package/dist/js/query.js +1 -4
- package/dist/js/random.cjs +0 -6
- package/dist/js/random.js +0 -6
- package/dist/js/sized.cjs +1 -1
- package/dist/js/sized.js +1 -1
- package/dist/js/string/index.cjs +7 -1
- package/dist/js/string/index.js +7 -1
- package/dist/js/value/compare.cjs +0 -1
- package/dist/js/value/compare.js +0 -1
- package/dist/js/value/get.cjs +3 -3
- package/dist/js/value/get.js +2 -2
- package/dist/js/value/set.cjs +4 -4
- package/dist/js/value/set.js +2 -2
- package/package.json +3 -2
- package/src/js/array/chunk.ts +6 -5
- package/src/js/array/compact.ts +8 -10
- package/src/js/array/count.ts +39 -19
- package/src/js/array/exists.ts +40 -16
- package/src/js/array/filter.ts +42 -20
- package/src/js/array/find.ts +45 -20
- package/src/js/array/group-by.ts +158 -27
- package/src/js/array/index-of.ts +40 -18
- package/src/js/array/index.ts +10 -9
- package/src/js/array/insert.ts +28 -14
- package/src/js/array/models.ts +18 -15
- package/src/js/array/shuffle.ts +3 -3
- package/src/js/array/sort.ts +28 -34
- package/src/js/array/splice.ts +22 -26
- package/src/js/array/to-map.ts +133 -45
- package/src/js/array/to-record.ts +137 -39
- package/src/js/array/unique.ts +20 -15
- package/src/js/colour/base.ts +3 -3
- package/src/js/colour/functions.ts +4 -6
- package/src/js/colour/hex.ts +5 -5
- package/src/js/colour/hsl.ts +18 -12
- package/src/js/colour/index.ts +1 -1
- package/src/js/colour/is.ts +3 -3
- package/src/js/colour/rgb.ts +17 -11
- package/src/js/emitter.ts +12 -9
- package/src/js/function.ts +12 -12
- package/src/js/index.ts +16 -16
- package/src/js/internal/array/callbacks.ts +33 -0
- package/src/js/internal/{array-find.ts → array/find.ts} +23 -24
- package/src/js/internal/{value-handle.ts → value/handle.ts} +1 -1
- package/src/js/is.ts +2 -2
- package/src/js/logger.ts +14 -14
- package/src/js/math.ts +1 -1
- package/src/js/models.ts +5 -5
- package/src/js/number.ts +2 -2
- package/src/js/query.ts +6 -10
- package/src/js/queue.ts +1 -1
- package/src/js/random.ts +9 -19
- package/src/js/sized.ts +145 -145
- package/src/js/string/case.ts +1 -1
- package/src/js/string/index.ts +13 -7
- package/src/js/string/template.ts +6 -3
- package/src/js/value/clone.ts +3 -7
- package/src/js/value/compare.ts +3 -5
- package/src/js/value/diff.ts +4 -4
- package/src/js/value/equal.ts +2 -2
- package/src/js/value/get.ts +3 -3
- package/src/js/value/index.ts +2 -2
- package/src/js/value/merge.ts +3 -3
- package/src/js/value/set.ts +3 -4
- package/src/js/value/smush.ts +4 -4
- package/src/js/value/unsmush.ts +4 -4
- package/types/array/chunk.d.cts +2 -2
- package/types/array/chunk.d.ts +2 -2
- package/types/array/compact.d.cts +4 -4
- package/types/array/compact.d.ts +4 -4
- package/types/array/count.d.cts +15 -8
- package/types/array/count.d.ts +13 -7
- package/types/array/exists.d.cts +14 -5
- package/types/array/exists.d.ts +12 -4
- package/types/array/filter.d.cts +16 -7
- package/types/array/filter.d.ts +14 -6
- package/types/array/find.d.cts +16 -7
- package/types/array/find.d.ts +14 -6
- package/types/array/group-by.d.cts +51 -5
- package/types/array/group-by.d.ts +49 -5
- package/types/array/index-of.d.cts +16 -7
- package/types/array/index-of.d.ts +14 -6
- package/types/array/index.d.cts +239 -95
- package/types/array/index.d.ts +7 -6
- package/types/array/insert.d.cts +9 -4
- package/types/array/insert.d.ts +10 -5
- package/types/array/models.d.cts +14 -11
- package/types/array/models.d.ts +14 -12
- package/types/array/shuffle.d.cts +2 -2
- package/types/array/shuffle.d.ts +2 -2
- package/types/array/sort.d.cts +11 -11
- package/types/array/sort.d.ts +10 -10
- package/types/array/splice.d.cts +4 -4
- package/types/array/splice.d.ts +4 -4
- package/types/array/to-map.d.cts +44 -20
- package/types/array/to-map.d.ts +42 -20
- package/types/array/to-record.d.cts +44 -20
- package/types/array/to-record.d.ts +42 -20
- package/types/array/unique.d.cts +11 -6
- package/types/array/unique.d.ts +10 -6
- package/types/colour/base.d.cts +28 -16
- package/types/colour/base.d.ts +2 -2
- package/types/colour/functions.d.cts +28 -16
- package/types/colour/functions.d.ts +3 -3
- package/types/colour/hex.d.cts +28 -16
- package/types/colour/hex.d.ts +4 -4
- package/types/colour/hsl.d.cts +28 -16
- package/types/colour/hsl.d.ts +16 -10
- package/types/colour/index.d.cts +28 -16
- package/types/colour/index.d.ts +1 -1
- package/types/colour/is.d.cts +28 -16
- package/types/colour/is.d.ts +3 -3
- package/types/colour/rgb.d.cts +28 -16
- package/types/colour/rgb.d.ts +15 -9
- package/types/emitter.d.cts +11 -8
- package/types/emitter.d.ts +11 -8
- package/types/function.d.cts +10 -10
- package/types/function.d.ts +11 -11
- package/types/index.d.cts +1061 -669
- package/types/index.d.ts +16 -16
- package/types/internal/array/callbacks.d.cts +11 -0
- package/types/internal/array/callbacks.d.ts +2 -0
- package/types/internal/array/find.d.cts +7 -0
- package/types/internal/array/find.d.ts +3 -0
- package/types/internal/{value-handle.d.ts → value/handle.d.ts} +1 -1
- package/types/is.d.ts +1 -1
- package/types/logger.d.cts +13 -13
- package/types/logger.d.ts +13 -13
- package/types/math.d.cts +1 -1
- package/types/math.d.ts +1 -1
- package/types/models.d.cts +4 -4
- package/types/models.d.ts +1 -4
- package/types/number.d.cts +2 -2
- package/types/number.d.ts +2 -2
- package/types/query.d.cts +2 -2
- package/types/query.d.ts +3 -3
- package/types/queue.d.cts +1 -1
- package/types/queue.d.ts +1 -1
- package/types/random.d.cts +8 -12
- package/types/random.d.ts +8 -12
- package/types/sized.d.cts +6 -6
- package/types/sized.d.ts +6 -6
- package/types/string/index.d.cts +6 -3
- package/types/string/index.d.ts +3 -3
- package/types/string/template.d.cts +3 -0
- package/types/string/template.d.ts +4 -1
- package/types/value/clone.d.cts +4 -2
- package/types/value/clone.d.ts +4 -2
- package/types/value/get.d.ts +1 -1
- package/types/value/index.d.cts +8 -6
- package/types/value/index.d.ts +2 -2
- package/types/value/merge.d.cts +1 -1
- package/types/value/merge.d.ts +2 -2
- package/types/value/set.d.ts +1 -1
- package/types/value/smush.d.cts +1 -1
- package/types/value/smush.d.ts +2 -2
- package/types/value/unsmush.d.cts +1 -1
- package/types/value/unsmush.d.ts +2 -2
- package/dist/js/internal/array-callbacks.cjs +0 -18
- package/dist/js/internal/array-callbacks.js +0 -18
- package/src/js/internal/array-callbacks.ts +0 -28
- package/types/internal/array-callbacks.d.cts +0 -13
- package/types/internal/array-callbacks.d.ts +0 -2
- package/types/internal/array-find.d.cts +0 -11
- package/types/internal/array-find.d.ts +0 -4
- /package/dist/js/internal/{value-handle.cjs → value/handle.cjs} +0 -0
- /package/dist/js/internal/{value-handle.js → value/handle.js} +0 -0
- /package/types/internal/{value-handle.d.cts → value/handle.d.cts} +0 -0
package/dist/js/array/chunk.cjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const number = require("../number.cjs");
|
|
3
4
|
function chunk(array, size) {
|
|
5
|
+
const chunkSize = number.clamp(size ?? 64e3, 1, 64e3);
|
|
4
6
|
const { length } = array;
|
|
5
|
-
const chunkSize = typeof size === "number" && size > 0 ? size : 64e3;
|
|
6
7
|
if (length <= chunkSize) {
|
|
7
8
|
return [array];
|
|
8
9
|
}
|
package/dist/js/array/chunk.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { clamp } from "../number.js";
|
|
1
2
|
function chunk(array, size) {
|
|
3
|
+
const chunkSize = clamp(size ?? 64e3, 1, 64e3);
|
|
2
4
|
const { length } = array;
|
|
3
|
-
const chunkSize = typeof size === "number" && size > 0 ? size : 64e3;
|
|
4
5
|
if (length <= chunkSize) {
|
|
5
6
|
return [array];
|
|
6
7
|
}
|
package/dist/js/array/count.cjs
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
function count(array,
|
|
5
|
-
|
|
3
|
+
const internal_array_find = require("../internal/array/find.cjs");
|
|
4
|
+
function count(array, ...parameters) {
|
|
5
|
+
const { length } = parameters;
|
|
6
|
+
return internal_array_find.findValues(
|
|
7
|
+
"all",
|
|
8
|
+
array,
|
|
9
|
+
length === 1 && typeof parameters[0] === "function" ? parameters[0] : void 0,
|
|
10
|
+
length === 2 ? parameters[0] : void 0,
|
|
11
|
+
length === 1 && typeof parameters[0] !== "function" ? parameters[0] : parameters[1]
|
|
12
|
+
).length;
|
|
6
13
|
}
|
|
7
14
|
exports.count = count;
|
package/dist/js/array/count.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import { findValues } from "../internal/array
|
|
2
|
-
function count(array,
|
|
3
|
-
|
|
1
|
+
import { findValues } from "../internal/array/find.js";
|
|
2
|
+
function count(array, ...parameters) {
|
|
3
|
+
const { length } = parameters;
|
|
4
|
+
return findValues(
|
|
5
|
+
"all",
|
|
6
|
+
array,
|
|
7
|
+
length === 1 && typeof parameters[0] === "function" ? parameters[0] : void 0,
|
|
8
|
+
length === 2 ? parameters[0] : void 0,
|
|
9
|
+
length === 1 && typeof parameters[0] !== "function" ? parameters[0] : parameters[1]
|
|
10
|
+
).length;
|
|
4
11
|
}
|
|
5
12
|
export {
|
|
6
13
|
count
|
package/dist/js/array/exists.cjs
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
function exists(array,
|
|
5
|
-
|
|
3
|
+
const internal_array_find = require("../internal/array/find.cjs");
|
|
4
|
+
function exists(array, ...parameters) {
|
|
5
|
+
const { length } = parameters;
|
|
6
|
+
return internal_array_find.findValue(
|
|
7
|
+
"index",
|
|
8
|
+
array,
|
|
9
|
+
length === 1 && typeof parameters[0] === "function" ? parameters[0] : void 0,
|
|
10
|
+
length === 2 ? parameters[0] : void 0,
|
|
11
|
+
length === 1 && typeof parameters[0] !== "function" ? parameters[0] : parameters[1]
|
|
12
|
+
) > -1;
|
|
6
13
|
}
|
|
7
14
|
exports.exists = exists;
|
package/dist/js/array/exists.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import { findValue } from "../internal/array
|
|
2
|
-
function exists(array,
|
|
3
|
-
|
|
1
|
+
import { findValue } from "../internal/array/find.js";
|
|
2
|
+
function exists(array, ...parameters) {
|
|
3
|
+
const { length } = parameters;
|
|
4
|
+
return findValue(
|
|
5
|
+
"index",
|
|
6
|
+
array,
|
|
7
|
+
length === 1 && typeof parameters[0] === "function" ? parameters[0] : void 0,
|
|
8
|
+
length === 2 ? parameters[0] : void 0,
|
|
9
|
+
length === 1 && typeof parameters[0] !== "function" ? parameters[0] : parameters[1]
|
|
10
|
+
) > -1;
|
|
4
11
|
}
|
|
5
12
|
export {
|
|
6
13
|
exists
|
package/dist/js/array/filter.cjs
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
function filter(array,
|
|
5
|
-
|
|
3
|
+
const internal_array_find = require("../internal/array/find.cjs");
|
|
4
|
+
function filter(array, ...parameters) {
|
|
5
|
+
const { length } = parameters;
|
|
6
|
+
return internal_array_find.findValues(
|
|
7
|
+
"all",
|
|
8
|
+
array,
|
|
9
|
+
length === 1 && typeof parameters[0] === "function" ? parameters[0] : void 0,
|
|
10
|
+
length === 2 ? parameters[0] : void 0,
|
|
11
|
+
length === 1 && typeof parameters[0] !== "function" ? parameters[0] : parameters[1]
|
|
12
|
+
);
|
|
6
13
|
}
|
|
7
14
|
exports.filter = filter;
|
package/dist/js/array/filter.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import { findValues } from "../internal/array
|
|
2
|
-
function filter(array,
|
|
3
|
-
|
|
1
|
+
import { findValues } from "../internal/array/find.js";
|
|
2
|
+
function filter(array, ...parameters) {
|
|
3
|
+
const { length } = parameters;
|
|
4
|
+
return findValues(
|
|
5
|
+
"all",
|
|
6
|
+
array,
|
|
7
|
+
length === 1 && typeof parameters[0] === "function" ? parameters[0] : void 0,
|
|
8
|
+
length === 2 ? parameters[0] : void 0,
|
|
9
|
+
length === 1 && typeof parameters[0] !== "function" ? parameters[0] : parameters[1]
|
|
10
|
+
);
|
|
4
11
|
}
|
|
5
12
|
export {
|
|
6
13
|
filter
|
package/dist/js/array/find.cjs
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
function find(array,
|
|
5
|
-
|
|
3
|
+
const internal_array_find = require("../internal/array/find.cjs");
|
|
4
|
+
function find(array, ...parameters) {
|
|
5
|
+
const { length } = parameters;
|
|
6
|
+
return internal_array_find.findValue(
|
|
7
|
+
"value",
|
|
8
|
+
array,
|
|
9
|
+
length === 1 && typeof parameters[0] === "function" ? parameters[0] : void 0,
|
|
10
|
+
length === 2 ? parameters[0] : void 0,
|
|
11
|
+
length === 1 && typeof parameters[0] !== "function" ? parameters[0] : parameters[1]
|
|
12
|
+
);
|
|
6
13
|
}
|
|
7
14
|
exports.find = find;
|
package/dist/js/array/find.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import { findValue } from "../internal/array
|
|
2
|
-
function find(array,
|
|
3
|
-
|
|
1
|
+
import { findValue } from "../internal/array/find.js";
|
|
2
|
+
function find(array, ...parameters) {
|
|
3
|
+
const { length } = parameters;
|
|
4
|
+
return findValue(
|
|
5
|
+
"value",
|
|
6
|
+
array,
|
|
7
|
+
length === 1 && typeof parameters[0] === "function" ? parameters[0] : void 0,
|
|
8
|
+
length === 2 ? parameters[0] : void 0,
|
|
9
|
+
length === 1 && typeof parameters[0] !== "function" ? parameters[0] : parameters[1]
|
|
10
|
+
);
|
|
4
11
|
}
|
|
5
12
|
export {
|
|
6
13
|
find
|
|
@@ -1,30 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
function groupBy(array,
|
|
5
|
-
return groupValues(
|
|
3
|
+
const internal_array_callbacks = require("../internal/array/callbacks.cjs");
|
|
4
|
+
function groupBy(array, first, second, third) {
|
|
5
|
+
return groupValues(
|
|
6
|
+
array,
|
|
7
|
+
first,
|
|
8
|
+
second,
|
|
9
|
+
first === true || second === true || third === true
|
|
10
|
+
);
|
|
6
11
|
}
|
|
7
|
-
function groupValues(array, key,
|
|
8
|
-
var _a;
|
|
9
|
-
const callbacks =
|
|
10
|
-
const hasCallback = typeof (callbacks == null ? void 0 : callbacks.key) === "function";
|
|
11
|
-
if (!hasCallback && !indicable) {
|
|
12
|
-
return {};
|
|
13
|
-
}
|
|
12
|
+
function groupValues(array, key, value, arrays) {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
const callbacks = internal_array_callbacks.getCallbacks(void 0, key, value);
|
|
14
15
|
const record = {};
|
|
15
16
|
const { length } = array;
|
|
16
17
|
for (let index = 0; index < length; index += 1) {
|
|
17
|
-
const
|
|
18
|
-
const key2 =
|
|
18
|
+
const item = array[index];
|
|
19
|
+
const key2 = ((_a = callbacks == null ? void 0 : callbacks.key) == null ? void 0 : _a.call(callbacks, item, index, array)) ?? index;
|
|
20
|
+
const value2 = ((_b = callbacks == null ? void 0 : callbacks.value) == null ? void 0 : _b.call(callbacks, item, index, array)) ?? item;
|
|
19
21
|
if (arrays) {
|
|
20
22
|
const existing = record[key2];
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
+
if (existing == null) {
|
|
24
|
+
record[key2] = [value2];
|
|
23
25
|
} else {
|
|
24
|
-
|
|
26
|
+
existing.push(value2);
|
|
25
27
|
}
|
|
26
28
|
} else {
|
|
27
|
-
record[key2] =
|
|
29
|
+
record[key2] = value2;
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
32
|
return record;
|
|
@@ -1,28 +1,30 @@
|
|
|
1
|
-
import { getCallbacks } from "../internal/array
|
|
2
|
-
function groupBy(array,
|
|
3
|
-
return groupValues(
|
|
1
|
+
import { getCallbacks } from "../internal/array/callbacks.js";
|
|
2
|
+
function groupBy(array, first, second, third) {
|
|
3
|
+
return groupValues(
|
|
4
|
+
array,
|
|
5
|
+
first,
|
|
6
|
+
second,
|
|
7
|
+
first === true || second === true || third === true
|
|
8
|
+
);
|
|
4
9
|
}
|
|
5
|
-
function groupValues(array, key,
|
|
6
|
-
var _a;
|
|
7
|
-
const callbacks = getCallbacks(void 0, key);
|
|
8
|
-
const hasCallback = typeof (callbacks == null ? void 0 : callbacks.key) === "function";
|
|
9
|
-
if (!hasCallback && !indicable) {
|
|
10
|
-
return {};
|
|
11
|
-
}
|
|
10
|
+
function groupValues(array, key, value, arrays) {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
const callbacks = getCallbacks(void 0, key, value);
|
|
12
13
|
const record = {};
|
|
13
14
|
const { length } = array;
|
|
14
15
|
for (let index = 0; index < length; index += 1) {
|
|
15
|
-
const
|
|
16
|
-
const key2 =
|
|
16
|
+
const item = array[index];
|
|
17
|
+
const key2 = ((_a = callbacks == null ? void 0 : callbacks.key) == null ? void 0 : _a.call(callbacks, item, index, array)) ?? index;
|
|
18
|
+
const value2 = ((_b = callbacks == null ? void 0 : callbacks.value) == null ? void 0 : _b.call(callbacks, item, index, array)) ?? item;
|
|
17
19
|
if (arrays) {
|
|
18
20
|
const existing = record[key2];
|
|
19
|
-
if (
|
|
20
|
-
|
|
21
|
+
if (existing == null) {
|
|
22
|
+
record[key2] = [value2];
|
|
21
23
|
} else {
|
|
22
|
-
|
|
24
|
+
existing.push(value2);
|
|
23
25
|
}
|
|
24
26
|
} else {
|
|
25
|
-
record[key2] =
|
|
27
|
+
record[key2] = value2;
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
return record;
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
function indexOf(array,
|
|
5
|
-
|
|
3
|
+
const internal_array_find = require("../internal/array/find.cjs");
|
|
4
|
+
function indexOf(array, ...parameters) {
|
|
5
|
+
const { length } = parameters;
|
|
6
|
+
return internal_array_find.findValue(
|
|
7
|
+
"index",
|
|
8
|
+
array,
|
|
9
|
+
length === 1 && typeof parameters[0] === "function" ? parameters[0] : void 0,
|
|
10
|
+
length === 2 ? parameters[0] : void 0,
|
|
11
|
+
length === 1 && typeof parameters[0] !== "function" ? parameters[0] : parameters[1]
|
|
12
|
+
);
|
|
6
13
|
}
|
|
7
14
|
exports.indexOf = indexOf;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import { findValue } from "../internal/array
|
|
2
|
-
function indexOf(array,
|
|
3
|
-
|
|
1
|
+
import { findValue } from "../internal/array/find.js";
|
|
2
|
+
function indexOf(array, ...parameters) {
|
|
3
|
+
const { length } = parameters;
|
|
4
|
+
return findValue(
|
|
5
|
+
"index",
|
|
6
|
+
array,
|
|
7
|
+
length === 1 && typeof parameters[0] === "function" ? parameters[0] : void 0,
|
|
8
|
+
length === 2 ? parameters[0] : void 0,
|
|
9
|
+
length === 1 && typeof parameters[0] !== "function" ? parameters[0] : parameters[1]
|
|
10
|
+
);
|
|
4
11
|
}
|
|
5
12
|
export {
|
|
6
13
|
indexOf
|
package/dist/js/array/index.cjs
CHANGED
|
@@ -18,8 +18,8 @@ const array_unique = require("./unique.cjs");
|
|
|
18
18
|
function flatten(array) {
|
|
19
19
|
return array.flat(Number.POSITIVE_INFINITY);
|
|
20
20
|
}
|
|
21
|
-
function push(array,
|
|
22
|
-
return array_insert.insertValues("push", array,
|
|
21
|
+
function push(array, pushed) {
|
|
22
|
+
return array_insert.insertValues("push", array, pushed, array.length, 0);
|
|
23
23
|
}
|
|
24
24
|
exports.insert = array_insert.insert;
|
|
25
25
|
exports.chunk = array_chunk.chunk;
|
package/dist/js/array/index.js
CHANGED
|
@@ -17,8 +17,8 @@ import { unique } from "./unique.js";
|
|
|
17
17
|
function flatten(array) {
|
|
18
18
|
return array.flat(Number.POSITIVE_INFINITY);
|
|
19
19
|
}
|
|
20
|
-
function push(array,
|
|
21
|
-
return insertValues("push", array,
|
|
20
|
+
function push(array, pushed) {
|
|
21
|
+
return insertValues("push", array, pushed, array.length, 0);
|
|
22
22
|
}
|
|
23
23
|
export {
|
|
24
24
|
chunk,
|
package/dist/js/array/insert.cjs
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const array_chunk = require("./chunk.cjs");
|
|
4
|
-
function insert(array,
|
|
5
|
-
insertValues(
|
|
4
|
+
function insert(array, first, second) {
|
|
5
|
+
insertValues(
|
|
6
|
+
"splice",
|
|
7
|
+
array,
|
|
8
|
+
Array.isArray(first) ? first : second ?? [],
|
|
9
|
+
typeof first === "number" ? first : array.length,
|
|
10
|
+
0
|
|
11
|
+
);
|
|
6
12
|
}
|
|
7
|
-
function insertValues(type, array,
|
|
8
|
-
const chunked = array_chunk.chunk(
|
|
13
|
+
function insertValues(type, array, items, start, deleteCount) {
|
|
14
|
+
const chunked = array_chunk.chunk(items);
|
|
9
15
|
const lastIndex = chunked.length - 1;
|
|
10
16
|
let index = Number(chunked.length);
|
|
11
17
|
let returned;
|
package/dist/js/array/insert.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { chunk } from "./chunk.js";
|
|
2
|
-
function insert(array,
|
|
3
|
-
insertValues(
|
|
2
|
+
function insert(array, first, second) {
|
|
3
|
+
insertValues(
|
|
4
|
+
"splice",
|
|
5
|
+
array,
|
|
6
|
+
Array.isArray(first) ? first : second ?? [],
|
|
7
|
+
typeof first === "number" ? first : array.length,
|
|
8
|
+
0
|
|
9
|
+
);
|
|
4
10
|
}
|
|
5
|
-
function insertValues(type, array,
|
|
6
|
-
const chunked = chunk(
|
|
11
|
+
function insertValues(type, array, items, start, deleteCount) {
|
|
12
|
+
const chunked = chunk(items);
|
|
7
13
|
const lastIndex = chunked.length - 1;
|
|
8
14
|
let index = Number(chunked.length);
|
|
9
15
|
let returned;
|
package/dist/js/array/splice.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const array_insert = require("./insert.cjs");
|
|
4
|
-
function splice(array, start,
|
|
5
|
-
const
|
|
4
|
+
function splice(array, start, first, second) {
|
|
5
|
+
const isArray = Array.isArray(first);
|
|
6
6
|
return array_insert.insertValues(
|
|
7
7
|
"splice",
|
|
8
8
|
array,
|
|
9
|
-
|
|
9
|
+
isArray ? first : second ?? [],
|
|
10
10
|
start,
|
|
11
|
-
|
|
11
|
+
isArray ? array.length : typeof first === "number" && first > 0 ? first : 0
|
|
12
12
|
);
|
|
13
13
|
}
|
|
14
14
|
exports.splice = splice;
|
package/dist/js/array/splice.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { insertValues } from "./insert.js";
|
|
2
|
-
function splice(array, start,
|
|
3
|
-
const
|
|
2
|
+
function splice(array, start, first, second) {
|
|
3
|
+
const isArray = Array.isArray(first);
|
|
4
4
|
return insertValues(
|
|
5
5
|
"splice",
|
|
6
6
|
array,
|
|
7
|
-
|
|
7
|
+
isArray ? first : second ?? [],
|
|
8
8
|
start,
|
|
9
|
-
|
|
9
|
+
isArray ? array.length : typeof first === "number" && first > 0 ? first : 0
|
|
10
10
|
);
|
|
11
11
|
}
|
|
12
12
|
export {
|
package/dist/js/array/to-map.cjs
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
function toMap(array, first, second) {
|
|
5
|
-
var _a;
|
|
6
|
-
const asArrays = first === true || second === true;
|
|
7
|
-
const callbacks =
|
|
8
|
-
const hasCallback = typeof (callbacks == null ? void 0 : callbacks.key) === "function";
|
|
3
|
+
const internal_array_callbacks = require("../internal/array/callbacks.cjs");
|
|
4
|
+
function toMap(array, first, second, third) {
|
|
5
|
+
var _a, _b;
|
|
6
|
+
const asArrays = first === true || second === true || third === true;
|
|
7
|
+
const callbacks = internal_array_callbacks.getCallbacks(void 0, first, second);
|
|
9
8
|
const map = /* @__PURE__ */ new Map();
|
|
10
9
|
const { length } = array;
|
|
11
10
|
for (let index = 0; index < length; index += 1) {
|
|
12
|
-
const
|
|
13
|
-
const key =
|
|
11
|
+
const item = array[index];
|
|
12
|
+
const key = ((_a = callbacks == null ? void 0 : callbacks.key) == null ? void 0 : _a.call(callbacks, item, index, array)) ?? index;
|
|
13
|
+
const value = ((_b = callbacks == null ? void 0 : callbacks.value) == null ? void 0 : _b.call(callbacks, item, index, array)) ?? item;
|
|
14
14
|
if (asArrays) {
|
|
15
15
|
const existing = map.get(key);
|
|
16
|
-
if (
|
|
17
|
-
existing.push(value);
|
|
18
|
-
} else {
|
|
16
|
+
if (existing == null) {
|
|
19
17
|
map.set(key, [value]);
|
|
18
|
+
} else {
|
|
19
|
+
existing.push(value);
|
|
20
20
|
}
|
|
21
21
|
} else {
|
|
22
22
|
map.set(key, value);
|
package/dist/js/array/to-map.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { getCallbacks } from "../internal/array
|
|
2
|
-
function toMap(array, first, second) {
|
|
3
|
-
var _a;
|
|
4
|
-
const asArrays = first === true || second === true;
|
|
5
|
-
const callbacks = getCallbacks(void 0, first);
|
|
6
|
-
const hasCallback = typeof (callbacks == null ? void 0 : callbacks.key) === "function";
|
|
1
|
+
import { getCallbacks } from "../internal/array/callbacks.js";
|
|
2
|
+
function toMap(array, first, second, third) {
|
|
3
|
+
var _a, _b;
|
|
4
|
+
const asArrays = first === true || second === true || third === true;
|
|
5
|
+
const callbacks = getCallbacks(void 0, first, second);
|
|
7
6
|
const map = /* @__PURE__ */ new Map();
|
|
8
7
|
const { length } = array;
|
|
9
8
|
for (let index = 0; index < length; index += 1) {
|
|
10
|
-
const
|
|
11
|
-
const key =
|
|
9
|
+
const item = array[index];
|
|
10
|
+
const key = ((_a = callbacks == null ? void 0 : callbacks.key) == null ? void 0 : _a.call(callbacks, item, index, array)) ?? index;
|
|
11
|
+
const value = ((_b = callbacks == null ? void 0 : callbacks.value) == null ? void 0 : _b.call(callbacks, item, index, array)) ?? item;
|
|
12
12
|
if (asArrays) {
|
|
13
13
|
const existing = map.get(key);
|
|
14
|
-
if (
|
|
15
|
-
existing.push(value);
|
|
16
|
-
} else {
|
|
14
|
+
if (existing == null) {
|
|
17
15
|
map.set(key, [value]);
|
|
16
|
+
} else {
|
|
17
|
+
existing.push(value);
|
|
18
18
|
}
|
|
19
19
|
} else {
|
|
20
20
|
map.set(key, value);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const array_groupBy = require("./group-by.cjs");
|
|
4
|
-
function toRecord(array, first, second) {
|
|
4
|
+
function toRecord(array, first, second, third) {
|
|
5
5
|
return array_groupBy.groupValues(
|
|
6
6
|
array,
|
|
7
7
|
first,
|
|
8
|
-
|
|
9
|
-
true
|
|
8
|
+
second,
|
|
9
|
+
first === true || second === true || third === true
|
|
10
10
|
);
|
|
11
11
|
}
|
|
12
12
|
exports.toRecord = toRecord;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { groupValues } from "./group-by.js";
|
|
2
|
-
function toRecord(array, first, second) {
|
|
2
|
+
function toRecord(array, first, second, third) {
|
|
3
3
|
return groupValues(
|
|
4
4
|
array,
|
|
5
5
|
first,
|
|
6
|
-
|
|
7
|
-
true
|
|
6
|
+
second,
|
|
7
|
+
first === true || second === true || third === true
|
|
8
8
|
);
|
|
9
9
|
}
|
|
10
10
|
export {
|
package/dist/js/array/unique.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
3
|
+
const internal_array_find = require("../internal/array/find.cjs");
|
|
4
4
|
function unique(array, key) {
|
|
5
|
-
return
|
|
5
|
+
return internal_array_find.findValues("unique", array, void 0, key, void 0);
|
|
6
6
|
}
|
|
7
7
|
exports.unique = unique;
|
package/dist/js/array/unique.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { findValues } from "../internal/array
|
|
1
|
+
import { findValues } from "../internal/array/find.js";
|
|
2
2
|
function unique(array, key) {
|
|
3
|
-
return findValues("unique", array, void 0, key);
|
|
3
|
+
return findValues("unique", array, void 0, key, void 0);
|
|
4
4
|
}
|
|
5
5
|
export {
|
|
6
6
|
unique
|
package/dist/js/colour/base.cjs
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const colour_is = require("./is.cjs");
|
|
4
4
|
class Colour {
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Get the current value of the colour
|
|
7
7
|
*/
|
|
8
8
|
get value() {
|
|
9
9
|
return { ...this.state.value };
|
package/dist/js/colour/base.js
CHANGED
package/dist/js/colour/hex.cjs
CHANGED
|
@@ -13,13 +13,13 @@ class HexColour {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Get the value of the colour
|
|
17
17
|
*/
|
|
18
18
|
get value() {
|
|
19
19
|
return `#${this.state.value}`;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Set the value of the colour
|
|
23
23
|
*/
|
|
24
24
|
set value(value) {
|
|
25
25
|
this.state.value = colour_functions.anyPattern.test(value) ? colour_functions.getNormalisedHex(value) : "000000";
|
package/dist/js/colour/hex.js
CHANGED
|
@@ -11,13 +11,13 @@ class HexColour {
|
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Get the value of the colour
|
|
15
15
|
*/
|
|
16
16
|
get value() {
|
|
17
17
|
return `#${this.state.value}`;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Set the value of the colour
|
|
21
21
|
*/
|
|
22
22
|
set value(value) {
|
|
23
23
|
this.state.value = anyPattern.test(value) ? getNormalisedHex(value) : "000000";
|