@oscarpalmer/atoms 0.75.0 → 0.77.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 +3 -3
- package/dist/js/array/count.js +3 -3
- package/dist/js/array/exists.cjs +3 -3
- package/dist/js/array/exists.js +3 -3
- package/dist/js/array/filter.cjs +3 -3
- package/dist/js/array/filter.js +3 -3
- package/dist/js/array/find.cjs +3 -3
- package/dist/js/array/find.js +3 -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 +3 -3
- package/dist/js/array/index-of.js +3 -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} +21 -12
- package/dist/js/internal/array/find.js +61 -0
- 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 +13 -5
- package/src/js/array/chunk.ts +6 -5
- package/src/js/array/compact.ts +8 -10
- package/src/js/array/count.ts +26 -19
- package/src/js/array/exists.ts +25 -16
- package/src/js/array/filter.ts +29 -20
- package/src/js/array/find.ts +32 -20
- package/src/js/array/group-by.ts +158 -29
- package/src/js/array/index-of.ts +27 -18
- package/src/js/array/index.ts +10 -9
- package/src/js/array/insert.ts +28 -14
- package/src/js/array/models.ts +9 -20
- package/src/js/array/shuffle.ts +3 -3
- package/src/js/array/sort.ts +28 -38
- package/src/js/array/splice.ts +22 -26
- package/src/js/array/to-map.ts +134 -48
- package/src/js/array/to-record.ts +135 -39
- package/src/js/array/unique.ts +21 -16
- 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 +103 -0
- 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 +12 -8
- package/types/array/count.d.ts +13 -7
- package/types/array/exists.d.cts +11 -5
- package/types/array/exists.d.ts +12 -4
- package/types/array/filter.d.cts +13 -7
- package/types/array/filter.d.ts +14 -6
- package/types/array/find.d.cts +13 -7
- package/types/array/find.d.ts +14 -6
- package/types/array/group-by.d.cts +48 -5
- package/types/array/group-by.d.ts +48 -5
- package/types/array/index-of.d.cts +13 -7
- package/types/array/index-of.d.ts +14 -6
- package/types/array/index.d.cts +237 -98
- 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 +9 -11
- package/types/array/models.d.ts +9 -12
- package/types/array/shuffle.d.cts +2 -2
- package/types/array/shuffle.d.ts +2 -2
- package/types/array/sort.d.cts +10 -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 +41 -20
- package/types/array/to-map.d.ts +41 -20
- package/types/array/to-record.d.cts +41 -20
- package/types/array/to-record.d.ts +41 -20
- package/types/array/unique.d.cts +10 -7
- package/types/array/unique.d.ts +11 -7
- 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 +850 -1156
- 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 +210 -467
- 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.cts +210 -469
- package/types/value/get.d.ts +1 -1
- package/types/value/index.d.cts +231 -520
- 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.cts +169 -356
- package/types/value/set.d.ts +1 -1
- package/types/value/smush.d.cts +210 -464
- 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/dist/js/internal/array-find.js +0 -52
- package/src/js/internal/array-callbacks.ts +0 -28
- package/src/js/internal/array-find.ts +0 -81
- 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,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
function count(array,
|
|
5
|
-
return
|
|
3
|
+
const internal_array_find = require("../internal/array/find.cjs");
|
|
4
|
+
function count(array, ...parameters) {
|
|
5
|
+
return internal_array_find.findValues("all", array, parameters).length;
|
|
6
6
|
}
|
|
7
7
|
exports.count = count;
|
package/dist/js/array/count.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { findValues } from "../internal/array
|
|
2
|
-
function count(array,
|
|
3
|
-
return findValues("all", array,
|
|
1
|
+
import { findValues } from "../internal/array/find.js";
|
|
2
|
+
function count(array, ...parameters) {
|
|
3
|
+
return findValues("all", array, parameters).length;
|
|
4
4
|
}
|
|
5
5
|
export {
|
|
6
6
|
count
|
package/dist/js/array/exists.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
function exists(array,
|
|
5
|
-
return
|
|
3
|
+
const internal_array_find = require("../internal/array/find.cjs");
|
|
4
|
+
function exists(array, ...parameters) {
|
|
5
|
+
return internal_array_find.findValue("index", array, parameters) > -1;
|
|
6
6
|
}
|
|
7
7
|
exports.exists = exists;
|
package/dist/js/array/exists.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { findValue } from "../internal/array
|
|
2
|
-
function exists(array,
|
|
3
|
-
return findValue("index", array,
|
|
1
|
+
import { findValue } from "../internal/array/find.js";
|
|
2
|
+
function exists(array, ...parameters) {
|
|
3
|
+
return findValue("index", array, parameters) > -1;
|
|
4
4
|
}
|
|
5
5
|
export {
|
|
6
6
|
exists
|
package/dist/js/array/filter.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
function filter(array,
|
|
5
|
-
return
|
|
3
|
+
const internal_array_find = require("../internal/array/find.cjs");
|
|
4
|
+
function filter(array, ...parameters) {
|
|
5
|
+
return internal_array_find.findValues("all", array, parameters);
|
|
6
6
|
}
|
|
7
7
|
exports.filter = filter;
|
package/dist/js/array/filter.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { findValues } from "../internal/array
|
|
2
|
-
function filter(array,
|
|
3
|
-
return findValues("all", array,
|
|
1
|
+
import { findValues } from "../internal/array/find.js";
|
|
2
|
+
function filter(array, ...parameters) {
|
|
3
|
+
return findValues("all", array, parameters);
|
|
4
4
|
}
|
|
5
5
|
export {
|
|
6
6
|
filter
|
package/dist/js/array/find.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
function find(array,
|
|
5
|
-
return
|
|
3
|
+
const internal_array_find = require("../internal/array/find.cjs");
|
|
4
|
+
function find(array, ...parameters) {
|
|
5
|
+
return internal_array_find.findValue("value", array, parameters);
|
|
6
6
|
}
|
|
7
7
|
exports.find = find;
|
package/dist/js/array/find.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { findValue } from "../internal/array
|
|
2
|
-
function find(array,
|
|
3
|
-
return findValue("value", array,
|
|
1
|
+
import { findValue } from "../internal/array/find.js";
|
|
2
|
+
function find(array, ...parameters) {
|
|
3
|
+
return findValue("value", array, parameters);
|
|
4
4
|
}
|
|
5
5
|
export {
|
|
6
6
|
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,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
function indexOf(array,
|
|
5
|
-
return
|
|
3
|
+
const internal_array_find = require("../internal/array/find.cjs");
|
|
4
|
+
function indexOf(array, ...parameters) {
|
|
5
|
+
return internal_array_find.findValue("index", array, parameters);
|
|
6
6
|
}
|
|
7
7
|
exports.indexOf = indexOf;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { findValue } from "../internal/array
|
|
2
|
-
function indexOf(array,
|
|
3
|
-
return findValue("index", array,
|
|
1
|
+
import { findValue } from "../internal/array/find.js";
|
|
2
|
+
function indexOf(array, ...parameters) {
|
|
3
|
+
return findValue("index", array, parameters);
|
|
4
4
|
}
|
|
5
5
|
export {
|
|
6
6
|
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, [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
|
|
3
|
+
return findValues("unique", array, [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";
|
package/dist/js/colour/hsl.cjs
CHANGED
|
@@ -5,37 +5,37 @@ const colour_functions = require("./functions.cjs");
|
|
|
5
5
|
const number = require("../number.cjs");
|
|
6
6
|
class HSLColour extends colour_base.Colour {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Get the current hue
|
|
9
9
|
*/
|
|
10
10
|
get hue() {
|
|
11
11
|
return +this.state.value.hue;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Set the current hue
|
|
15
15
|
*/
|
|
16
16
|
set hue(value) {
|
|
17
17
|
this.state.value.hue = number.clamp(value, 0, 360);
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* Get the current lightness
|
|
21
21
|
*/
|
|
22
22
|
get lightness() {
|
|
23
23
|
return +this.state.value.lightness;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* Set the current lightness
|
|
27
27
|
*/
|
|
28
28
|
set lightness(value) {
|
|
29
29
|
this.state.value.lightness = number.clamp(value, 0, 100);
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* Get the current saturation
|
|
33
33
|
*/
|
|
34
34
|
get saturation() {
|
|
35
35
|
return +this.state.value.saturation;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* Set the current saturation
|
|
39
39
|
*/
|
|
40
40
|
set saturation(value) {
|
|
41
41
|
this.state.value.saturation = number.clamp(value, 0, 100);
|
|
@@ -43,15 +43,21 @@ class HSLColour extends colour_base.Colour {
|
|
|
43
43
|
constructor(value) {
|
|
44
44
|
super("hsl", value, defaults, properties);
|
|
45
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* @inheritdoc
|
|
48
|
+
*/
|
|
46
49
|
toHex() {
|
|
47
50
|
return HSLColour.toRgb(this.state.value).toHex();
|
|
48
51
|
}
|
|
49
52
|
/**
|
|
50
|
-
*
|
|
53
|
+
* Convert the colour to an RGB-colour
|
|
51
54
|
*/
|
|
52
55
|
toRgb() {
|
|
53
56
|
return HSLColour.toRgb(this.state.value);
|
|
54
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* @inheritdoc
|
|
60
|
+
*/
|
|
55
61
|
toString() {
|
|
56
62
|
return `hsl(${this.state.value.hue}, ${this.state.value.saturation}%, ${this.state.value.lightness}%)`;
|
|
57
63
|
}
|
package/dist/js/colour/hsl.js
CHANGED
|
@@ -3,37 +3,37 @@ import { hslToRgb } from "./functions.js";
|
|
|
3
3
|
import { clamp } from "../number.js";
|
|
4
4
|
class HSLColour extends Colour {
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Get the current hue
|
|
7
7
|
*/
|
|
8
8
|
get hue() {
|
|
9
9
|
return +this.state.value.hue;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Set the current hue
|
|
13
13
|
*/
|
|
14
14
|
set hue(value) {
|
|
15
15
|
this.state.value.hue = clamp(value, 0, 360);
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Get the current lightness
|
|
19
19
|
*/
|
|
20
20
|
get lightness() {
|
|
21
21
|
return +this.state.value.lightness;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Set the current lightness
|
|
25
25
|
*/
|
|
26
26
|
set lightness(value) {
|
|
27
27
|
this.state.value.lightness = clamp(value, 0, 100);
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* Get the current saturation
|
|
31
31
|
*/
|
|
32
32
|
get saturation() {
|
|
33
33
|
return +this.state.value.saturation;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* Set the current saturation
|
|
37
37
|
*/
|
|
38
38
|
set saturation(value) {
|
|
39
39
|
this.state.value.saturation = clamp(value, 0, 100);
|
|
@@ -41,15 +41,21 @@ class HSLColour extends Colour {
|
|
|
41
41
|
constructor(value) {
|
|
42
42
|
super("hsl", value, defaults, properties);
|
|
43
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* @inheritdoc
|
|
46
|
+
*/
|
|
44
47
|
toHex() {
|
|
45
48
|
return HSLColour.toRgb(this.state.value).toHex();
|
|
46
49
|
}
|
|
47
50
|
/**
|
|
48
|
-
*
|
|
51
|
+
* Convert the colour to an RGB-colour
|
|
49
52
|
*/
|
|
50
53
|
toRgb() {
|
|
51
54
|
return HSLColour.toRgb(this.state.value);
|
|
52
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* @inheritdoc
|
|
58
|
+
*/
|
|
53
59
|
toString() {
|
|
54
60
|
return `hsl(${this.state.value.hue}, ${this.state.value.saturation}%, ${this.state.value.lightness}%)`;
|
|
55
61
|
}
|