@oscarpalmer/atoms 0.213.0 → 0.214.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/difference.d.mts +1 -1
- package/dist/array/difference.mjs +3 -2
- package/dist/array/exists.d.mts +1 -1
- package/dist/array/exists.mjs +3 -2
- package/dist/array/filter.d.mts +1 -1
- package/dist/array/filter.mjs +1 -0
- package/dist/array/find.d.mts +1 -1
- package/dist/array/find.mjs +4 -3
- package/dist/array/first.d.mts +1 -1
- package/dist/array/flatten.d.mts +1 -1
- package/dist/array/group-by.d.mts +1 -1
- package/dist/array/index.d.mts +2 -2
- package/dist/array/insert.mjs +3 -2
- package/dist/array/intersection.mjs +3 -2
- package/dist/array/last.d.mts +1 -1
- package/dist/array/move.d.mts +1 -1
- package/dist/array/partition.d.mts +1 -1
- package/dist/array/partition.mjs +1 -0
- package/dist/array/push.mjs +3 -2
- package/dist/array/select.d.mts +10 -12
- package/dist/array/select.mjs +1 -0
- package/dist/array/single.d.mts +1 -1
- package/dist/array/single.mjs +1 -0
- package/dist/array/slice.d.mts +1 -1
- package/dist/array/slice.mjs +4 -5
- package/dist/array/sort.d.mts +4 -103
- package/dist/array/sort.mjs +6 -14
- package/dist/array/splice.mjs +3 -2
- package/dist/array/swap.d.mts +1 -1
- package/dist/array/to-map.d.mts +1 -1
- package/dist/array/to-record.d.mts +1 -1
- package/dist/array/to-set.d.mts +1 -1
- package/dist/array/toggle.d.mts +1 -1
- package/dist/array/union.mjs +3 -2
- package/dist/array/unique.d.mts +1 -1
- package/dist/array/unique.mjs +3 -2
- package/dist/array/update.d.mts +1 -1
- package/dist/beacon.d.mts +6 -92
- package/dist/beacon.mjs +6 -16
- package/dist/color/constants.d.mts +2 -2
- package/dist/color/constants.mjs +1 -1
- package/dist/color/index.d.mts +1 -1
- package/dist/color/instance.d.mts +1 -1
- package/dist/color/misc/alpha.d.mts +1 -1
- package/dist/color/misc/format.d.mts +1 -1
- package/dist/color/misc/get.d.mts +1 -1
- package/dist/color/misc/is.d.mts +2 -2
- package/dist/color/misc/is.mjs +1 -0
- package/dist/color/misc/state.d.mts +1 -1
- package/dist/color/space/hex.d.mts +1 -1
- package/dist/color/space/hsl.d.mts +1 -1
- package/dist/color/space/hwb.d.mts +1 -1
- package/dist/color/space/rgb.d.mts +1 -1
- package/dist/function/limit.d.mts +2 -2
- package/dist/function/limit.mjs +2 -1
- package/dist/function/once.d.mts +7 -3
- package/dist/function/once.mjs +5 -10
- package/dist/function/retry.d.mts +4 -14
- package/dist/function/retry.mjs +3 -15
- package/dist/herald.d.mts +2 -2
- package/dist/index.d.mts +425 -318
- package/dist/index.mjs +454 -408
- package/dist/internal/aborter.d.mts +1 -6
- package/dist/internal/aborter.mjs +3 -4
- package/dist/internal/array/callbacks.d.mts +3 -7
- package/dist/internal/array/chunk.mjs +2 -2
- package/dist/internal/array/find.d.mts +5 -23
- package/dist/internal/array/find.mjs +5 -9
- package/dist/internal/array/get.d.mts +1 -1
- package/dist/internal/array/group.d.mts +1 -1
- package/dist/internal/array/index-of.d.mts +1 -1
- package/dist/internal/array/index-of.mjs +4 -3
- package/dist/internal/array/insert.d.mts +2 -5
- package/dist/internal/array/insert.mjs +2 -4
- package/dist/internal/array/match.d.mts +2 -5
- package/dist/internal/array/match.mjs +10 -20
- package/dist/internal/array/overlap.d.mts +2 -10
- package/dist/internal/array/sets.d.mts +2 -5
- package/dist/internal/array/sets.mjs +5 -7
- package/dist/internal/function/assert.d.mts +5 -12
- package/dist/internal/function/assert.mjs +2 -2
- package/dist/internal/function/limit.d.mts +2 -37
- package/dist/internal/function/limit.mjs +4 -15
- package/dist/internal/function/memoize.d.mts +5 -70
- package/dist/internal/function/memoize.mjs +2 -5
- package/dist/internal/function/work.d.mts +16 -22
- package/dist/internal/function/work.mjs +1 -8
- package/dist/internal/herald.d.mts +3 -3
- package/dist/internal/herald.mjs +2 -1
- package/dist/internal/is.d.mts +1 -1
- package/dist/internal/math/aggregate.d.mts +2 -14
- package/dist/internal/math/aggregate.mjs +2 -5
- package/dist/internal/number.mjs +4 -7
- package/dist/internal/result/attempt.d.mts +1 -1
- package/dist/internal/result/misc.d.mts +1 -1
- package/dist/internal/string/case.mjs +6 -16
- package/dist/internal/string/misc.mjs +1 -2
- package/dist/internal/subscription.d.mts +1 -100
- package/dist/internal/subscription.mjs +3 -9
- package/dist/internal/value/compare.d.mts +4 -4
- package/dist/internal/value/compare.mjs +1 -1
- package/dist/internal/value/equal.d.mts +6 -57
- package/dist/internal/value/equal.mjs +5 -10
- package/dist/internal/value/get.d.mts +1 -1
- package/dist/internal/value/handlers.d.mts +2 -21
- package/dist/internal/value/has.d.mts +2 -2
- package/dist/internal/value/misc.d.mts +1 -1
- package/dist/internal/value/misc.mjs +8 -14
- package/dist/internal/value/set.d.mts +1 -1
- package/dist/internal/value/set.mjs +2 -2
- package/dist/is.mjs +3 -3
- package/dist/logger.d.mts +3 -70
- package/dist/logger.mjs +2 -5
- package/dist/math.d.mts +1 -1
- package/dist/math.mjs +2 -1
- package/dist/models/aborter.model.d.mts +12 -0
- package/dist/models/aborter.model.mjs +5 -0
- package/dist/models/array/array.find.model.d.mts +22 -0
- package/dist/models/array/array.find.model.mjs +8 -0
- package/dist/models/array/array.match.model.d.mts +14 -0
- package/dist/models/array/array.match.model.mjs +14 -0
- package/dist/models/array/array.misc.model.d.mts +36 -0
- package/dist/models/array/array.misc.model.mjs +12 -0
- package/dist/models/array/array.sort.model.d.mts +122 -0
- package/dist/models/array/array.sort.model.mjs +12 -0
- package/dist/models/beacon.model.d.mts +119 -0
- package/dist/models/beacon.model.mjs +16 -0
- package/dist/{color/models.d.mts → models/color.model.d.mts} +4 -4
- package/dist/models/function/assert.model.d.mts +13 -0
- package/dist/models/function/assert.model.mjs +4 -0
- package/dist/models/function/limiter.model.d.mts +71 -0
- package/dist/models/function/limiter.model.mjs +15 -0
- package/dist/models/function/memoize.model.d.mts +88 -0
- package/dist/models/function/memoize.model.mjs +7 -0
- package/dist/models/function/once.model.d.mts +76 -0
- package/dist/models/function/once.model.mjs +9 -0
- package/dist/models/function/retry.model.d.mts +17 -0
- package/dist/models/function/retry.model.mjs +17 -0
- package/dist/models/function/work.model.d.mts +20 -0
- package/dist/models/function/work.model.mjs +11 -0
- package/dist/{internal/models → models}/herald.model.d.mts +3 -3
- package/dist/{internal/models → models}/herald.model.mjs +2 -2
- package/dist/{models.d.mts → models/index.d.mts} +5 -47
- package/dist/models/logger.model.d.mts +83 -0
- package/dist/models/logger.model.mjs +7 -0
- package/dist/models/math.model.d.mts +16 -0
- package/dist/models/math.model.mjs +7 -0
- package/dist/models/misc.model.d.mts +10 -0
- package/dist/models/misc.model.mjs +11 -0
- package/dist/{internal/models → models}/plan.model.d.mts +3 -3
- package/dist/{internal/models → models}/plan.model.mjs +1 -1
- package/dist/models/promise.model.d.mts +119 -0
- package/dist/models/promise.model.mjs +47 -0
- package/dist/models/query.model.d.mts +9 -0
- package/dist/models/query.model.mjs +14 -0
- package/dist/models/queue.model.d.mts +251 -0
- package/dist/models/queue.model.mjs +29 -0
- package/dist/models/random.model.d.mts +6 -0
- package/dist/models/random.model.mjs +7 -0
- package/dist/{internal/models → models}/result.model.d.mts +10 -2
- package/dist/models/string/string.case.model.d.mts +19 -0
- package/dist/models/string/string.case.model.mjs +14 -0
- package/dist/models/string/string.fuzzy.model.d.mts +108 -0
- package/dist/models/string/string.fuzzy.model.mjs +9 -0
- package/dist/models/string/string.misc.model.d.mts +13 -0
- package/dist/models/string/string.misc.model.mjs +13 -0
- package/dist/models/string/string.normalize.model.d.mts +85 -0
- package/dist/models/string/string.normalize.model.mjs +43 -0
- package/dist/models/string/string.template.model.d.mts +50 -0
- package/dist/models/string/string.template.model.mjs +5 -0
- package/dist/models/subscription.model.d.mts +127 -0
- package/dist/models/subscription.model.mjs +10 -0
- package/dist/models/value/value.clone.model.d.mts +56 -0
- package/dist/models/value/value.clone.model.mjs +24 -0
- package/dist/models/value/value.diff.model.d.mts +61 -0
- package/dist/models/value/value.diff.model.mjs +6 -0
- package/dist/models/value/value.equal.model.d.mts +76 -0
- package/dist/models/value/value.equal.model.mjs +9 -0
- package/dist/models/value/value.handler.model.d.mts +27 -0
- package/dist/models/value/value.handler.model.mjs +1 -0
- package/dist/models/value/value.merge.model.d.mts +82 -0
- package/dist/models/value/value.merge.model.mjs +5 -0
- package/dist/models/value/value.misc.model.d.mts +33 -0
- package/dist/models/value/value.misc.model.mjs +12 -0
- package/dist/models/value/value.transform.model.d.mts +28 -0
- package/dist/models/value/value.transform.model.mjs +4 -0
- package/dist/plan/generate.d.mts +3 -2
- package/dist/plan/generate.mjs +11 -7
- package/dist/plan/index.d.mts +1 -1
- package/dist/plan/index.mjs +1 -1
- package/dist/plan/is.d.mts +1 -1
- package/dist/plan/is.mjs +1 -1
- package/dist/plan/misc.d.mts +1 -1
- package/dist/plan/models.d.mts +1 -1
- package/dist/plan/result.d.mts +2 -2
- package/dist/plan/result.mjs +3 -3
- package/dist/plan/run.d.mts +1 -1
- package/dist/plan/run.mjs +3 -3
- package/dist/promise/delay.d.mts +1 -1
- package/dist/promise/delay.mjs +2 -1
- package/dist/promise/helpers.d.mts +2 -2
- package/dist/promise/helpers.mjs +6 -6
- package/dist/promise/index.d.mts +2 -2
- package/dist/promise/index.mjs +1 -1
- package/dist/promise/misc.d.mts +3 -3
- package/dist/promise/misc.mjs +7 -4
- package/dist/promise/models.d.mts +2 -106
- package/dist/promise/models.mjs +1 -35
- package/dist/promise/timed.d.mts +2 -2
- package/dist/promise/timed.mjs +3 -3
- package/dist/query.d.mts +1 -1
- package/dist/query.mjs +5 -15
- package/dist/queue.d.mts +6 -200
- package/dist/queue.mjs +9 -34
- package/dist/random.mjs +2 -5
- package/dist/result/match.d.mts +1 -1
- package/dist/result/match.mjs +27 -15
- package/dist/result/misc.d.mts +1 -1
- package/dist/result/work/flow.d.mts +13 -21
- package/dist/result/work/pipe.d.mts +2 -2
- package/dist/string/fuzzy.d.mts +5 -87
- package/dist/string/fuzzy.mjs +6 -11
- package/dist/string/index.mjs +6 -8
- package/dist/string/match.mjs +4 -6
- package/dist/string/normalize.d.mts +4 -40
- package/dist/string/normalize.mjs +9 -48
- package/dist/string/template.d.mts +5 -43
- package/dist/string/template.mjs +1 -2
- package/dist/subscription.d.mts +2 -1
- package/dist/value/clone.d.mts +6 -42
- package/dist/value/clone.mjs +10 -30
- package/dist/value/collection.mjs +2 -0
- package/dist/value/diff.d.mts +3 -44
- package/dist/value/diff.mjs +1 -3
- package/dist/value/freeze.d.mts +1 -5
- package/dist/value/index.d.mts +4 -3
- package/dist/value/merge.d.mts +6 -64
- package/dist/value/merge.mjs +8 -8
- package/dist/value/omit.d.mts +1 -1
- package/dist/value/pick.d.mts +1 -1
- package/dist/value/shake.d.mts +4 -6
- package/dist/value/smush.d.mts +4 -6
- package/dist/value/smush.mjs +2 -2
- package/dist/value/transform.d.mts +6 -22
- package/dist/value/transform.mjs +1 -1
- package/dist/value/unsmush.d.mts +4 -10
- package/package.json +12 -4
- package/dist/promise/constants.d.mts +0 -17
- package/dist/promise/constants.mjs +0 -15
- /package/dist/{color/models.mjs → models/color.model.mjs} +0 -0
- /package/dist/{internal/models/result.model.mjs → models/index.mjs} +0 -0
- /package/dist/{models.mjs → models/result.model.mjs} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
//#region src/models/array/array.find.model.ts
|
|
2
|
+
const ARRAY_FIND_VALUE_INDEX = "index";
|
|
3
|
+
const ARRAY_FIND_VALUE_ITEM = "item";
|
|
4
|
+
const ARRAY_FIND_VALUES_UNIQUE = "unique";
|
|
5
|
+
//#endregion
|
|
1
6
|
//#region src/internal/array/callbacks.ts
|
|
2
7
|
function getArrayCallback(value) {
|
|
3
8
|
switch (typeof value) {
|
|
@@ -25,7 +30,7 @@ function createFindParameters(original) {
|
|
|
25
30
|
};
|
|
26
31
|
}
|
|
27
32
|
function findValue(type, array, parameters, reversed) {
|
|
28
|
-
const findIndex = type ===
|
|
33
|
+
const findIndex = type === ARRAY_FIND_VALUE_INDEX;
|
|
29
34
|
if (!Array.isArray(array) || array.length === 0) return findIndex ? -1 : void 0;
|
|
30
35
|
const { bool, key, value } = createFindParameters(parameters);
|
|
31
36
|
const callbacks = getArrayCallbacks(bool, key);
|
|
@@ -52,7 +57,7 @@ function findAbsoluteValueOrDefault(array, parameters, defaultValue, useDefaultV
|
|
|
52
57
|
if (Array.isArray(array) && array.length > 0) return reversed ? array.at(-1) : array[0];
|
|
53
58
|
return useDefaultValue ? defaultValue : void 0;
|
|
54
59
|
}
|
|
55
|
-
const index = findValue(
|
|
60
|
+
const index = findValue(ARRAY_FIND_VALUE_INDEX, array, parameters, reversed);
|
|
56
61
|
return index > -1 ? array[index] : useDefaultValue ? defaultValue : void 0;
|
|
57
62
|
}
|
|
58
63
|
function findValues(type, array, parameters, mapper) {
|
|
@@ -64,7 +69,7 @@ function findValues(type, array, parameters, mapper) {
|
|
|
64
69
|
const { length } = array;
|
|
65
70
|
const { bool, key, value } = createFindParameters(parameters);
|
|
66
71
|
const callbacks = getArrayCallbacks(bool, key);
|
|
67
|
-
if (type === "unique" && callbacks?.keyed == null && length >=
|
|
72
|
+
if (type === "unique" && callbacks?.keyed == null && length >= 100) {
|
|
68
73
|
result.matched = [...new Set(array)];
|
|
69
74
|
return result;
|
|
70
75
|
}
|
|
@@ -101,10 +106,6 @@ function findValues(type, array, parameters, mapper) {
|
|
|
101
106
|
}
|
|
102
107
|
return result;
|
|
103
108
|
}
|
|
104
|
-
const FIND_VALUE_INDEX = "index";
|
|
105
|
-
const FIND_VALUE_ITEM = "item";
|
|
106
|
-
const FIND_VALUES_UNIQUE = "unique";
|
|
107
|
-
const FIND_UNIQUE_THRESHOLD = 100;
|
|
108
109
|
//#endregion
|
|
109
110
|
//#region src/array/filter.ts
|
|
110
111
|
function exclude(array, ...parameters) {
|
|
@@ -117,10 +118,10 @@ filter.remove = exclude;
|
|
|
117
118
|
//#endregion
|
|
118
119
|
//#region src/array/find.ts
|
|
119
120
|
function find(array, ...parameters) {
|
|
120
|
-
return findValue(
|
|
121
|
+
return findValue(ARRAY_FIND_VALUE_ITEM, array, parameters, false);
|
|
121
122
|
}
|
|
122
123
|
function findLast(array, ...parameters) {
|
|
123
|
-
return findValue(
|
|
124
|
+
return findValue(ARRAY_FIND_VALUE_ITEM, array, parameters, true);
|
|
124
125
|
}
|
|
125
126
|
find.last = findLast;
|
|
126
127
|
//#endregion
|
|
@@ -161,6 +162,17 @@ function groupArraysBy(array, first, second) {
|
|
|
161
162
|
}
|
|
162
163
|
groupBy.arrays = groupArraysBy;
|
|
163
164
|
//#endregion
|
|
165
|
+
//#region src/models/array/array.misc.model.ts
|
|
166
|
+
const ARRAY_CHUNK_MAX_SIZE = 5e3;
|
|
167
|
+
const ARRAY_INSERT_TYPE_INSERT = "insert";
|
|
168
|
+
const ARRAY_INSERT_TYPE_PUSH = "push";
|
|
169
|
+
const ARRAY_INSERT_TYPE_SPLICE = "splice";
|
|
170
|
+
const ARRAY_SETS_COMPARE_DIFFERENCE = "difference";
|
|
171
|
+
const ARRAY_SETS_COMPARE_INTERSECTION = "intersection";
|
|
172
|
+
const ARRAY_SETS_COMPARE_UNION = "union";
|
|
173
|
+
const ARRAY_SLICE_DROP = "drop";
|
|
174
|
+
const ARRAY_SLICE_TAKE = "take";
|
|
175
|
+
//#endregion
|
|
164
176
|
//#region src/internal/array/chunk.ts
|
|
165
177
|
/**
|
|
166
178
|
* Chunk an array into smaller arrays
|
|
@@ -178,7 +190,7 @@ function chunk(array, size) {
|
|
|
178
190
|
if (!Array.isArray(array)) return [];
|
|
179
191
|
if (array.length === 0) return [];
|
|
180
192
|
const { length } = array;
|
|
181
|
-
const actualSize = typeof size === "number" && size > 0 && size <=
|
|
193
|
+
const actualSize = typeof size === "number" && size > 0 && size <= 5e3 ? size : ARRAY_CHUNK_MAX_SIZE;
|
|
182
194
|
if (length <= actualSize) return [array];
|
|
183
195
|
const chunks = [];
|
|
184
196
|
let index = 0;
|
|
@@ -188,7 +200,6 @@ function chunk(array, size) {
|
|
|
188
200
|
}
|
|
189
201
|
return chunks;
|
|
190
202
|
}
|
|
191
|
-
const CHUNK_MAX_SIZE = 5e3;
|
|
192
203
|
//#endregion
|
|
193
204
|
//#region src/internal/array/compact.ts
|
|
194
205
|
function compact(array, strict) {
|
|
@@ -405,24 +416,34 @@ function getArray(value, indiced) {
|
|
|
405
416
|
}
|
|
406
417
|
return array;
|
|
407
418
|
}
|
|
419
|
+
const ARRAY_MATCH_COMPARISON_INSIDE = "inside";
|
|
420
|
+
const ARRAY_MATCH_COMPARISON_INVALID = "invalid";
|
|
421
|
+
const ARRAY_MATCH_COMPARISON_OUTSIDE = "outside";
|
|
422
|
+
const ARRAY_MATCH_COMPARISON_SAME = "same";
|
|
423
|
+
const ARRAY_MATCH_COMPARISON_START = "start";
|
|
424
|
+
const arrayMatchEndings = /* @__PURE__ */ new Set(["end", ARRAY_MATCH_COMPARISON_SAME]);
|
|
425
|
+
const arrayMatchInvalid = [-1, ARRAY_MATCH_COMPARISON_INVALID];
|
|
426
|
+
const arrayMatchOutside = [-1, ARRAY_MATCH_COMPARISON_OUTSIDE];
|
|
427
|
+
const arrayMatchOutsides = /* @__PURE__ */ new Set([ARRAY_MATCH_COMPARISON_INVALID, ARRAY_MATCH_COMPARISON_OUTSIDE]);
|
|
428
|
+
const arrayMatchStarts = /* @__PURE__ */ new Set([ARRAY_MATCH_COMPARISON_START, ARRAY_MATCH_COMPARISON_SAME]);
|
|
408
429
|
//#endregion
|
|
409
430
|
//#region src/internal/array/match.ts
|
|
410
431
|
function endsWithArray(haystack, needle, key) {
|
|
411
|
-
return
|
|
432
|
+
return arrayMatchEndings.has(getPosition(haystack, needle, key)[1]);
|
|
412
433
|
}
|
|
413
434
|
function getArrayComparison(haystack, needle, key) {
|
|
414
435
|
return getPosition(haystack, needle, key)[1];
|
|
415
436
|
}
|
|
416
437
|
function getName(start, haystack, needle) {
|
|
417
|
-
if (start === 0) return haystack === needle ?
|
|
418
|
-
return start + needle === haystack ?
|
|
438
|
+
if (start === 0) return haystack === needle ? ARRAY_MATCH_COMPARISON_SAME : ARRAY_MATCH_COMPARISON_START;
|
|
439
|
+
return start + needle === haystack ? "end" : ARRAY_MATCH_COMPARISON_INSIDE;
|
|
419
440
|
}
|
|
420
441
|
function getPosition(haystack, needle, key) {
|
|
421
|
-
if (!Array.isArray(haystack) || !Array.isArray(needle)) return
|
|
442
|
+
if (!Array.isArray(haystack) || !Array.isArray(needle)) return arrayMatchInvalid;
|
|
422
443
|
const haystackLength = haystack.length;
|
|
423
444
|
const needleLength = needle.length;
|
|
424
|
-
if (haystackLength === 0 || needleLength === 0) return
|
|
425
|
-
if (needleLength > haystackLength) return
|
|
445
|
+
if (haystackLength === 0 || needleLength === 0) return arrayMatchOutside;
|
|
446
|
+
if (needleLength > haystackLength) return arrayMatchOutside;
|
|
426
447
|
const callback = getArrayCallback(key);
|
|
427
448
|
const limit = haystackLength - needleLength + 1;
|
|
428
449
|
let needleValues = callback == null ? needle : needle.slice();
|
|
@@ -439,28 +460,17 @@ function getPosition(haystack, needle, key) {
|
|
|
439
460
|
if (needleIndex === needleLength - 1) return [haystackIndex, getName(haystackIndex, haystackLength, needleLength)];
|
|
440
461
|
}
|
|
441
462
|
}
|
|
442
|
-
return
|
|
463
|
+
return arrayMatchOutside;
|
|
443
464
|
}
|
|
444
465
|
function includesArray(haystack, needle, key) {
|
|
445
|
-
return !
|
|
466
|
+
return !arrayMatchOutsides.has(getPosition(haystack, needle, key)[1]);
|
|
446
467
|
}
|
|
447
468
|
function indexOfArray(haystack, needle, key) {
|
|
448
469
|
return getPosition(haystack, needle, key)[0];
|
|
449
470
|
}
|
|
450
471
|
function startsWithArray(haystack, needle, key) {
|
|
451
|
-
return
|
|
452
|
-
}
|
|
453
|
-
const MATCH_COMPARISON_END = "end";
|
|
454
|
-
const MATCH_COMPARISON_INSIDE = "inside";
|
|
455
|
-
const MATCH_COMPARISON_INVALID = "invalid";
|
|
456
|
-
const MATCH_COMPARISON_OUTSIDE = "outside";
|
|
457
|
-
const MATCH_COMPARISON_SAME = "same";
|
|
458
|
-
const MATCH_COMPARISON_START = "start";
|
|
459
|
-
const endings = /* @__PURE__ */ new Set([MATCH_COMPARISON_END, MATCH_COMPARISON_SAME]);
|
|
460
|
-
const invalid = [-1, MATCH_COMPARISON_INVALID];
|
|
461
|
-
const outside = [-1, MATCH_COMPARISON_OUTSIDE];
|
|
462
|
-
const outsides = /* @__PURE__ */ new Set([MATCH_COMPARISON_INVALID, MATCH_COMPARISON_OUTSIDE]);
|
|
463
|
-
const starts = /* @__PURE__ */ new Set([MATCH_COMPARISON_START, MATCH_COMPARISON_SAME]);
|
|
472
|
+
return arrayMatchStarts.has(getPosition(haystack, needle, key)[1]);
|
|
473
|
+
}
|
|
464
474
|
//#endregion
|
|
465
475
|
//#region src/internal/math/misc.ts
|
|
466
476
|
/**
|
|
@@ -541,9 +551,9 @@ function shuffle(array) {
|
|
|
541
551
|
//#region src/internal/array/sets.ts
|
|
542
552
|
function compareSets(type, first, second, key) {
|
|
543
553
|
if (!Array.isArray(first)) return [];
|
|
544
|
-
const isDifference = type ===
|
|
545
|
-
const isIntersection = type ===
|
|
546
|
-
const isUnion = type ===
|
|
554
|
+
const isDifference = type === ARRAY_SETS_COMPARE_DIFFERENCE;
|
|
555
|
+
const isIntersection = type === ARRAY_SETS_COMPARE_INTERSECTION;
|
|
556
|
+
const isUnion = type === ARRAY_SETS_COMPARE_UNION;
|
|
547
557
|
if (first.length === 0) return isDifference ? first.slice() : isIntersection ? [] : second.slice();
|
|
548
558
|
if (!Array.isArray(second) || second.length === 0) return isIntersection ? [] : first.slice();
|
|
549
559
|
const callback = getArrayCallback(key);
|
|
@@ -564,19 +574,16 @@ function compareSets(type, first, second, key) {
|
|
|
564
574
|
}
|
|
565
575
|
return result;
|
|
566
576
|
}
|
|
567
|
-
const SETS_COMPARE_DIFFERENCE = "difference";
|
|
568
|
-
const SETS_COMPARE_INTERSECTION = "intersection";
|
|
569
|
-
const SETS_COMPARE_UNION = "union";
|
|
570
577
|
//#endregion
|
|
571
578
|
//#region src/array/difference.ts
|
|
572
579
|
function difference(first, second, key) {
|
|
573
|
-
return compareSets(
|
|
580
|
+
return compareSets(ARRAY_SETS_COMPARE_DIFFERENCE, first, second, key);
|
|
574
581
|
}
|
|
575
582
|
//#endregion
|
|
576
583
|
//#region src/array/exists.ts
|
|
577
584
|
function exists(array, ...parameters) {
|
|
578
585
|
if (parameters.length === 1 && typeof parameters[0] !== "function") return Array.isArray(array) ? array.includes(parameters[0]) : false;
|
|
579
|
-
return findValue(
|
|
586
|
+
return findValue(ARRAY_FIND_VALUE_INDEX, array, parameters, false) > -1;
|
|
580
587
|
}
|
|
581
588
|
//#endregion
|
|
582
589
|
//#region src/array/flatten.ts
|
|
@@ -614,6 +621,9 @@ function times(length, value) {
|
|
|
614
621
|
return values;
|
|
615
622
|
}
|
|
616
623
|
//#endregion
|
|
624
|
+
//#region src/models/math.model.ts
|
|
625
|
+
const AGGREGATION_AVERAGE = "average";
|
|
626
|
+
//#endregion
|
|
617
627
|
//#region src/internal/math/aggregate.ts
|
|
618
628
|
function aggregate(type, array, key, first) {
|
|
619
629
|
const length = Array.isArray(array) ? array.length : 0;
|
|
@@ -677,7 +687,6 @@ function max(array, key, first) {
|
|
|
677
687
|
function min(array, key, first) {
|
|
678
688
|
return getAggregated("min", array, key, first);
|
|
679
689
|
}
|
|
680
|
-
const AGGREGATION_AVERAGE = "average";
|
|
681
690
|
const aggregators = {
|
|
682
691
|
average: calculateSum,
|
|
683
692
|
max: getAbsoluteValue.bind(void 0, isMaxValue),
|
|
@@ -707,18 +716,15 @@ function insertValues(type, array, items, start, deleteCount) {
|
|
|
707
716
|
if (!Array.isArray(array) || typeof start !== "number" || !Array.isArray(items) || items.length === 0) return spliceArray ? [] : 0;
|
|
708
717
|
return insertChunkedValues(type, array, items, start, spliceArray ? deleteCount : 0);
|
|
709
718
|
}
|
|
710
|
-
const INSERT_TYPE_INSERT = "insert";
|
|
711
|
-
const INSERT_TYPE_PUSH = "push";
|
|
712
|
-
const INSERT_TYPE_SPLICE = "splice";
|
|
713
719
|
//#endregion
|
|
714
720
|
//#region src/array/insert.ts
|
|
715
721
|
function insert(array, indexOrItems, items) {
|
|
716
|
-
return insertValues(
|
|
722
|
+
return insertValues(ARRAY_INSERT_TYPE_INSERT, array, items == null ? indexOrItems : items, typeof indexOrItems === "number" ? indexOrItems : array?.length, 0);
|
|
717
723
|
}
|
|
718
724
|
//#endregion
|
|
719
725
|
//#region src/array/intersection.ts
|
|
720
726
|
function intersection(first, second, key) {
|
|
721
|
-
return compareSets(
|
|
727
|
+
return compareSets(ARRAY_SETS_COMPARE_INTERSECTION, first, second, key);
|
|
722
728
|
}
|
|
723
729
|
//#endregion
|
|
724
730
|
//#region src/array/partition.ts
|
|
@@ -743,7 +749,7 @@ function partition(array, ...parameters) {
|
|
|
743
749
|
* ```
|
|
744
750
|
*/
|
|
745
751
|
function push(array, pushed) {
|
|
746
|
-
return insertValues(
|
|
752
|
+
return insertValues(ARRAY_INSERT_TYPE_PUSH, array, pushed, array.length, 0);
|
|
747
753
|
}
|
|
748
754
|
//#endregion
|
|
749
755
|
//#region src/array/reverse.ts
|
|
@@ -777,13 +783,13 @@ const SINGLE_MESSAGE = "Multiple items were found";
|
|
|
777
783
|
//#endregion
|
|
778
784
|
//#region src/array/slice.ts
|
|
779
785
|
function drop(array, first, second) {
|
|
780
|
-
return extract(
|
|
786
|
+
return extract(ARRAY_SLICE_DROP, array, first, second);
|
|
781
787
|
}
|
|
782
788
|
function extract(type, array, first, second) {
|
|
783
789
|
if (!Array.isArray(array)) return [];
|
|
784
790
|
const { length } = array;
|
|
785
791
|
if (length === 0) return [];
|
|
786
|
-
const isTake = type ===
|
|
792
|
+
const isTake = type === ARRAY_SLICE_TAKE;
|
|
787
793
|
if (typeof first === "number") {
|
|
788
794
|
if (Math.abs(first) >= length) return isTake ? array.slice() : [];
|
|
789
795
|
if (first === 0) return isTake ? [] : array.slice();
|
|
@@ -821,15 +827,13 @@ function slice(array, first, second) {
|
|
|
821
827
|
return first >= 0 ? array.slice(first, second) : array.slice(array.length + first, array.length + second);
|
|
822
828
|
}
|
|
823
829
|
function take(array, first, second) {
|
|
824
|
-
return extract(
|
|
830
|
+
return extract(ARRAY_SLICE_TAKE, array, first, second);
|
|
825
831
|
}
|
|
826
|
-
const SLICE_DROP = "drop";
|
|
827
|
-
const SLICE_TAKE = "take";
|
|
828
832
|
//#endregion
|
|
829
833
|
//#region src/array/splice.ts
|
|
830
834
|
function splice(array, start, deleteCountOrItems, items) {
|
|
831
835
|
const deleteCountIsNumber = typeof deleteCountOrItems === "number";
|
|
832
|
-
return insertValues(
|
|
836
|
+
return insertValues(ARRAY_INSERT_TYPE_SPLICE, array, deleteCountIsNumber ? items : deleteCountOrItems, start, deleteCountIsNumber ? deleteCountOrItems : 0);
|
|
833
837
|
}
|
|
834
838
|
//#endregion
|
|
835
839
|
//#region src/array/to-set.ts
|
|
@@ -872,13 +876,13 @@ function toggle(array, values, key) {
|
|
|
872
876
|
//#endregion
|
|
873
877
|
//#region src/array/union.ts
|
|
874
878
|
function union(first, second, key) {
|
|
875
|
-
return compareSets(
|
|
879
|
+
return compareSets(ARRAY_SETS_COMPARE_UNION, first, second, key);
|
|
876
880
|
}
|
|
877
881
|
//#endregion
|
|
878
882
|
//#region src/array/unique.ts
|
|
879
883
|
function unique(array, key) {
|
|
880
884
|
if (!Array.isArray(array)) return [];
|
|
881
|
-
return array.length > 1 ? findValues(
|
|
885
|
+
return array.length > 1 ? findValues(ARRAY_FIND_VALUES_UNIQUE, array, [key, void 0]).matched : array;
|
|
882
886
|
}
|
|
883
887
|
//#endregion
|
|
884
888
|
//#region src/array/update.ts
|
|
@@ -1006,6 +1010,24 @@ function selectValues(array, parameters) {
|
|
|
1006
1010
|
}
|
|
1007
1011
|
filterAndMap.reverse = mapAndFilter;
|
|
1008
1012
|
//#endregion
|
|
1013
|
+
//#region src/models/value/value.misc.model.ts
|
|
1014
|
+
const COMPARE_NAME = "compare";
|
|
1015
|
+
const VALUE_MISC_EXPRESSION_BRACKET = /\[(\w+)\]/g;
|
|
1016
|
+
const VALUE_MISC_EXPRESSION_DOTS = /^\.|\.$/g;
|
|
1017
|
+
const VALUE_MISC_EXPRESSION_NESTED = /\.|\[\w+\]/;
|
|
1018
|
+
const VALUE_MISC_NESTED_MESSAGE_INPUT = "Expected data to be an object";
|
|
1019
|
+
const VALUE_MISC_NESTED_MESSAGE_MISSING = "Expected property to exist in object";
|
|
1020
|
+
const VALUE_MISC_NESTED_MESSAGE_PATH = "Expected path to be a string";
|
|
1021
|
+
const VALUE_MISC_NESTED_MESSAGE_UNSAFE = "Access to this property is not allowed";
|
|
1022
|
+
//#endregion
|
|
1023
|
+
//#region src/models/string/string.misc.model.ts
|
|
1024
|
+
const STRING_EXPRESSION_IGNORED = /(^|\.)(__proto__|constructor|prototype)(\.|$)/i;
|
|
1025
|
+
const STRING_EXPRESSION_WORDS = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
|
|
1026
|
+
const STRING_EXPRESSION_WHITESPACE_PREFIX = /^(\s+)/;
|
|
1027
|
+
const STRING_MATCH_ENDS_WITH = "endsWith";
|
|
1028
|
+
const STRING_MATCH_INCLUDES = "includes";
|
|
1029
|
+
const STRING_MATCH_STARTS_WITH = "startsWith";
|
|
1030
|
+
//#endregion
|
|
1009
1031
|
//#region src/internal/result/misc.ts
|
|
1010
1032
|
function error(value, original) {
|
|
1011
1033
|
return getError(value, original);
|
|
@@ -1169,8 +1191,6 @@ function tryEncode(value) {
|
|
|
1169
1191
|
function words(value) {
|
|
1170
1192
|
return typeof value === "string" ? value.match(STRING_EXPRESSION_WORDS) ?? [] : [];
|
|
1171
1193
|
}
|
|
1172
|
-
const STRING_EXPRESSION_IGNORED = /(^|\.)(__proto__|constructor|prototype)(\.|$)/i;
|
|
1173
|
-
const STRING_EXPRESSION_WORDS = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
|
|
1174
1194
|
//#endregion
|
|
1175
1195
|
//#region src/internal/value/handlers.ts
|
|
1176
1196
|
function BaseHandler(owner, options) {
|
|
@@ -1226,7 +1246,6 @@ function handleValue$1(value, ...parameters) {
|
|
|
1226
1246
|
}
|
|
1227
1247
|
//#endregion
|
|
1228
1248
|
//#region src/internal/value/compare.ts
|
|
1229
|
-
const COMPARE_NAME = "compare";
|
|
1230
1249
|
/**
|
|
1231
1250
|
* Compare two values _(for sorting purposes)_
|
|
1232
1251
|
*
|
|
@@ -1310,6 +1329,15 @@ compare.deregister = deregisterComparator;
|
|
|
1310
1329
|
compare.handler = compareHandler;
|
|
1311
1330
|
compare.register = registerComparator;
|
|
1312
1331
|
//#endregion
|
|
1332
|
+
//#region src/models/array/array.sort.model.ts
|
|
1333
|
+
const SORT_DIRECTION_ASCENDING = "ascending";
|
|
1334
|
+
const SORT_DIRECTION_DESCENDING = "descending";
|
|
1335
|
+
const SORTER_SYMBOL = Symbol("sorter");
|
|
1336
|
+
const arrayModifiers = {
|
|
1337
|
+
[SORT_DIRECTION_ASCENDING]: 1,
|
|
1338
|
+
[SORT_DIRECTION_DESCENDING]: -1
|
|
1339
|
+
};
|
|
1340
|
+
//#endregion
|
|
1313
1341
|
//#region src/array/sort.ts
|
|
1314
1342
|
function Sorter(sorters) {
|
|
1315
1343
|
this[SORTER_SYMBOL] = sorters;
|
|
@@ -1335,7 +1363,7 @@ function getComparisonValue(first, second, sorters, length) {
|
|
|
1335
1363
|
return 0;
|
|
1336
1364
|
}
|
|
1337
1365
|
function getModifier(first, second) {
|
|
1338
|
-
return
|
|
1366
|
+
return arrayModifiers[first === true || second === true ? SORT_DIRECTION_DESCENDING : SORT_DIRECTION_ASCENDING];
|
|
1339
1367
|
}
|
|
1340
1368
|
function getObjectSorter(obj, modifier) {
|
|
1341
1369
|
let sorter;
|
|
@@ -1344,7 +1372,7 @@ function getObjectSorter(obj, modifier) {
|
|
|
1344
1372
|
sorter = getValueSortHandlers(obj.key, modifier);
|
|
1345
1373
|
if (typeof obj.compare === "function") sorter.comparison = { complex: obj.compare };
|
|
1346
1374
|
} else if (typeof obj.value === "function") sorter = getValueSortHandlers(obj.value, modifier);
|
|
1347
|
-
if (sorter != null && typeof obj.direction === "string") sorter.modifier =
|
|
1375
|
+
if (sorter != null && typeof obj.direction === "string") sorter.modifier = arrayModifiers[obj.direction] ?? modifier;
|
|
1348
1376
|
return sorter;
|
|
1349
1377
|
}
|
|
1350
1378
|
function getSortedArrayIndex(array, item) {
|
|
@@ -1412,9 +1440,9 @@ function isSortedArray(array) {
|
|
|
1412
1440
|
const sorters = Array.isArray(this) ? this : this[SORTER_SYMBOL];
|
|
1413
1441
|
const sortersLength = sorters.length;
|
|
1414
1442
|
let offset = 0;
|
|
1415
|
-
if (length >=
|
|
1416
|
-
offset = round(length /
|
|
1417
|
-
offset = offset >
|
|
1443
|
+
if (length >= 100) {
|
|
1444
|
+
offset = round(length / 10);
|
|
1445
|
+
offset = offset > 100 ? 100 : offset;
|
|
1418
1446
|
for (let index = 0; index < offset; index += 1) {
|
|
1419
1447
|
const [firstItem, firstOffset] = [array[index], array[index + 1]];
|
|
1420
1448
|
const [secondItem, secondOffset] = [array[length - index - 2], array[length - index - 1]];
|
|
@@ -1439,25 +1467,16 @@ function sortArray(array) {
|
|
|
1439
1467
|
const { length } = sorters;
|
|
1440
1468
|
return array.length > 1 ? array.sort((first, second) => getComparisonValue(first, second, sorters, length)) : array;
|
|
1441
1469
|
}
|
|
1442
|
-
const SORT_PEEK_PERCENTAGE = 10;
|
|
1443
|
-
const SORT_THRESHOLD = 100;
|
|
1444
|
-
const SORT_DIRECTION_ASCENDING = "ascending";
|
|
1445
|
-
const SORT_DIRECTION_DESCENDING = "descending";
|
|
1446
|
-
const SORTER_SYMBOL = Symbol("sorter");
|
|
1447
|
-
const modifiers = {
|
|
1448
|
-
[SORT_DIRECTION_ASCENDING]: 1,
|
|
1449
|
-
[SORT_DIRECTION_DESCENDING]: -1
|
|
1450
|
-
};
|
|
1451
1470
|
sort.getIndex = getSortedIndex;
|
|
1452
1471
|
sort.initialize = initializeSorter;
|
|
1453
1472
|
sort.is = isSorted;
|
|
1454
1473
|
//#endregion
|
|
1455
1474
|
//#region src/internal/array/index-of.ts
|
|
1456
1475
|
function indexOf(array, ...parameters) {
|
|
1457
|
-
return findValue(
|
|
1476
|
+
return findValue(ARRAY_FIND_VALUE_INDEX, array, parameters, false);
|
|
1458
1477
|
}
|
|
1459
1478
|
function lastIndexOf(array, ...parameters) {
|
|
1460
|
-
return findValue(
|
|
1479
|
+
return findValue(ARRAY_FIND_VALUE_INDEX, array, parameters, true);
|
|
1461
1480
|
}
|
|
1462
1481
|
indexOf.last = lastIndexOf;
|
|
1463
1482
|
//#endregion
|
|
@@ -1559,6 +1578,19 @@ toRecord.arrays = toRecordArrays;
|
|
|
1559
1578
|
*/
|
|
1560
1579
|
function noop() {}
|
|
1561
1580
|
//#endregion
|
|
1581
|
+
//#region src/models/function/limiter.model.ts
|
|
1582
|
+
const LIMITER_DEBOUNCE = "debounce";
|
|
1583
|
+
const LIMITER_NAME_ASYNC = "asyncLimiter";
|
|
1584
|
+
const LIMITER_NAME_SYNC = "limiter";
|
|
1585
|
+
const LIMITER_PROPERTY = "$limiter";
|
|
1586
|
+
const LIMITER_SYMBOL = Symbol("limiter");
|
|
1587
|
+
const LIMITER_THROTTLE = "throttle";
|
|
1588
|
+
const LIMITER_WAIT = "wait";
|
|
1589
|
+
// istanbul ignore next
|
|
1590
|
+
const clearTimer = typeof cancelAnimationFrame === "function" ? cancelAnimationFrame : clearTimeout;
|
|
1591
|
+
// istanbul ignore next
|
|
1592
|
+
const startTimer = typeof requestAnimationFrame === "function" ? requestAnimationFrame : setTimeout;
|
|
1593
|
+
//#endregion
|
|
1562
1594
|
//#region src/internal/defaults.ts
|
|
1563
1595
|
function getBooleanOrDefault(value, defaultValue) {
|
|
1564
1596
|
return typeof value === "boolean" ? value : defaultValue;
|
|
@@ -1568,9 +1600,6 @@ function getNumberOrDefault(value, defaultValue, minimum) {
|
|
|
1568
1600
|
}
|
|
1569
1601
|
//#endregion
|
|
1570
1602
|
//#region src/internal/function/limit.ts
|
|
1571
|
-
const LIMITER_NAME_ASYNC = "asyncLimiter";
|
|
1572
|
-
const LIMITER_NAME_SYNC = "limiter";
|
|
1573
|
-
const LIMITER_PROPERTY = "$limiter";
|
|
1574
1603
|
function AsyncLimiter(type, callback, time) {
|
|
1575
1604
|
this[LIMITER_SYMBOL] = {
|
|
1576
1605
|
callback,
|
|
@@ -1616,7 +1645,7 @@ function getLimiter(type, callback, time) {
|
|
|
1616
1645
|
async function handleAsyncLimiter(state, item) {
|
|
1617
1646
|
const now = performance.now();
|
|
1618
1647
|
state.start ??= now;
|
|
1619
|
-
if (state.interval === 0 || now - state.start >= state.interval -
|
|
1648
|
+
if (state.interval === 0 || now - state.start >= state.interval - 5) {
|
|
1620
1649
|
state.start = state.throttle ? now : void 0;
|
|
1621
1650
|
item.running = true;
|
|
1622
1651
|
const result = await asyncAttempt(async () => {
|
|
@@ -1632,7 +1661,7 @@ async function handleAsyncLimiter(state, item) {
|
|
|
1632
1661
|
function handleLimiter(state) {
|
|
1633
1662
|
const now = performance.now();
|
|
1634
1663
|
state.start ??= now;
|
|
1635
|
-
if (state.interval === 0 || now - state.start >= state.interval -
|
|
1664
|
+
if (state.interval === 0 || now - state.start >= state.interval - 5) {
|
|
1636
1665
|
state.start = state.throttle ? now : void 0;
|
|
1637
1666
|
state.callback(...state.parameters);
|
|
1638
1667
|
} else state.timer = startTimer(() => handleLimiter(state));
|
|
@@ -1660,15 +1689,6 @@ function runLimiter(...parameters) {
|
|
|
1660
1689
|
if (state.throttle) handleLimiter(state);
|
|
1661
1690
|
else state.timer = startTimer(() => handleLimiter(state));
|
|
1662
1691
|
}
|
|
1663
|
-
const LIMITER_DEBOUNCE = "debounce";
|
|
1664
|
-
const LIMITER_OFFSET = 5;
|
|
1665
|
-
const LIMITER_SYMBOL = Symbol("limiter");
|
|
1666
|
-
const LIMITER_THROTTLE = "throttle";
|
|
1667
|
-
const LIMITER_WAIT = "wait";
|
|
1668
|
-
// istanbul ignore next
|
|
1669
|
-
const clearTimer = typeof cancelAnimationFrame === "function" ? cancelAnimationFrame : clearTimeout;
|
|
1670
|
-
// istanbul ignore next
|
|
1671
|
-
const startTimer = typeof requestAnimationFrame === "function" ? requestAnimationFrame : setTimeout;
|
|
1672
1692
|
//#endregion
|
|
1673
1693
|
//#region src/function/limit.ts
|
|
1674
1694
|
/**
|
|
@@ -1733,8 +1753,8 @@ function findKey(needle, haystack) {
|
|
|
1733
1753
|
return index > -1 ? keys[index] : needle;
|
|
1734
1754
|
}
|
|
1735
1755
|
function getNestedValue(data, path, ignoreCase) {
|
|
1736
|
-
if (typeof data !== "object" || data === null) return error(
|
|
1737
|
-
if (typeof path !== "string" || path.trim().length === 0) return error(
|
|
1756
|
+
if (typeof data !== "object" || data === null) return error(VALUE_MISC_NESTED_MESSAGE_INPUT);
|
|
1757
|
+
if (typeof path !== "string" || path.trim().length === 0) return error(VALUE_MISC_NESTED_MESSAGE_PATH);
|
|
1738
1758
|
const shouldIgnoreCase = ignoreCase === true;
|
|
1739
1759
|
const paths = getPaths(path, shouldIgnoreCase);
|
|
1740
1760
|
if (typeof paths === "string") return handleValue(data, paths, null, true, shouldIgnoreCase);
|
|
@@ -1750,26 +1770,19 @@ function getNestedValue(data, path, ignoreCase) {
|
|
|
1750
1770
|
}
|
|
1751
1771
|
function getPaths(path, lowercase) {
|
|
1752
1772
|
const normalized = lowercase ? path.toLowerCase() : path;
|
|
1753
|
-
if (!
|
|
1754
|
-
return normalized.replace(
|
|
1773
|
+
if (!VALUE_MISC_EXPRESSION_NESTED.test(normalized)) return normalized;
|
|
1774
|
+
return normalized.replace(VALUE_MISC_EXPRESSION_BRACKET, ".$1").replace(VALUE_MISC_EXPRESSION_DOTS, "").split(".");
|
|
1755
1775
|
}
|
|
1756
1776
|
function handleValue(data, path, value, get, ignoreCase) {
|
|
1757
1777
|
if (typeof data === "object" && data !== null) {
|
|
1758
|
-
if (ignoreKey(path)) return error(
|
|
1778
|
+
if (ignoreKey(path)) return error(VALUE_MISC_NESTED_MESSAGE_UNSAFE);
|
|
1759
1779
|
const dataObject = data;
|
|
1760
1780
|
const key = ignoreCase ? findKey(path, dataObject) : path;
|
|
1761
|
-
if (get) return key in dataObject ? ok(dataObject[key]) : error(
|
|
1781
|
+
if (get) return key in dataObject ? ok(dataObject[key]) : error(VALUE_MISC_NESTED_MESSAGE_MISSING);
|
|
1762
1782
|
dataObject[key] = typeof value === "function" ? value(dataObject[key]) : value;
|
|
1763
1783
|
}
|
|
1764
|
-
if (get) return error(
|
|
1784
|
+
if (get) return error(VALUE_MISC_NESTED_MESSAGE_MISSING);
|
|
1765
1785
|
}
|
|
1766
|
-
const MISC_EXPRESSION_BRACKET = /\[(\w+)\]/g;
|
|
1767
|
-
const MISC_EXPRESSION_DOTS = /^\.|\.$/g;
|
|
1768
|
-
const MISC_EXPRESSION_NESTED = /\.|\[\w+\]/;
|
|
1769
|
-
const MISC_NESTED_MESSAGE_INPUT = "Expected data to be an object";
|
|
1770
|
-
const MISC_NESTED_MESSAGE_MISSING = "Expected property to exist in object";
|
|
1771
|
-
const MISC_NESTED_MESSAGE_PATH = "Expected path to be a string";
|
|
1772
|
-
const MISC_NESTED_MESSAGE_UNSAFE = "Access to this property is not allowed";
|
|
1773
1786
|
//#endregion
|
|
1774
1787
|
//#region src/internal/value/has.ts
|
|
1775
1788
|
function hasValue(data, path, ignoreCase) {
|
|
@@ -1816,7 +1829,7 @@ function assertCondition(condition, message, error) {
|
|
|
1816
1829
|
* @param error Error constructor _(defaults to `Error`)_
|
|
1817
1830
|
*/
|
|
1818
1831
|
function assertDefined(value, message, error) {
|
|
1819
|
-
assert(() => value != null, message ??
|
|
1832
|
+
assert(() => value != null, message ?? "Expected value to be defined", error);
|
|
1820
1833
|
}
|
|
1821
1834
|
/**
|
|
1822
1835
|
* Creates an _Asserter_ that asserts a value is an instance of a constructor, throwing an error if it is not
|
|
@@ -1867,17 +1880,21 @@ function assertProperty(path, condition, message, error) {
|
|
|
1867
1880
|
}, message, error);
|
|
1868
1881
|
};
|
|
1869
1882
|
}
|
|
1870
|
-
const ASSERT_MESSAGE_VALUE_DEFINED = "Expected value to be defined";
|
|
1871
1883
|
assert.condition = assertCondition;
|
|
1872
1884
|
assert.defined = assertDefined;
|
|
1873
1885
|
assert.instanceOf = assertInstanceOf;
|
|
1874
1886
|
assert.is = assertIs;
|
|
1875
1887
|
assert.property = assertProperty;
|
|
1876
1888
|
//#endregion
|
|
1877
|
-
//#region src/function/once.ts
|
|
1889
|
+
//#region src/models/function/once.model.ts
|
|
1878
1890
|
const ONCE_NAME_ASYNC = "asyncOnce";
|
|
1879
1891
|
const ONCE_NAME_SYNC = "once";
|
|
1880
1892
|
const ONCE_PROPERTY = "$once";
|
|
1893
|
+
const ONCE_MESSAGE_CLEARED = "Once has been cleared";
|
|
1894
|
+
const ONCE_MESSAGE_EXPECTATION = "Once expected a function";
|
|
1895
|
+
const ONCE_SYMBOL = Symbol(ONCE_PROPERTY);
|
|
1896
|
+
//#endregion
|
|
1897
|
+
//#region src/function/once.ts
|
|
1881
1898
|
function AsyncOnce(callback) {
|
|
1882
1899
|
this[ONCE_SYMBOL] = {
|
|
1883
1900
|
callback,
|
|
@@ -1969,9 +1986,9 @@ function handleOnceResult(state, value, error) {
|
|
|
1969
1986
|
const items = state.items.splice(0);
|
|
1970
1987
|
const { length } = items;
|
|
1971
1988
|
for (let index = 0; index < length; index += 1) {
|
|
1972
|
-
const
|
|
1973
|
-
if (error) reject(value);
|
|
1974
|
-
else resolve(value);
|
|
1989
|
+
const item = items[index];
|
|
1990
|
+
if (error) item.reject(value);
|
|
1991
|
+
else item.resolve(value);
|
|
1975
1992
|
}
|
|
1976
1993
|
}
|
|
1977
1994
|
/**
|
|
@@ -1993,7 +2010,7 @@ function isOnce(value) {
|
|
|
1993
2010
|
return isOnceInstance(value, ONCE_NAME_SYNC);
|
|
1994
2011
|
}
|
|
1995
2012
|
function isOnceInstance(value, name) {
|
|
1996
|
-
return typeof value === "object" && value !== null &&
|
|
2013
|
+
return typeof value === "object" && value !== null && "$once" in value && value["$once"] === name;
|
|
1997
2014
|
}
|
|
1998
2015
|
/**
|
|
1999
2016
|
* Create a function that can only be called once, returning the same value on subsequent calls
|
|
@@ -2015,7 +2032,7 @@ function runOnce(...parameters) {
|
|
|
2015
2032
|
}
|
|
2016
2033
|
function runOnceAsync(...parameters) {
|
|
2017
2034
|
const state = this[ONCE_SYMBOL];
|
|
2018
|
-
if (state.cleared) return Promise.reject(new Error(ONCE_MESSAGE_CLEARED));
|
|
2035
|
+
if (state.cleared) return Promise.reject(/* @__PURE__ */ new Error(ONCE_MESSAGE_CLEARED));
|
|
2019
2036
|
if (state.finished) return state.error ? Promise.reject(state.value) : Promise.resolve(state.value);
|
|
2020
2037
|
if (state.called) return new Promise((resolve, reject) => {
|
|
2021
2038
|
state.items.push({
|
|
@@ -2036,15 +2053,12 @@ function runOnceAsync(...parameters) {
|
|
|
2036
2053
|
});
|
|
2037
2054
|
});
|
|
2038
2055
|
}
|
|
2039
|
-
const ONCE_MESSAGE_CLEARED = "Once has been cleared";
|
|
2040
|
-
const ONCE_MESSAGE_EXPECTATION = "Once expected a function";
|
|
2041
|
-
const ONCE_SYMBOL = Symbol(ONCE_PROPERTY);
|
|
2042
2056
|
asyncOnce.is = isAsyncOnce;
|
|
2043
2057
|
once.async = asyncOnce;
|
|
2044
2058
|
once.is = isOnce;
|
|
2045
2059
|
once.isAsync = isAsyncOnce;
|
|
2046
2060
|
//#endregion
|
|
2047
|
-
//#region src/function/retry.ts
|
|
2061
|
+
//#region src/models/function/retry.model.ts
|
|
2048
2062
|
/**
|
|
2049
2063
|
* An error thrown when a retry fails
|
|
2050
2064
|
*/
|
|
@@ -2056,6 +2070,11 @@ var RetryError = class extends Error {
|
|
|
2056
2070
|
this.name = RETRY_ERROR_NAME;
|
|
2057
2071
|
}
|
|
2058
2072
|
};
|
|
2073
|
+
const RETRY_ERROR_NAME = "RetryError";
|
|
2074
|
+
const RETRY_MESSAGE_EXPECTATION = "Retry expected a function";
|
|
2075
|
+
const RETRY_MESSAGE_FAILED = "Retry failed";
|
|
2076
|
+
//#endregion
|
|
2077
|
+
//#region src/function/retry.ts
|
|
2059
2078
|
/**
|
|
2060
2079
|
* Retry a callback a specified number of times, with a delay between attempts
|
|
2061
2080
|
*
|
|
@@ -2119,11 +2138,22 @@ function retry(callback, options) {
|
|
|
2119
2138
|
function shouldRetry() {
|
|
2120
2139
|
return true;
|
|
2121
2140
|
}
|
|
2122
|
-
const RETRY_ERROR_NAME = "RetryError";
|
|
2123
|
-
const RETRY_MESSAGE_EXPECTATION = "Retry expected a function";
|
|
2124
|
-
const RETRY_MESSAGE_FAILED = "Retry failed";
|
|
2125
2141
|
retry.async = asyncRetry;
|
|
2126
2142
|
//#endregion
|
|
2143
|
+
//#region src/models/function/memoize.model.ts
|
|
2144
|
+
const MEMOIZED_CACHE_SIZE_DEFAULT = 1024;
|
|
2145
|
+
const MEMOIZED_CALLBACK = "Memoized requires a callback function";
|
|
2146
|
+
const MEMOIZED_SYMBOL = Symbol("memoized");
|
|
2147
|
+
//#endregion
|
|
2148
|
+
//#region src/models/misc.model.ts
|
|
2149
|
+
const EXPRESSION_INTEGER = /^\d+$/;
|
|
2150
|
+
const EXPRESSION_NUMBER_BINARY = /^0b[01]+$/i;
|
|
2151
|
+
const EXPRESSION_NUMBER_OCTAL = /^0o[0-7]+$/i;
|
|
2152
|
+
const EXPRESSION_NUMBER_ZEROISH = /^\s*0+\s*$/;
|
|
2153
|
+
const EXPRESSION_NUMERICAL_PREFIX = /^\d/;
|
|
2154
|
+
const EXPRESSION_WHITESPACE_MULTIPLE = /\s+/g;
|
|
2155
|
+
const EXPRESSION_WHITESPACE_ONLY = /^\s*$/;
|
|
2156
|
+
//#endregion
|
|
2127
2157
|
//#region src/internal/number.ts
|
|
2128
2158
|
/**
|
|
2129
2159
|
* Is the number between a minimum and maximum value?
|
|
@@ -2184,15 +2214,11 @@ function getNumber(value) {
|
|
|
2184
2214
|
if (typeof parsed !== "string") return getNumber(parsed);
|
|
2185
2215
|
const trimmed = parsed.trim();
|
|
2186
2216
|
if (trimmed.length === 0) return NaN;
|
|
2187
|
-
if (
|
|
2188
|
-
const isBinary =
|
|
2189
|
-
if (isBinary ||
|
|
2217
|
+
if (EXPRESSION_NUMBER_ZEROISH.test(parsed)) return 0;
|
|
2218
|
+
const isBinary = EXPRESSION_NUMBER_BINARY.test(trimmed);
|
|
2219
|
+
if (isBinary || EXPRESSION_NUMBER_OCTAL.test(trimmed)) return Number.parseInt(trimmed.slice(2), isBinary ? 2 : 8);
|
|
2190
2220
|
return Number(trimmed);
|
|
2191
2221
|
}
|
|
2192
|
-
const NUMBER_EXPRESSION_BINARY = /^0b[01]+$/i;
|
|
2193
|
-
const NUMBER_EXPRESSION_OCTAL = /^0o[0-7]+$/i;
|
|
2194
|
-
const NUMBER_EXPRESSION_ZEROISH = /^\s*0+\s*$/;
|
|
2195
|
-
const NUMBER_OCTAL_VALUE = 8;
|
|
2196
2222
|
//#endregion
|
|
2197
2223
|
//#region src/internal/sized/misc.ts
|
|
2198
2224
|
function getSizedMaximum(first, second) {
|
|
@@ -2291,7 +2317,7 @@ function deleteMemoizedValue(key) {
|
|
|
2291
2317
|
}
|
|
2292
2318
|
function createGetter(state, callback) {
|
|
2293
2319
|
return (...parameters) => {
|
|
2294
|
-
const key = state.options.cacheKey?.(...parameters) ?? (parameters.length === 1 ? parameters[0] : join(parameters.map(getString),
|
|
2320
|
+
const key = state.options.cacheKey?.(...parameters) ?? (parameters.length === 1 ? parameters[0] : join(parameters.map(getString), "_"));
|
|
2295
2321
|
if (state.cache.has(key)) return state.cache.get(key);
|
|
2296
2322
|
const value = callback(...parameters);
|
|
2297
2323
|
state.cache.set(key, value);
|
|
@@ -2331,10 +2357,15 @@ function memoize(callback, options) {
|
|
|
2331
2357
|
function runMemoized(...parameters) {
|
|
2332
2358
|
return this[MEMOIZED_SYMBOL].getter(...parameters);
|
|
2333
2359
|
}
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
const
|
|
2337
|
-
const
|
|
2360
|
+
//#endregion
|
|
2361
|
+
//#region src/models/function/work.model.ts
|
|
2362
|
+
const WORK_MESSAGE_FLOW_ARRAY = "Flow expected to receive an array of functions";
|
|
2363
|
+
const WORK_MESSAGE_FLOW_PROMISE = "Synchronous Flow received a promise. Use `flow.async` instead.";
|
|
2364
|
+
const WORK_MESSAGE_NESTING = "Return values are too deeply nested.";
|
|
2365
|
+
const WORK_MESSAGE_PIPE_ARRAY = "Pipe expected to receive an array of functions";
|
|
2366
|
+
const WORK_MESSAGE_PIPE_PROMISE = "Synchronous Pipe received a promise. Use `pipe.async` instead.";
|
|
2367
|
+
const assertFlowFunctions = assert.condition((value) => Array.isArray(value) && value.every((item) => typeof item === "function"), WORK_MESSAGE_FLOW_ARRAY, TypeError);
|
|
2368
|
+
const assertPipeFunctions = assert.condition((value) => Array.isArray(value) && value.every((item) => typeof item === "function"), WORK_MESSAGE_PIPE_ARRAY, TypeError);
|
|
2338
2369
|
//#endregion
|
|
2339
2370
|
//#region src/internal/function/work.ts
|
|
2340
2371
|
function asyncFlow(...fns) {
|
|
@@ -2386,16 +2417,18 @@ function work(initial, functions, flow) {
|
|
|
2386
2417
|
}
|
|
2387
2418
|
return transformed;
|
|
2388
2419
|
}
|
|
2389
|
-
const WORK_MESSAGE_FLOW_ARRAY = "Flow expected to receive an array of functions";
|
|
2390
|
-
const WORK_MESSAGE_FLOW_PROMISE = "Synchronous Flow received a promise. Use `flow.async` instead.";
|
|
2391
|
-
const WORK_MESSAGE_NESTING = "Return values are too deeply nested.";
|
|
2392
|
-
const WORK_MESSAGE_PIPE_ARRAY = "Pipe expected to receive an array of functions";
|
|
2393
|
-
const WORK_MESSAGE_PIPE_PROMISE = "Synchronous Pipe received a promise. Use `pipe.async` instead.";
|
|
2394
|
-
const assertFlowFunctions = assert.condition((value) => Array.isArray(value) && value.every((item) => typeof item === "function"), WORK_MESSAGE_FLOW_ARRAY, TypeError);
|
|
2395
|
-
const assertPipeFunctions = assert.condition((value) => Array.isArray(value) && value.every((item) => typeof item === "function"), WORK_MESSAGE_PIPE_ARRAY, TypeError);
|
|
2396
2420
|
flow.async = asyncFlow;
|
|
2397
2421
|
pipe.async = asyncPipe;
|
|
2398
2422
|
//#endregion
|
|
2423
|
+
//#region src/models/string/string.case.model.ts
|
|
2424
|
+
const STRING_CASE_CAMEL = "camel";
|
|
2425
|
+
const STRING_CASE_KEBAB = "kebab";
|
|
2426
|
+
const STRING_CASE_PASCAL = "pascal";
|
|
2427
|
+
const STRING_CASE_SNAKE = "snake";
|
|
2428
|
+
const STRING_EXPRESSION_CAMEL_CASE = /(\p{Ll})(\p{Lu})/gu;
|
|
2429
|
+
const STRING_EXPRESSION_ACRONYM = /(\p{Lu}*)(\p{Lu})(\p{Ll}+)/gu;
|
|
2430
|
+
const STRING_REPLACEMENT_CAMEL_CASE = "$1-$2";
|
|
2431
|
+
//#endregion
|
|
2399
2432
|
//#region src/internal/string/case.ts
|
|
2400
2433
|
/**
|
|
2401
2434
|
* Convert a string to camel case _(thisIsCamelCase)_
|
|
@@ -2482,7 +2515,7 @@ function toCaseCallback(value) {
|
|
|
2482
2515
|
const partsLength = parts.length;
|
|
2483
2516
|
const cased = [];
|
|
2484
2517
|
for (let partIndex = 0; partIndex < partsLength; partIndex += 1) {
|
|
2485
|
-
const items = parts[partIndex].replace(STRING_EXPRESSION_ACRONYM, (full, one, two, three) => three ===
|
|
2518
|
+
const items = parts[partIndex].replace(STRING_EXPRESSION_ACRONYM, (full, one, two, three) => three === "s" ? full : `${one}-${two}${three}`).replace(STRING_EXPRESSION_CAMEL_CASE, STRING_REPLACEMENT_CAMEL_CASE).split("-");
|
|
2486
2519
|
const itemsLength = items.length;
|
|
2487
2520
|
const partResult = [];
|
|
2488
2521
|
let itemCount = 0;
|
|
@@ -2508,29 +2541,23 @@ function upperCase(value) {
|
|
|
2508
2541
|
memoizedUpperCase ??= memoize((v) => v.toLocaleUpperCase());
|
|
2509
2542
|
return memoizedUpperCase.run(value);
|
|
2510
2543
|
}
|
|
2511
|
-
const STRING_CASE_CAMEL = "camel";
|
|
2512
|
-
const STRING_CASE_KEBAB = "kebab";
|
|
2513
|
-
const STRING_CASE_PASCAL = "pascal";
|
|
2514
|
-
const STRING_CASE_SNAKE = "snake";
|
|
2515
|
-
const STRING_DELIMTER_EMPTY = "";
|
|
2516
|
-
const STRING_DELIMITER_HYPHEN = "-";
|
|
2517
|
-
const STRING_DELIMITER_UNDERSCORE = "_";
|
|
2518
|
-
const STRING_EXPRESSION_CAMEL_CASE = /(\p{Ll})(\p{Lu})/gu;
|
|
2519
|
-
const STRING_EXPRESSION_ACRONYM = /(\p{Lu}*)(\p{Lu})(\p{Ll}+)/gu;
|
|
2520
|
-
const STRING_REPLACEMENT_CAMEL_CASE = "$1-$2";
|
|
2521
|
-
const STRING_S = "s";
|
|
2522
2544
|
const caseMemoizers = {};
|
|
2523
2545
|
const delimiters = {
|
|
2524
|
-
[STRING_CASE_CAMEL]:
|
|
2525
|
-
[STRING_CASE_KEBAB]:
|
|
2526
|
-
[STRING_CASE_PASCAL]:
|
|
2527
|
-
[STRING_CASE_SNAKE]:
|
|
2546
|
+
[STRING_CASE_CAMEL]: "",
|
|
2547
|
+
[STRING_CASE_KEBAB]: "-",
|
|
2548
|
+
[STRING_CASE_PASCAL]: "",
|
|
2549
|
+
[STRING_CASE_SNAKE]: "_"
|
|
2528
2550
|
};
|
|
2529
2551
|
let memoizedCapitalize;
|
|
2530
2552
|
let memoizedLowerCase;
|
|
2531
2553
|
let memoizedTitleCase;
|
|
2532
2554
|
let memoizedUpperCase;
|
|
2533
2555
|
//#endregion
|
|
2556
|
+
//#region src/models/value/value.equal.model.ts
|
|
2557
|
+
const EQUAL_ERROR_PROPERTIES = ["name", "message"];
|
|
2558
|
+
const EQUAL_EXPRESSION_PROPERTIES = ["source", "flags"];
|
|
2559
|
+
const EQUAL_SYMBOL = Symbol("equal");
|
|
2560
|
+
//#endregion
|
|
2534
2561
|
//#region src/internal/value/equal.ts
|
|
2535
2562
|
function Equalizer(options) {
|
|
2536
2563
|
this[EQUAL_SYMBOL] = options;
|
|
@@ -2590,9 +2617,9 @@ function equalArray(first, second, options) {
|
|
|
2590
2617
|
const { length } = first;
|
|
2591
2618
|
if (length !== second.length) return false;
|
|
2592
2619
|
let offset = 0;
|
|
2593
|
-
if (length >=
|
|
2594
|
-
offset = round(length /
|
|
2595
|
-
offset = offset >
|
|
2620
|
+
if (length >= 100) {
|
|
2621
|
+
offset = round(length / 10);
|
|
2622
|
+
offset = offset > 100 ? 100 : offset;
|
|
2596
2623
|
for (let index = 0; index < offset; index += 1) if (!(equalValue(first[index], second[index], options) && equalValue(first[length - index - 1], second[length - index - 1], options))) return false;
|
|
2597
2624
|
}
|
|
2598
2625
|
const end = length - offset;
|
|
@@ -2622,7 +2649,7 @@ function equalPlainObject(first, second, options) {
|
|
|
2622
2649
|
firstKeys = firstKeys.filter((key) => filterKey(key, options));
|
|
2623
2650
|
secondKeys = secondKeys.filter((key) => filterKey(key, options));
|
|
2624
2651
|
}
|
|
2625
|
-
const secondSet = secondKeys.length >=
|
|
2652
|
+
const secondSet = secondKeys.length >= 16 ? new Set(secondKeys) : void 0;
|
|
2626
2653
|
const { length } = firstKeys;
|
|
2627
2654
|
if (length !== secondKeys.length) return false;
|
|
2628
2655
|
for (let index = 0; index < length; index += 1) {
|
|
@@ -2699,12 +2726,6 @@ function initializeEqualizer(options) {
|
|
|
2699
2726
|
function registerEqualizer(constructor, handler) {
|
|
2700
2727
|
equalHandler.base.register(constructor, handler);
|
|
2701
2728
|
}
|
|
2702
|
-
const EQUAL_ARRAY_PEEK_PERCENTAGE = 10;
|
|
2703
|
-
const EQUAL_ARRAY_THRESHOLD = 100;
|
|
2704
|
-
const EQUAL_ERROR_PROPERTIES = ["name", "message"];
|
|
2705
|
-
const EQUAL_EXPRESSION_PROPERTIES = ["source", "flags"];
|
|
2706
|
-
const EQUAL_MINIMUM_LENGTH_FOR_SET = 16;
|
|
2707
|
-
const EQUAL_SYMBOL = Symbol("equal");
|
|
2708
2729
|
const equalHandler = createCompareHandler(equal, { callback: Object.is });
|
|
2709
2730
|
equal.deregister = deregisterEqualizer;
|
|
2710
2731
|
equal.handler = equalHandler;
|
|
@@ -2737,7 +2758,7 @@ function setValue(data, path, value, ignoreCase) {
|
|
|
2737
2758
|
let next = unwrap(handleValue(target, currentPath, null, true, shouldIgnoreCase), void 0);
|
|
2738
2759
|
if (typeof next !== "object" || next === null) {
|
|
2739
2760
|
const nextPath = paths[index + 1];
|
|
2740
|
-
if (
|
|
2761
|
+
if (EXPRESSION_INTEGER.test(nextPath)) next = Array.from({ length: +nextPath + 1 }, () => void 0);
|
|
2741
2762
|
else next = {};
|
|
2742
2763
|
target[currentPath] = next;
|
|
2743
2764
|
}
|
|
@@ -2745,9 +2766,8 @@ function setValue(data, path, value, ignoreCase) {
|
|
|
2745
2766
|
}
|
|
2746
2767
|
return data;
|
|
2747
2768
|
}
|
|
2748
|
-
const SET_EXPRESSION_INDEX = /^\d+$/;
|
|
2749
2769
|
//#endregion
|
|
2750
|
-
//#region src/
|
|
2770
|
+
//#region src/models/plan.model.ts
|
|
2751
2771
|
const GENERATOR_NAME_ASYNC = "AsyncGeneratorFunction";
|
|
2752
2772
|
const GENERATOR_NAME_SYNC = "GeneratorFunction";
|
|
2753
2773
|
const PLAN_MESSAGE_PLAN_INPUT = "plan requires a generator function";
|
|
@@ -2801,15 +2821,17 @@ function isPlanInstance(type, value) {
|
|
|
2801
2821
|
}
|
|
2802
2822
|
//#endregion
|
|
2803
2823
|
//#region src/plan/generate.ts
|
|
2804
|
-
async function asyncGenerate(
|
|
2805
|
-
|
|
2824
|
+
async function asyncGenerate(input, parameters, unwrap) {
|
|
2825
|
+
let generator;
|
|
2826
|
+
if (typeof input === "function") generator = input(...parameters);
|
|
2827
|
+
else generator = input.generator(...parameters);
|
|
2806
2828
|
let success = true;
|
|
2807
2829
|
let lastValue;
|
|
2808
2830
|
try {
|
|
2809
2831
|
while (true) {
|
|
2810
2832
|
const next = await generator.next(lastValue);
|
|
2811
|
-
const
|
|
2812
|
-
|
|
2833
|
+
const done = next.done === true;
|
|
2834
|
+
const { value } = next;
|
|
2813
2835
|
if (value instanceof Error) throw value;
|
|
2814
2836
|
if (isError(value)) throw value.error;
|
|
2815
2837
|
lastValue = value;
|
|
@@ -2819,13 +2841,15 @@ async function asyncGenerate(callback, parameters, unwrap) {
|
|
|
2819
2841
|
lastValue = error;
|
|
2820
2842
|
success = false;
|
|
2821
2843
|
} finally {
|
|
2822
|
-
await generator
|
|
2844
|
+
await generator.return(lastValue);
|
|
2823
2845
|
}
|
|
2824
2846
|
if (success) return unwrap && isOk(lastValue) ? lastValue.value : lastValue;
|
|
2825
2847
|
throw lastValue;
|
|
2826
2848
|
}
|
|
2827
|
-
function generate(
|
|
2828
|
-
|
|
2849
|
+
function generate(input, parameters, unwrap) {
|
|
2850
|
+
let generator;
|
|
2851
|
+
if (typeof input === "function") generator = input(...parameters);
|
|
2852
|
+
else generator = input.generator(...parameters);
|
|
2829
2853
|
let success = true;
|
|
2830
2854
|
let lastValue;
|
|
2831
2855
|
try {
|
|
@@ -2860,10 +2884,10 @@ function attemptRun(input, ...parameters) {
|
|
|
2860
2884
|
throw new Error(PLAN_MESSAGE_RUN_INPUT);
|
|
2861
2885
|
}
|
|
2862
2886
|
function attemptRunAsyncPlan(...parameters) {
|
|
2863
|
-
return asyncAttempt(() => asyncGenerate(this[PLAN_SYMBOL]
|
|
2887
|
+
return asyncAttempt(() => asyncGenerate(this[PLAN_SYMBOL], parameters, true));
|
|
2864
2888
|
}
|
|
2865
2889
|
function attemptRunPlan(...parameters) {
|
|
2866
|
-
return attempt(() => generate(this[PLAN_SYMBOL]
|
|
2890
|
+
return attempt(() => generate(this[PLAN_SYMBOL], parameters, true));
|
|
2867
2891
|
}
|
|
2868
2892
|
attemptRun.async = asyncAttemptRun;
|
|
2869
2893
|
//#endregion
|
|
@@ -2879,10 +2903,10 @@ function run(input, ...parameters) {
|
|
|
2879
2903
|
throw new Error(PLAN_MESSAGE_RUN_INPUT);
|
|
2880
2904
|
}
|
|
2881
2905
|
function runAsyncPlan(...parameters) {
|
|
2882
|
-
return asyncGenerate(this[PLAN_SYMBOL]
|
|
2906
|
+
return asyncGenerate(this[PLAN_SYMBOL], parameters, false);
|
|
2883
2907
|
}
|
|
2884
2908
|
function runPlan(...parameters) {
|
|
2885
|
-
return generate(this[PLAN_SYMBOL]
|
|
2909
|
+
return generate(this[PLAN_SYMBOL], parameters, false);
|
|
2886
2910
|
}
|
|
2887
2911
|
asyncRun.attempt = asyncAttemptRun;
|
|
2888
2912
|
run.async = asyncRun;
|
|
@@ -2947,32 +2971,22 @@ function succeedResult(value) {
|
|
|
2947
2971
|
}
|
|
2948
2972
|
succeed.result = succeedResult;
|
|
2949
2973
|
//#endregion
|
|
2974
|
+
//#region src/models/aborter.model.ts
|
|
2975
|
+
const ABORTER_EVENT = "abort";
|
|
2976
|
+
const ABORTER_OPTIONS = { once: true };
|
|
2977
|
+
//#endregion
|
|
2950
2978
|
//#region src/internal/aborter.ts
|
|
2951
2979
|
function createAborter(value, onAbort) {
|
|
2952
2980
|
if (!(value instanceof AbortSignal)) return;
|
|
2953
|
-
value.addEventListener(
|
|
2981
|
+
value.addEventListener(ABORTER_EVENT, onAbort, ABORTER_OPTIONS);
|
|
2954
2982
|
return {
|
|
2955
2983
|
callback: onAbort,
|
|
2956
2984
|
signal: value,
|
|
2957
|
-
cancel: () => value.removeEventListener(
|
|
2985
|
+
cancel: () => value.removeEventListener(ABORTER_EVENT, onAbort)
|
|
2958
2986
|
};
|
|
2959
2987
|
}
|
|
2960
|
-
const ABORT_EVENT = "abort";
|
|
2961
|
-
const ABORT_OPTIONS = { once: true };
|
|
2962
2988
|
//#endregion
|
|
2963
|
-
//#region src/promise
|
|
2964
|
-
const PROMISE_ERROR_NAME = "PromiseTimeoutError";
|
|
2965
|
-
const PROMISE_MESSAGE_EXPECTATION_ATTEMPT = "Attempt expected a function or a promise";
|
|
2966
|
-
const PROMISE_MESSAGE_EXPECTATION_ITEMS_TYPE = "promises expected an array or object holding promise-functions or promises";
|
|
2967
|
-
const PROMISE_MESSAGE_EXPECTATION_RESULT = "toResult expected a Promise";
|
|
2968
|
-
const PROMISE_MESSAGE_EXPECTATION_TIMED = "Timed function expected a Promise";
|
|
2969
|
-
const PROMISE_MESSAGE_TIMEOUT = "Promise timed out";
|
|
2970
|
-
const PROMISE_STRATEGY_ALL = /* @__PURE__ */ new Set(["complete", "first"]);
|
|
2971
|
-
const PROMISE_STRATEGY_DEFAULT = "complete";
|
|
2972
|
-
const PROMISE_TYPE_FULFILLED = "fulfilled";
|
|
2973
|
-
const PROMISE_TYPE_REJECTED = "rejected";
|
|
2974
|
-
//#endregion
|
|
2975
|
-
//#region src/promise/models.ts
|
|
2989
|
+
//#region src/models/promise.model.ts
|
|
2976
2990
|
/**
|
|
2977
2991
|
* A _Promise_ that can be canceled
|
|
2978
2992
|
*/
|
|
@@ -3005,6 +3019,16 @@ var PromiseTimeoutError = class extends Error {
|
|
|
3005
3019
|
this.name = PROMISE_ERROR_NAME;
|
|
3006
3020
|
}
|
|
3007
3021
|
};
|
|
3022
|
+
const PROMISE_ERROR_NAME = "PromiseTimeoutError";
|
|
3023
|
+
const PROMISE_MESSAGE_EXPECTATION_ATTEMPT = "Attempt expected a function or a promise";
|
|
3024
|
+
const PROMISE_MESSAGE_EXPECTATION_ITEMS_TYPE = "promises expected an array or object holding promise-functions or promises";
|
|
3025
|
+
const PROMISE_MESSAGE_EXPECTATION_RESULT = "toResult expected a Promise";
|
|
3026
|
+
const PROMISE_MESSAGE_EXPECTATION_TIMED = "Timed function expected a Promise";
|
|
3027
|
+
const PROMISE_MESSAGE_TIMEOUT = "Promise timed out";
|
|
3028
|
+
const PROMISE_STRATEGY_ALL = /* @__PURE__ */ new Set(["complete", "first"]);
|
|
3029
|
+
const PROMISE_STRATEGY_DEFAULT = "complete";
|
|
3030
|
+
const PROMISE_TYPE_FULFILLED = "fulfilled";
|
|
3031
|
+
const PROMISE_TYPE_REJECTED = "rejected";
|
|
3008
3032
|
//#endregion
|
|
3009
3033
|
//#region src/promise/helpers.ts
|
|
3010
3034
|
function createPromiseOptions(input) {
|
|
@@ -3052,7 +3076,10 @@ function getStrategyOrDefault(value) {
|
|
|
3052
3076
|
* @returns `true` if the value is a fulfilled _Promise_ result, otherwise `false`
|
|
3053
3077
|
*/
|
|
3054
3078
|
function isFulfilled(value) {
|
|
3055
|
-
return
|
|
3079
|
+
return isPromiseResult(value, PROMISE_TYPE_FULFILLED);
|
|
3080
|
+
}
|
|
3081
|
+
function isPromiseResult(value, type) {
|
|
3082
|
+
return isPlainObject(value) && "status" in value && value.status === type;
|
|
3056
3083
|
}
|
|
3057
3084
|
/**
|
|
3058
3085
|
* Is the value a rejected _Promise_ result?
|
|
@@ -3061,10 +3088,7 @@ function isFulfilled(value) {
|
|
|
3061
3088
|
* @returns `true` if the value is a rejected _Promise_ result, otherwise `false`
|
|
3062
3089
|
*/
|
|
3063
3090
|
function isRejected(value) {
|
|
3064
|
-
return
|
|
3065
|
-
}
|
|
3066
|
-
function isType(value, type) {
|
|
3067
|
-
return isPlainObject(value) && "status" in value && value.status === type;
|
|
3091
|
+
return isPromiseResult(value, PROMISE_TYPE_REJECTED);
|
|
3068
3092
|
}
|
|
3069
3093
|
//#endregion
|
|
3070
3094
|
//#region src/promise/misc.ts
|
|
@@ -3081,7 +3105,8 @@ function handleResult(status, parameters) {
|
|
|
3081
3105
|
const { aborter, complete, data, handlers, index, key, value } = parameters;
|
|
3082
3106
|
if (aborter?.signal.aborted ?? false) return;
|
|
3083
3107
|
if (!complete && status === "rejected") {
|
|
3084
|
-
|
|
3108
|
+
aborter?.cancel();
|
|
3109
|
+
handlers.reject(value);
|
|
3085
3110
|
return;
|
|
3086
3111
|
}
|
|
3087
3112
|
data.result[key] = !complete ? value : status === "fulfilled" ? {
|
|
@@ -3091,7 +3116,10 @@ function handleResult(status, parameters) {
|
|
|
3091
3116
|
status,
|
|
3092
3117
|
reason: value
|
|
3093
3118
|
};
|
|
3094
|
-
if (index === data.last)
|
|
3119
|
+
if (index === data.last) {
|
|
3120
|
+
aborter?.cancel();
|
|
3121
|
+
handlers.resolve(data.result);
|
|
3122
|
+
}
|
|
3095
3123
|
}
|
|
3096
3124
|
function settlePromise(settler, value, aborter) {
|
|
3097
3125
|
aborter?.cancel();
|
|
@@ -3219,28 +3247,39 @@ async function resultPromises(items, signal) {
|
|
|
3219
3247
|
promises.result = resultPromises;
|
|
3220
3248
|
//#endregion
|
|
3221
3249
|
//#region src/result/match.ts
|
|
3222
|
-
async function asyncMatchResult(result, first,
|
|
3250
|
+
async function asyncMatchResult(result, first, second) {
|
|
3223
3251
|
let value;
|
|
3224
3252
|
if (typeof result === "function") value = await result();
|
|
3225
3253
|
else if (result instanceof Promise) value = await result;
|
|
3226
3254
|
else value = result;
|
|
3227
|
-
if (!isResult(value)) throw new Error(
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3255
|
+
if (!isResult(value)) throw new Error(MATCH_MESSAGE_RESULT);
|
|
3256
|
+
return handleResult$1(value, first, second);
|
|
3257
|
+
}
|
|
3258
|
+
function handleResult$1(result, first, second) {
|
|
3259
|
+
let error;
|
|
3260
|
+
let ok;
|
|
3261
|
+
if (isPlainObject(first)) {
|
|
3262
|
+
ok = first.ok;
|
|
3263
|
+
error = first.error;
|
|
3264
|
+
} else {
|
|
3265
|
+
ok = first;
|
|
3266
|
+
error = second;
|
|
3267
|
+
}
|
|
3268
|
+
if (isOk(result)) {
|
|
3269
|
+
if (typeof ok !== "function") throw new Error(MATCH_MESSAGE_OK);
|
|
3270
|
+
return ok(result.value);
|
|
3271
|
+
}
|
|
3272
|
+
if (typeof error !== "function") throw new Error(MATCH_MESSAGE_ERROR);
|
|
3273
|
+
return error(result.error, result.original);
|
|
3274
|
+
}
|
|
3275
|
+
function matchResult(result, first, second) {
|
|
3235
3276
|
const value = typeof result === "function" ? result() : result;
|
|
3236
|
-
if (!isResult(value)) throw new Error(
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
}
|
|
3243
|
-
const MATCH_MESSAGE = "`result.match` expected a Result or a function that returns a Result";
|
|
3277
|
+
if (!isResult(value)) throw new Error(MATCH_MESSAGE_RESULT);
|
|
3278
|
+
return handleResult$1(value, first, second);
|
|
3279
|
+
}
|
|
3280
|
+
const MATCH_MESSAGE_ERROR = "`result.match` expected an Error callback";
|
|
3281
|
+
const MATCH_MESSAGE_OK = "`result.match` expected an Ok callback";
|
|
3282
|
+
const MATCH_MESSAGE_RESULT = "`result.match` expected a Result or a function that returns a Result";
|
|
3244
3283
|
matchResult.async = asyncMatchResult;
|
|
3245
3284
|
//#endregion
|
|
3246
3285
|
//#region src/result/work/flow.ts
|
|
@@ -3285,6 +3324,12 @@ function attemptPipe(initial, first, ...seconds) {
|
|
|
3285
3324
|
}
|
|
3286
3325
|
attemptPipe.async = attemptAsyncPipe;
|
|
3287
3326
|
//#endregion
|
|
3327
|
+
//#region src/models/string/string.fuzzy.model.ts
|
|
3328
|
+
const FUZZY_MESSAGE_ARRAY = "Fuzzy requires an array of items";
|
|
3329
|
+
const FUZZY_MESSAGE_HANDLER = "Fuzzy requires a key or function to stringify items";
|
|
3330
|
+
const FUZZY_PROPERTY = "$fuzzy";
|
|
3331
|
+
const FUZZY_SYMBOL = Symbol(FUZZY_PROPERTY);
|
|
3332
|
+
//#endregion
|
|
3288
3333
|
//#region src/string/match.ts
|
|
3289
3334
|
/**
|
|
3290
3335
|
* Check if a string ends with a specified substring
|
|
@@ -3295,7 +3340,7 @@ attemptPipe.async = attemptAsyncPipe;
|
|
|
3295
3340
|
* @returns `true` if the string ends with the given substring, otherwise `false`
|
|
3296
3341
|
*/
|
|
3297
3342
|
function endsWith(haystack, needle, ignoreCase) {
|
|
3298
|
-
return match(
|
|
3343
|
+
return match(STRING_MATCH_ENDS_WITH, haystack, needle, ignoreCase === true);
|
|
3299
3344
|
}
|
|
3300
3345
|
/**
|
|
3301
3346
|
* Check if a string includes a specified substring
|
|
@@ -3306,7 +3351,7 @@ function endsWith(haystack, needle, ignoreCase) {
|
|
|
3306
3351
|
* @returns `true` if the string includes the given substring, otherwise `false`
|
|
3307
3352
|
*/
|
|
3308
3353
|
function includes(haystack, needle, ignoreCase) {
|
|
3309
|
-
return match(
|
|
3354
|
+
return match(STRING_MATCH_INCLUDES, haystack, needle, ignoreCase === true);
|
|
3310
3355
|
}
|
|
3311
3356
|
function match(type, haystack, needle, ignoreCase) {
|
|
3312
3357
|
if (typeof haystack !== "string" || typeof needle !== "string") return false;
|
|
@@ -3325,16 +3370,11 @@ function matchCallback(haystack, needle, ignoreCase) {
|
|
|
3325
3370
|
* @returns `true` if the string starts with the given substring, otherwise `false`
|
|
3326
3371
|
*/
|
|
3327
3372
|
function startsWith(haystack, needle, ignoreCase) {
|
|
3328
|
-
return match(
|
|
3373
|
+
return match(STRING_MATCH_STARTS_WITH, haystack, needle, ignoreCase === true);
|
|
3329
3374
|
}
|
|
3330
|
-
const MATCH_ENDS_WITH = "endsWith";
|
|
3331
|
-
const MATCH_INCLUDES = "includes";
|
|
3332
|
-
const MATCH_STARTS_WITH = "startsWith";
|
|
3333
3375
|
const matchMemoizers = {};
|
|
3334
3376
|
//#endregion
|
|
3335
3377
|
//#region src/string/fuzzy.ts
|
|
3336
|
-
const FUZZY_PROPERTY = "$fuzzy";
|
|
3337
|
-
const FUZZY_SYMBOL = Symbol(FUZZY_PROPERTY);
|
|
3338
3378
|
function Fuzzy(state) {
|
|
3339
3379
|
this[FUZZY_SYMBOL] = state;
|
|
3340
3380
|
}
|
|
@@ -3422,19 +3462,19 @@ function getScore(haystack, needle) {
|
|
|
3422
3462
|
if (haystackIndex === 0) score += 1;
|
|
3423
3463
|
if (previousMatchIndex !== -1) {
|
|
3424
3464
|
const gap = haystackIndex - previousMatchIndex - 1;
|
|
3425
|
-
score += max([0,
|
|
3465
|
+
score += max([0, 5 - gap]);
|
|
3426
3466
|
}
|
|
3427
3467
|
previousMatchIndex = haystackIndex;
|
|
3428
3468
|
needleIndex += 1;
|
|
3429
3469
|
}
|
|
3430
3470
|
if (needleIndex === needleLength) break;
|
|
3431
3471
|
}
|
|
3432
|
-
score -= floor(lowerCaseHaystack.length /
|
|
3472
|
+
score -= floor(lowerCaseHaystack.length / 3);
|
|
3433
3473
|
return max([0, score]);
|
|
3434
3474
|
}
|
|
3435
3475
|
function getTolerance(input, state) {
|
|
3436
3476
|
if (typeof input === "number" && !Number.isNaN(input)) return input < 0 ? 0 : floor(input);
|
|
3437
|
-
return state?.tolerance ??
|
|
3477
|
+
return state?.tolerance ?? 5;
|
|
3438
3478
|
}
|
|
3439
3479
|
/**
|
|
3440
3480
|
* Is the value a fuzzy searcher?
|
|
@@ -3445,7 +3485,7 @@ function getTolerance(input, state) {
|
|
|
3445
3485
|
* @returns `true` if the value is a fuzzy searcher, otherwise `false`
|
|
3446
3486
|
*/
|
|
3447
3487
|
function isFuzzy(value) {
|
|
3448
|
-
return typeof value === "object" && value !== null &&
|
|
3488
|
+
return typeof value === "object" && value !== null && "$fuzzy" in value && value["$fuzzy"] === true;
|
|
3449
3489
|
}
|
|
3450
3490
|
function isSubsequence(haystack, needle) {
|
|
3451
3491
|
const lowerCaseHaystack = lowerCase(haystack);
|
|
@@ -3513,12 +3553,8 @@ function setFuzzyItems(value) {
|
|
|
3513
3553
|
if (!Array.isArray(value)) throw new TypeError(FUZZY_MESSAGE_ARRAY);
|
|
3514
3554
|
const state = this[FUZZY_SYMBOL];
|
|
3515
3555
|
state.items = value.slice();
|
|
3516
|
-
state.strings = value.map(state.handler);
|
|
3556
|
+
state.strings = value.map((item) => state.handler(item));
|
|
3517
3557
|
}
|
|
3518
|
-
const FUZZY_LENGTH_DIVISOR = 3;
|
|
3519
|
-
const FUZZY_MESSAGE_ARRAY = "Fuzzy requires an array of items";
|
|
3520
|
-
const FUZZY_MESSAGE_HANDLER = "Fuzzy requires a key or function to stringify items";
|
|
3521
|
-
const FUZZY_PROXIMITY_THRESHOLD = 5;
|
|
3522
3558
|
fuzzy.is = isFuzzy;
|
|
3523
3559
|
fuzzy.match = fuzzyMatch;
|
|
3524
3560
|
//#endregion
|
|
@@ -3534,7 +3570,7 @@ function dedent(value, ...values) {
|
|
|
3534
3570
|
const lastIndex = length - 1;
|
|
3535
3571
|
const lengths = [];
|
|
3536
3572
|
for (let index = 0; index < length; index += 1) {
|
|
3537
|
-
const [, indentation] =
|
|
3573
|
+
const [, indentation] = STRING_EXPRESSION_WHITESPACE_PREFIX.exec(lines[index]) ?? [];
|
|
3538
3574
|
if (indentation != null) lengths.push(indentation.length);
|
|
3539
3575
|
}
|
|
3540
3576
|
if (lengths.length === 0) return actual.trim();
|
|
@@ -3559,16 +3595,16 @@ function getUuid(html) {
|
|
|
3559
3595
|
crypto.getRandomValues(bytes);
|
|
3560
3596
|
bytes[6] = bytes[6] & 15 | 64;
|
|
3561
3597
|
bytes[8] = bytes[8] & 63 | 128;
|
|
3562
|
-
const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2,
|
|
3598
|
+
const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
3563
3599
|
const first = hex.substring(0, 8);
|
|
3564
|
-
if (forHTML &&
|
|
3600
|
+
if (forHTML && EXPRESSION_NUMERICAL_PREFIX.test(first)) continue;
|
|
3565
3601
|
return [
|
|
3566
3602
|
first,
|
|
3567
3603
|
hex.substring(8, 12),
|
|
3568
3604
|
hex.substring(12, 16),
|
|
3569
3605
|
hex.substring(16, 20),
|
|
3570
3606
|
hex.substring(20, 32)
|
|
3571
|
-
].join(forHTML ?
|
|
3607
|
+
].join(forHTML ? "_" : "-");
|
|
3572
3608
|
}
|
|
3573
3609
|
}
|
|
3574
3610
|
/**
|
|
@@ -3611,17 +3647,51 @@ function truncate(value, length, suffix) {
|
|
|
3611
3647
|
const truncatedLength = length - actualSuffixLength;
|
|
3612
3648
|
return `${value.slice(0, truncatedLength)}${actualSuffix}`;
|
|
3613
3649
|
}
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
const
|
|
3617
|
-
|
|
3650
|
+
//#endregion
|
|
3651
|
+
//#region src/models/string/string.normalize.model.ts
|
|
3652
|
+
const NORMALIZE_DEBURR_CHARACTERS = {
|
|
3653
|
+
Æ: "AE",
|
|
3654
|
+
æ: "ae",
|
|
3655
|
+
Ð: "D",
|
|
3656
|
+
ð: "d",
|
|
3657
|
+
Đ: "D",
|
|
3658
|
+
đ: "d",
|
|
3659
|
+
Ħ: "H",
|
|
3660
|
+
ħ: "h",
|
|
3661
|
+
IJ: "IJ",
|
|
3662
|
+
ij: "ij",
|
|
3663
|
+
İ: "I",
|
|
3664
|
+
ı: "i",
|
|
3665
|
+
ĸ: "k",
|
|
3666
|
+
Ŀ: "L",
|
|
3667
|
+
ŀ: "l",
|
|
3668
|
+
Ł: "L",
|
|
3669
|
+
ł: "l",
|
|
3670
|
+
Ŋ: "N",
|
|
3671
|
+
ŋ: "n",
|
|
3672
|
+
ʼn: "'n",
|
|
3673
|
+
Œ: "OE",
|
|
3674
|
+
œ: "oe",
|
|
3675
|
+
Ø: "O",
|
|
3676
|
+
ø: "o",
|
|
3677
|
+
ſ: "s",
|
|
3678
|
+
ß: "ss",
|
|
3679
|
+
Þ: "TH",
|
|
3680
|
+
þ: "th",
|
|
3681
|
+
Ŧ: "T",
|
|
3682
|
+
ŧ: "t"
|
|
3683
|
+
};
|
|
3684
|
+
const NORMALIZE_DEBURR_PATTERN_CHARACTERS = new RegExp(`(${Object.keys(NORMALIZE_DEBURR_CHARACTERS).join("|")})`, "g");
|
|
3685
|
+
const NORMALIZE_DEBURR_PATTERN_SIMPLE = /[\u0300-\u036f]/g;
|
|
3686
|
+
const NORMALIZE_SPECIAL_PATTERN = /[\p{P}\p{S}]/gu;
|
|
3687
|
+
const NORMALIZE_SYMBOL = Symbol("normalize");
|
|
3618
3688
|
//#endregion
|
|
3619
3689
|
//#region src/string/normalize.ts
|
|
3620
3690
|
function Normalizer(options) {
|
|
3621
3691
|
this[NORMALIZE_SYMBOL] = options;
|
|
3622
3692
|
}
|
|
3623
3693
|
Normalizer.prototype.normalize = normalizeString;
|
|
3624
|
-
function
|
|
3694
|
+
function createNormalizerOptions(input) {
|
|
3625
3695
|
const options = isPlainObject(input) ? input : {};
|
|
3626
3696
|
return {
|
|
3627
3697
|
deburr: options.deburr !== false,
|
|
@@ -3640,7 +3710,7 @@ function createNormalizeOptions(input) {
|
|
|
3640
3710
|
function deburr(value) {
|
|
3641
3711
|
if (typeof value !== "string") return "";
|
|
3642
3712
|
deburrMemoizer ??= memoize((value) => {
|
|
3643
|
-
let deburred = value.normalize(
|
|
3713
|
+
let deburred = value.normalize("NFD").replace(NORMALIZE_DEBURR_PATTERN_SIMPLE, "");
|
|
3644
3714
|
deburred = deburred.replace(NORMALIZE_DEBURR_PATTERN_CHARACTERS, (_, character) => NORMALIZE_DEBURR_CHARACTERS[character]);
|
|
3645
3715
|
return deburred;
|
|
3646
3716
|
});
|
|
@@ -3655,7 +3725,7 @@ function deburr(value) {
|
|
|
3655
3725
|
* @returns Normalizer function
|
|
3656
3726
|
*/
|
|
3657
3727
|
function initializeNormalizer(options) {
|
|
3658
|
-
return new Normalizer(
|
|
3728
|
+
return new Normalizer(createNormalizerOptions(options));
|
|
3659
3729
|
}
|
|
3660
3730
|
/**
|
|
3661
3731
|
* Normalize a string
|
|
@@ -3667,63 +3737,26 @@ function initializeNormalizer(options) {
|
|
|
3667
3737
|
* @returns Normalized string
|
|
3668
3738
|
*/
|
|
3669
3739
|
function normalize(value, options) {
|
|
3670
|
-
return normalizeString.call(
|
|
3740
|
+
return normalizeString.call(createNormalizerOptions(options), value);
|
|
3671
3741
|
}
|
|
3672
3742
|
function normalizeString(value) {
|
|
3673
3743
|
if (typeof value !== "string") return "";
|
|
3674
3744
|
const options = NORMALIZE_SYMBOL in this ? this[NORMALIZE_SYMBOL] : this;
|
|
3675
3745
|
let result = value;
|
|
3676
3746
|
if (options.trim) result = result.trim();
|
|
3677
|
-
if (options.whitespace) result = result.replace(
|
|
3747
|
+
if (options.whitespace) result = result.replace(EXPRESSION_WHITESPACE_MULTIPLE, " ");
|
|
3678
3748
|
if (options.deburr) result = deburr(result);
|
|
3679
3749
|
if (options.lowerCase) result = lowerCase(result);
|
|
3680
|
-
if (options.special) result = result.replace(NORMALIZE_SPECIAL_PATTERN,
|
|
3681
|
-
return result.normalize(
|
|
3750
|
+
if (options.special) result = result.replace(NORMALIZE_SPECIAL_PATTERN, "");
|
|
3751
|
+
return result.normalize("NFC");
|
|
3682
3752
|
}
|
|
3683
|
-
const NORMALIZE_DEBURR_CHARACTERS = {
|
|
3684
|
-
Æ: "AE",
|
|
3685
|
-
æ: "ae",
|
|
3686
|
-
Ð: "D",
|
|
3687
|
-
ð: "d",
|
|
3688
|
-
Đ: "D",
|
|
3689
|
-
đ: "d",
|
|
3690
|
-
Ħ: "H",
|
|
3691
|
-
ħ: "h",
|
|
3692
|
-
IJ: "IJ",
|
|
3693
|
-
ij: "ij",
|
|
3694
|
-
İ: "I",
|
|
3695
|
-
ı: "i",
|
|
3696
|
-
ĸ: "k",
|
|
3697
|
-
Ŀ: "L",
|
|
3698
|
-
ŀ: "l",
|
|
3699
|
-
Ł: "L",
|
|
3700
|
-
ł: "l",
|
|
3701
|
-
Ŋ: "N",
|
|
3702
|
-
ŋ: "n",
|
|
3703
|
-
ʼn: "'n",
|
|
3704
|
-
Œ: "OE",
|
|
3705
|
-
œ: "oe",
|
|
3706
|
-
Ø: "O",
|
|
3707
|
-
ø: "o",
|
|
3708
|
-
ſ: "s",
|
|
3709
|
-
ß: "ss",
|
|
3710
|
-
Þ: "TH",
|
|
3711
|
-
þ: "th",
|
|
3712
|
-
Ŧ: "T",
|
|
3713
|
-
ŧ: "t"
|
|
3714
|
-
};
|
|
3715
|
-
const NORMALIZE_DEBURR_NORMALIZATION = "NFD";
|
|
3716
|
-
const NORMALIZE_DEBURR_PATTERN_CHARACTERS = new RegExp(`(${Object.keys(NORMALIZE_DEBURR_CHARACTERS).join("|")})`, "g");
|
|
3717
|
-
const NORMALIZE_DEBURR_PATTERN_SIMPLE = /[\u0300-\u036f]/g;
|
|
3718
|
-
const NORMALIZE_NORMALIZATION_NORMALIZATION = "NFC";
|
|
3719
|
-
const NORMALIZE_SPECIAL_PATTERN = /[\p{P}\p{S}]/gu;
|
|
3720
|
-
const NORMALIZE_SPECIAL_REPLACEMENT = "";
|
|
3721
|
-
const NORMALIZE_SYMBOL = Symbol("normalize");
|
|
3722
|
-
const NORMALIZE_WHITESPACE_PATTERN = /\s+/g;
|
|
3723
|
-
const NORMALIZE_WHITESPACE_REPLACEMENT = " ";
|
|
3724
3753
|
let deburrMemoizer;
|
|
3725
3754
|
normalize.initialize = initializeNormalizer;
|
|
3726
3755
|
//#endregion
|
|
3756
|
+
//#region src/models/string/string.template.model.ts
|
|
3757
|
+
const TEMPLATE_EXPRESSION_VARIABLE = /{{([\s\S]+?)}}/g;
|
|
3758
|
+
const TEMPLATE_SYMBOL = Symbol("template");
|
|
3759
|
+
//#endregion
|
|
3727
3760
|
//#region src/string/template.ts
|
|
3728
3761
|
function Templater(options) {
|
|
3729
3762
|
this[TEMPLATE_SYMBOL] = options;
|
|
@@ -3774,12 +3807,31 @@ function template(value, ...parameters) {
|
|
|
3774
3807
|
const { ignoreCase, pattern } = createTemplateOptions(parameters[1]);
|
|
3775
3808
|
return handleTemplate(value, pattern, ignoreCase, parameters[0]);
|
|
3776
3809
|
}
|
|
3777
|
-
const TEMPLATE_EXPRESSION_VARIABLE = /{{([\s\S]+?)}}/g;
|
|
3778
|
-
const TEMPLATE_SYMBOL = Symbol("template");
|
|
3779
3810
|
template.initialize = initializeTemplater;
|
|
3780
3811
|
//#endregion
|
|
3781
|
-
//#region src/value/clone.ts
|
|
3812
|
+
//#region src/models/value/value.clone.model.ts
|
|
3782
3813
|
const CLONE_NAME = "clone";
|
|
3814
|
+
const CLONE_COPY_OPTIONS = {
|
|
3815
|
+
copyFunctions: true,
|
|
3816
|
+
copySymbols: true
|
|
3817
|
+
};
|
|
3818
|
+
const CLONE_DEFAULT_OPTIONS = {
|
|
3819
|
+
copyFunctions: false,
|
|
3820
|
+
copySymbols: false
|
|
3821
|
+
};
|
|
3822
|
+
const CLONE_PRIMITIVES = {
|
|
3823
|
+
bigint: true,
|
|
3824
|
+
boolean: true,
|
|
3825
|
+
function: false,
|
|
3826
|
+
number: true,
|
|
3827
|
+
object: false,
|
|
3828
|
+
string: true,
|
|
3829
|
+
symbol: false,
|
|
3830
|
+
undefined: true
|
|
3831
|
+
};
|
|
3832
|
+
const CLONE_SYMBOL = Symbol(CLONE_NAME);
|
|
3833
|
+
//#endregion
|
|
3834
|
+
//#region src/value/clone.ts
|
|
3783
3835
|
function Cloner(options) {
|
|
3784
3836
|
this[CLONE_SYMBOL] = options;
|
|
3785
3837
|
}
|
|
@@ -3816,14 +3868,14 @@ function cloneAny(value, parameters, depth, options) {
|
|
|
3816
3868
|
}
|
|
3817
3869
|
}
|
|
3818
3870
|
function cloneArrayBuffer(value, parameters, depth) {
|
|
3819
|
-
if (parameters.copy || depth >=
|
|
3871
|
+
if (parameters.copy || depth >= 100) return value;
|
|
3820
3872
|
const cloned = new ArrayBuffer(value.byteLength);
|
|
3821
3873
|
new Uint8Array(cloned).set(new Uint8Array(value));
|
|
3822
3874
|
parameters.references.set(value, cloned);
|
|
3823
3875
|
return cloned;
|
|
3824
3876
|
}
|
|
3825
3877
|
function cloneDataView(value, parameters, depth) {
|
|
3826
|
-
if (parameters.copy || depth >=
|
|
3878
|
+
if (parameters.copy || depth >= 100) return value;
|
|
3827
3879
|
const buffer = cloneArrayBuffer(value.buffer, parameters, depth);
|
|
3828
3880
|
const cloned = new DataView(buffer, value.byteOffset, value.byteLength);
|
|
3829
3881
|
parameters.references.set(value, cloned);
|
|
@@ -3836,7 +3888,7 @@ function cloneFromCloner(value) {
|
|
|
3836
3888
|
}, 0);
|
|
3837
3889
|
}
|
|
3838
3890
|
function cloneMap(map, parameters, depth) {
|
|
3839
|
-
if (depth >=
|
|
3891
|
+
if (depth >= 100) return map;
|
|
3840
3892
|
if (parameters.copy) return new Map(map);
|
|
3841
3893
|
const cloned = /* @__PURE__ */ new Map();
|
|
3842
3894
|
for (const [key, value] of map.entries()) cloned.set(cloneAny(key, parameters, depth + 1), cloneAny(value, parameters, depth + 1));
|
|
@@ -3844,13 +3896,13 @@ function cloneMap(map, parameters, depth) {
|
|
|
3844
3896
|
return cloned;
|
|
3845
3897
|
}
|
|
3846
3898
|
function cloneNode(node, parameters, depth) {
|
|
3847
|
-
if (parameters.copy || depth >=
|
|
3899
|
+
if (parameters.copy || depth >= 100) return node;
|
|
3848
3900
|
const cloned = node.cloneNode(true);
|
|
3849
3901
|
parameters.references.set(node, cloned);
|
|
3850
3902
|
return cloned;
|
|
3851
3903
|
}
|
|
3852
3904
|
function cloneObject(value, parameters, depth) {
|
|
3853
|
-
if (depth >=
|
|
3905
|
+
if (depth >= 100) return value;
|
|
3854
3906
|
const isArray = Array.isArray(value);
|
|
3855
3907
|
if (parameters.copy) return isArray ? value.slice() : { ...value };
|
|
3856
3908
|
const cloned = isArray ? [] : {};
|
|
@@ -3864,14 +3916,14 @@ function cloneObject(value, parameters, depth) {
|
|
|
3864
3916
|
return cloned;
|
|
3865
3917
|
}
|
|
3866
3918
|
function cloneRegularExpression(value, parameters, depth) {
|
|
3867
|
-
if (parameters.copy || depth >=
|
|
3919
|
+
if (parameters.copy || depth >= 100) return value;
|
|
3868
3920
|
const cloned = new RegExp(value.source, value.flags);
|
|
3869
3921
|
cloned.lastIndex = value.lastIndex;
|
|
3870
3922
|
parameters.references.set(value, cloned);
|
|
3871
3923
|
return cloned;
|
|
3872
3924
|
}
|
|
3873
3925
|
function cloneSet(set, parameters, depth) {
|
|
3874
|
-
if (depth >=
|
|
3926
|
+
if (depth >= 100) return set;
|
|
3875
3927
|
if (parameters.copy) return new Set(set);
|
|
3876
3928
|
const cloned = /* @__PURE__ */ new Set();
|
|
3877
3929
|
for (const value of set.values()) cloned.add(cloneAny(value, parameters, depth + 1));
|
|
@@ -3879,7 +3931,7 @@ function cloneSet(set, parameters, depth) {
|
|
|
3879
3931
|
return cloned;
|
|
3880
3932
|
}
|
|
3881
3933
|
function cloneTypedArray(value, parameters, depth) {
|
|
3882
|
-
if (parameters.copy || depth >=
|
|
3934
|
+
if (parameters.copy || depth >= 100) return value;
|
|
3883
3935
|
const cloned = new value.constructor(value);
|
|
3884
3936
|
parameters.references.set(value, cloned);
|
|
3885
3937
|
return cloned;
|
|
@@ -3931,35 +3983,15 @@ function registerCloner(constructor, handler) {
|
|
|
3931
3983
|
cloneHandler.base.register(constructor, handler);
|
|
3932
3984
|
}
|
|
3933
3985
|
function tryStructuredClone(value, parameters, depth) {
|
|
3934
|
-
if (depth >=
|
|
3986
|
+
if (depth >= 100) return value;
|
|
3935
3987
|
const cloned = unwrap(attempt(() => structuredClone(value)), value);
|
|
3936
3988
|
parameters.references.set(value, cloned);
|
|
3937
3989
|
return cloned;
|
|
3938
3990
|
}
|
|
3939
|
-
const CLONE_COPY_OPTIONS = {
|
|
3940
|
-
copyFunctions: true,
|
|
3941
|
-
copySymbols: true
|
|
3942
|
-
};
|
|
3943
|
-
const CLONE_DEFAULT_OPTIONS = {
|
|
3944
|
-
copyFunctions: false,
|
|
3945
|
-
copySymbols: false
|
|
3946
|
-
};
|
|
3947
|
-
const CLONE_MAX_DEPTH = 100;
|
|
3948
3991
|
const cloneHandler = createValueHandler(clone, {
|
|
3949
3992
|
callback: tryStructuredClone,
|
|
3950
3993
|
method: CLONE_NAME
|
|
3951
3994
|
});
|
|
3952
|
-
const CLONE_PRIMITIVES = {
|
|
3953
|
-
bigint: true,
|
|
3954
|
-
boolean: true,
|
|
3955
|
-
function: false,
|
|
3956
|
-
number: true,
|
|
3957
|
-
object: false,
|
|
3958
|
-
string: true,
|
|
3959
|
-
symbol: false,
|
|
3960
|
-
undefined: true
|
|
3961
|
-
};
|
|
3962
|
-
const CLONE_SYMBOL = Symbol(CLONE_NAME);
|
|
3963
3995
|
clone.deregister = deregisterCloner;
|
|
3964
3996
|
clone.handlers = cloneHandler;
|
|
3965
3997
|
clone.initialize = initializeCloner;
|
|
@@ -3984,10 +4016,16 @@ function inMap(map, value, key) {
|
|
|
3984
4016
|
function inSet(set, value) {
|
|
3985
4017
|
if (!(set instanceof Set)) return false;
|
|
3986
4018
|
if (set.has(value)) return true;
|
|
4019
|
+
if (isPrimitive(value)) return false;
|
|
3987
4020
|
for (const item of set) if (equal(item, value)) return true;
|
|
3988
4021
|
return false;
|
|
3989
4022
|
}
|
|
3990
4023
|
//#endregion
|
|
4024
|
+
//#region src/models/value/value.diff.model.ts
|
|
4025
|
+
const DIFF_FULL = "full";
|
|
4026
|
+
const DIFF_NONE = "none";
|
|
4027
|
+
const DIFF_PARTIAL = "partial";
|
|
4028
|
+
//#endregion
|
|
3991
4029
|
//#region src/value/diff.ts
|
|
3992
4030
|
/**
|
|
3993
4031
|
* Find the differences between two values
|
|
@@ -4087,9 +4125,6 @@ function setChanges(parameters) {
|
|
|
4087
4125
|
const diffsLength = diffs.length;
|
|
4088
4126
|
for (let diffIndex = 0; diffIndex < diffsLength; diffIndex += 1) changes.push(diffs[diffIndex]);
|
|
4089
4127
|
}
|
|
4090
|
-
const DIFF_FULL = "full";
|
|
4091
|
-
const DIFF_NONE = "none";
|
|
4092
|
-
const DIFF_PARTIAL = "partial";
|
|
4093
4128
|
//#endregion
|
|
4094
4129
|
//#region src/value/freeze.ts
|
|
4095
4130
|
function fakeDelete() {
|
|
@@ -4231,7 +4266,7 @@ function shake(value) {
|
|
|
4231
4266
|
//#endregion
|
|
4232
4267
|
//#region src/value/smush.ts
|
|
4233
4268
|
function flattenObject(value, depth, smushed, prefix) {
|
|
4234
|
-
if (depth >=
|
|
4269
|
+
if (depth >= 100) return {};
|
|
4235
4270
|
if (smushed.has(value)) return smushed.get(value);
|
|
4236
4271
|
const keys = Object.keys(value);
|
|
4237
4272
|
const { length } = keys;
|
|
@@ -4263,7 +4298,6 @@ function flattenObject(value, depth, smushed, prefix) {
|
|
|
4263
4298
|
function smush(value) {
|
|
4264
4299
|
return typeof value === "object" && value !== null ? flattenObject(value, 0, /* @__PURE__ */ new WeakMap()) : {};
|
|
4265
4300
|
}
|
|
4266
|
-
const SMUSH_MAX_DEPTH = 100;
|
|
4267
4301
|
//#endregion
|
|
4268
4302
|
//#region src/value/unsmush.ts
|
|
4269
4303
|
function getKeys(value) {
|
|
@@ -4300,6 +4334,10 @@ function unsmush(value) {
|
|
|
4300
4334
|
return unsmushed;
|
|
4301
4335
|
}
|
|
4302
4336
|
//#endregion
|
|
4337
|
+
//#region src/models/value/value.merge.model.ts
|
|
4338
|
+
const MERGE_SYMBOL_ASSIGN = Symbol("assign");
|
|
4339
|
+
const MERGE_SYMBOL_MERGE = Symbol("merge");
|
|
4340
|
+
//#endregion
|
|
4303
4341
|
//#region src/value/merge.ts
|
|
4304
4342
|
function Assigner(options) {
|
|
4305
4343
|
this[MERGE_SYMBOL_ASSIGN] = {
|
|
@@ -4321,21 +4359,22 @@ Merger.prototype.merge = mergeFromMerger;
|
|
|
4321
4359
|
* @returns Assigned value
|
|
4322
4360
|
*/
|
|
4323
4361
|
function assign(to, from, options) {
|
|
4324
|
-
const actual =
|
|
4362
|
+
const actual = createMergingOptions(options);
|
|
4325
4363
|
actual.assignValues = true;
|
|
4326
4364
|
return mergeValues([to, ...from], actual);
|
|
4327
4365
|
}
|
|
4328
4366
|
function assignFromAssigner(to, from) {
|
|
4329
4367
|
return mergeValues([to, ...from], this[MERGE_SYMBOL_ASSIGN]);
|
|
4330
4368
|
}
|
|
4331
|
-
function
|
|
4369
|
+
function createMergingOptions(input) {
|
|
4332
4370
|
const actual = {
|
|
4333
4371
|
assignValues: false,
|
|
4334
4372
|
replaceableObjects: void 0,
|
|
4335
4373
|
skipNullableAny: false,
|
|
4336
4374
|
skipNullableInArrays: false
|
|
4337
4375
|
};
|
|
4338
|
-
if (typeof
|
|
4376
|
+
if (typeof input !== "object" || input == null) return actual;
|
|
4377
|
+
const options = input;
|
|
4339
4378
|
actual.replaceableObjects = getReplaceableObjects(options.replaceableObjects);
|
|
4340
4379
|
actual.assignValues = options.assignValues === true;
|
|
4341
4380
|
actual.skipNullableAny = options.skipNullableAny === true;
|
|
@@ -4356,7 +4395,7 @@ function getReplaceableObjects(value) {
|
|
|
4356
4395
|
* @returns Assigner function
|
|
4357
4396
|
*/
|
|
4358
4397
|
function initializeAssigner(options) {
|
|
4359
|
-
return new Assigner(
|
|
4398
|
+
return new Assigner(createMergingOptions(options));
|
|
4360
4399
|
}
|
|
4361
4400
|
/**
|
|
4362
4401
|
* Create a merger with predefined options
|
|
@@ -4367,7 +4406,7 @@ function initializeAssigner(options) {
|
|
|
4367
4406
|
* @returns Merger function
|
|
4368
4407
|
*/
|
|
4369
4408
|
function initializeMerger(options) {
|
|
4370
|
-
return new Merger(
|
|
4409
|
+
return new Merger(createMergingOptions(options));
|
|
4371
4410
|
}
|
|
4372
4411
|
/**
|
|
4373
4412
|
* Merge multiple arrays or objects into a single one
|
|
@@ -4377,7 +4416,7 @@ function initializeMerger(options) {
|
|
|
4377
4416
|
* @returns Merged value
|
|
4378
4417
|
*/
|
|
4379
4418
|
function merge(values, options) {
|
|
4380
|
-
return mergeValues(values,
|
|
4419
|
+
return mergeValues(values, createMergingOptions(options));
|
|
4381
4420
|
}
|
|
4382
4421
|
function mergeFromMerger(values) {
|
|
4383
4422
|
return mergeValues(values, this[MERGE_SYMBOL_MERGE]);
|
|
@@ -4411,11 +4450,12 @@ function mergeValues(values, options, prefix) {
|
|
|
4411
4450
|
if (actual.length > 1) return mergeObjects(actual, options, options.assignValues ? actual[0] : void 0, prefix);
|
|
4412
4451
|
return options.assignValues ? actual[0] : Array.isArray(actual[0]) ? actual[0].slice() : { ...actual[0] };
|
|
4413
4452
|
}
|
|
4414
|
-
const MERGE_SYMBOL_ASSIGN = Symbol("assign");
|
|
4415
|
-
const MERGE_SYMBOL_MERGE = Symbol("merge");
|
|
4416
4453
|
assign.initialize = initializeAssigner;
|
|
4417
4454
|
merge.initialize = initializeMerger;
|
|
4418
4455
|
//#endregion
|
|
4456
|
+
//#region src/models/value/value.transform.model.ts
|
|
4457
|
+
const TRANSFORM_SYMBOL = Symbol("transform");
|
|
4458
|
+
//#endregion
|
|
4419
4459
|
//#region src/value/transform.ts
|
|
4420
4460
|
function Transformer(transformer) {
|
|
4421
4461
|
this[TRANSFORM_SYMBOL] = transformer;
|
|
@@ -4454,13 +4494,18 @@ function transformValue(value) {
|
|
|
4454
4494
|
}
|
|
4455
4495
|
return value;
|
|
4456
4496
|
}
|
|
4457
|
-
const TRANSFORM_SYMBOL = Symbol("transform");
|
|
4458
4497
|
transform.initialize = initializeTransformer;
|
|
4459
4498
|
//#endregion
|
|
4460
|
-
//#region src/
|
|
4499
|
+
//#region src/models/subscription.model.ts
|
|
4500
|
+
const SUBSCRIPTION_DISALLOWED_KEY = "Disallowed key for subscription";
|
|
4501
|
+
const SUBSCRIPTION_INVALID_KEY = "Invalid key for subscription";
|
|
4502
|
+
const SUBSCRIPTION_INVALID_VALUE = "A subscription requires a non-null value to identify it";
|
|
4461
4503
|
const SUBSCRIPTION_NAME = "subscription";
|
|
4462
4504
|
const SUBSCRIPTION_PROPERTY = "$subscription";
|
|
4463
4505
|
const SUBSCRIPTION_STORE = "subscriptions";
|
|
4506
|
+
const SUBSCRIPTION_SYMBOL = Symbol(SUBSCRIPTION_PROPERTY);
|
|
4507
|
+
//#endregion
|
|
4508
|
+
//#region src/internal/subscription.ts
|
|
4464
4509
|
function Subscription(state, property, parameters) {
|
|
4465
4510
|
this[SUBSCRIPTION_SYMBOL] = state;
|
|
4466
4511
|
this[property.key] = property.value;
|
|
@@ -4617,7 +4662,7 @@ function isSubscription(value) {
|
|
|
4617
4662
|
return isSubscriptionInstance(value, SUBSCRIPTION_NAME);
|
|
4618
4663
|
}
|
|
4619
4664
|
function isSubscriptionInstance(value, name) {
|
|
4620
|
-
return typeof value === "object" && value !== null &&
|
|
4665
|
+
return typeof value === "object" && value !== null && "$subscription" in value && value["$subscription"] === name;
|
|
4621
4666
|
}
|
|
4622
4667
|
/**
|
|
4623
4668
|
* Is the value a subscriptions store?
|
|
@@ -4668,15 +4713,22 @@ function removeSubscription() {
|
|
|
4668
4713
|
function subscriptions(parameters) {
|
|
4669
4714
|
return new Subscriptions(parameters);
|
|
4670
4715
|
}
|
|
4671
|
-
const SUBSCRIPTION_DISALLOWED_KEY = "Disallowed key for subscription";
|
|
4672
|
-
const SUBSCRIPTION_INVALID_KEY = "Invalid key for subscription";
|
|
4673
|
-
const SUBSCRIPTION_INVALID_VALUE = "A subscription requires a non-null value to identify it";
|
|
4674
|
-
const SUBSCRIPTION_SYMBOL = Symbol(SUBSCRIPTION_PROPERTY);
|
|
4675
4716
|
//#endregion
|
|
4676
|
-
//#region src/beacon.ts
|
|
4717
|
+
//#region src/models/beacon.model.ts
|
|
4718
|
+
const BEACON_MESSAGE_RETRIEVE = "Cannot retrieve observable from a closed beacon";
|
|
4719
|
+
const BEACON_MESSAGE_SUBSCRIBE = "Cannot subscribe to a closed observable";
|
|
4677
4720
|
const BEACON_PROPERTY = "$beacon";
|
|
4678
4721
|
const BEACON_NAME = "beacon";
|
|
4679
4722
|
const BEACON_OBSERVABLE = "observable";
|
|
4723
|
+
const BEACON_SYMBOL = Symbol(BEACON_PROPERTY);
|
|
4724
|
+
const BEACON_TYPE_ERROR = "error";
|
|
4725
|
+
const BEACON_TYPE_NEXT = "next";
|
|
4726
|
+
const beaconSubscription = {
|
|
4727
|
+
key: BEACON_PROPERTY,
|
|
4728
|
+
value: SUBSCRIPTION_NAME
|
|
4729
|
+
};
|
|
4730
|
+
//#endregion
|
|
4731
|
+
//#region src/beacon.ts
|
|
4680
4732
|
function Beacon(value, options) {
|
|
4681
4733
|
this[BEACON_SYMBOL] = {
|
|
4682
4734
|
value,
|
|
@@ -4800,7 +4852,7 @@ function isBeacon(value) {
|
|
|
4800
4852
|
return isBeaconInstance(BEACON_NAME, value);
|
|
4801
4853
|
}
|
|
4802
4854
|
function isBeaconInstance(name, value) {
|
|
4803
|
-
return typeof value === "object" && value !== null &&
|
|
4855
|
+
return typeof value === "object" && value !== null && "$beacon" in value && value["$beacon"] === name;
|
|
4804
4856
|
}
|
|
4805
4857
|
/**
|
|
4806
4858
|
* Is the value a beacon subscription?
|
|
@@ -4809,7 +4861,7 @@ function isBeaconInstance(name, value) {
|
|
|
4809
4861
|
* @returns `true` if the value is a beacon subscription, otherwise `false`
|
|
4810
4862
|
*/
|
|
4811
4863
|
function isBeaconSubscription(value) {
|
|
4812
|
-
return isSubscription(value) && value[
|
|
4864
|
+
return isSubscription(value) && value["$beacon"] === "subscription";
|
|
4813
4865
|
}
|
|
4814
4866
|
/**
|
|
4815
4867
|
* Is the value an observable?
|
|
@@ -4835,7 +4887,7 @@ function subscribeToObservable(first, second, third) {
|
|
|
4835
4887
|
function updateBeacon(instance, type, value, finish) {
|
|
4836
4888
|
const state = instance[BEACON_SYMBOL];
|
|
4837
4889
|
if (!state.active) return;
|
|
4838
|
-
if (type ===
|
|
4890
|
+
if (type === "next") {
|
|
4839
4891
|
if (state.options.equal(state.value, value)) return;
|
|
4840
4892
|
state.value = value;
|
|
4841
4893
|
}
|
|
@@ -4843,17 +4895,8 @@ function updateBeacon(instance, type, value, finish) {
|
|
|
4843
4895
|
if (subscriptions != null && subscriptions.size > 0) for (const [, observer] of subscriptions) observer[type]?.(value);
|
|
4844
4896
|
if (finish === true) closeBeacon(state, true);
|
|
4845
4897
|
}
|
|
4846
|
-
const BEACON_MESSAGE_RETRIEVE = "Cannot retrieve observable from a closed beacon";
|
|
4847
|
-
const BEACON_MESSAGE_SUBSCRIBE = "Cannot subscribe to a closed observable";
|
|
4848
|
-
const BEACON_SYMBOL = Symbol(BEACON_PROPERTY);
|
|
4849
|
-
const BEACON_TYPE_ERROR = "error";
|
|
4850
|
-
const BEACON_TYPE_NEXT = "next";
|
|
4851
|
-
const beaconSubscription = {
|
|
4852
|
-
key: BEACON_PROPERTY,
|
|
4853
|
-
value: SUBSCRIPTION_NAME
|
|
4854
|
-
};
|
|
4855
4898
|
//#endregion
|
|
4856
|
-
//#region src/
|
|
4899
|
+
//#region src/models/herald.model.ts
|
|
4857
4900
|
const HERALD_MESSAGE_ARRAY = "Herald requires an array of event names.";
|
|
4858
4901
|
const HERALD_MESSAGE_ONCREATE = `Herald requires a valid onCreate callback for subscription creation`;
|
|
4859
4902
|
const HERALD_MESSAGE_PROPERTY = `Herald requires valid property information for subscription identification`;
|
|
@@ -6266,7 +6309,7 @@ function isNonNullableOrEmpty(value) {
|
|
|
6266
6309
|
* @returns `true` if the value is not `undefined`, `null`, or matches a whitespace-only string, otherwise `false`
|
|
6267
6310
|
*/
|
|
6268
6311
|
function isNonNullableOrWhitespace(value) {
|
|
6269
|
-
return value != null && !
|
|
6312
|
+
return value != null && !EXPRESSION_WHITESPACE_ONLY.test(getString(value));
|
|
6270
6313
|
}
|
|
6271
6314
|
/**
|
|
6272
6315
|
* Is the value not a number or a number-like string?
|
|
@@ -6311,7 +6354,7 @@ function isNullableOrEmpty(value) {
|
|
|
6311
6354
|
* @returns `true` if the value is nullable or matches a whitespace-only string, otherwise `false`
|
|
6312
6355
|
*/
|
|
6313
6356
|
function isNullableOrWhitespace(value) {
|
|
6314
|
-
return value == null ||
|
|
6357
|
+
return value == null || EXPRESSION_WHITESPACE_ONLY.test(getString(value));
|
|
6315
6358
|
}
|
|
6316
6359
|
/**
|
|
6317
6360
|
* Is the value a number or a number-like string?
|
|
@@ -6331,12 +6374,14 @@ function isNumerical(value) {
|
|
|
6331
6374
|
function isObject(value) {
|
|
6332
6375
|
return typeof value === "object" && value !== null || typeof value === "function";
|
|
6333
6376
|
}
|
|
6334
|
-
const EXPRESSION_WHITESPACE = /^\s*$/;
|
|
6335
6377
|
//#endregion
|
|
6336
|
-
//#region src/logger.ts
|
|
6378
|
+
//#region src/models/logger.model.ts
|
|
6337
6379
|
const LOGGER_NAME = "Logger";
|
|
6338
6380
|
const LOGGER_NAME_TIMED = "TimedLogger";
|
|
6339
6381
|
const LOGGER_PROPERTY = "$logger";
|
|
6382
|
+
const LOGGER_SYMBOL = Symbol(LOGGER_PROPERTY);
|
|
6383
|
+
//#endregion
|
|
6384
|
+
//#region src/logger.ts
|
|
6340
6385
|
function Lumberjack() {}
|
|
6341
6386
|
Lumberjack.prototype[LOGGER_PROPERTY] = LOGGER_NAME;
|
|
6342
6387
|
Lumberjack.prototype.time = getTimeLogger;
|
|
@@ -6403,7 +6448,7 @@ function isLogger(value) {
|
|
|
6403
6448
|
return isLoggerInstance(LOGGER_NAME, value);
|
|
6404
6449
|
}
|
|
6405
6450
|
function isLoggerInstance(name, value) {
|
|
6406
|
-
return typeof value === "object" && value !== null &&
|
|
6451
|
+
return typeof value === "object" && value !== null && "$logger" in value && value["$logger"] === name;
|
|
6407
6452
|
}
|
|
6408
6453
|
function isTimeLogger(value) {
|
|
6409
6454
|
return isLoggerInstance(LOGGER_NAME_TIMED, value);
|
|
@@ -6411,7 +6456,6 @@ function isTimeLogger(value) {
|
|
|
6411
6456
|
function setLoggerEnabled(value) {
|
|
6412
6457
|
enabled = typeof value === "boolean" ? value : enabled;
|
|
6413
6458
|
}
|
|
6414
|
-
const LOGGER_SYMBOL = Symbol(LOGGER_PROPERTY);
|
|
6415
6459
|
/**
|
|
6416
6460
|
* A logger that can be used to log messages to the console
|
|
6417
6461
|
*
|
|
@@ -6467,6 +6511,16 @@ function sum(array, key) {
|
|
|
6467
6511
|
return getAggregated("sum", array, key);
|
|
6468
6512
|
}
|
|
6469
6513
|
//#endregion
|
|
6514
|
+
//#region src/models/query.model.ts
|
|
6515
|
+
const QUERY_EXPRESSION_ARRAY_SUFFIX = /\[\]$/;
|
|
6516
|
+
const QUERY_EXPRESSION_BOOLEAN = /^(false|true)$/;
|
|
6517
|
+
const QUERY_TRUE = "true";
|
|
6518
|
+
const QUERY_TYPES = /* @__PURE__ */ new Set([
|
|
6519
|
+
"boolean",
|
|
6520
|
+
"number",
|
|
6521
|
+
"string"
|
|
6522
|
+
]);
|
|
6523
|
+
//#endregion
|
|
6470
6524
|
//#region src/query.ts
|
|
6471
6525
|
/**
|
|
6472
6526
|
* Convert a query string to a plain _(nested)_ object
|
|
@@ -6476,7 +6530,7 @@ function sum(array, key) {
|
|
|
6476
6530
|
*/
|
|
6477
6531
|
function fromQuery(query) {
|
|
6478
6532
|
if (typeof query !== "string" || query.trim().length === 0) return {};
|
|
6479
|
-
const parts = query.split(
|
|
6533
|
+
const parts = query.split("&").map((part) => part.split("=").map(tryDecode)).sort(([first], [second]) => first.localeCompare(second));
|
|
6480
6534
|
const { length } = parts;
|
|
6481
6535
|
const parameters = {};
|
|
6482
6536
|
let position = 0;
|
|
@@ -6506,9 +6560,9 @@ function getParts(value, fromArray, prefix) {
|
|
|
6506
6560
|
for (let index = 0; index < length; index += 1) {
|
|
6507
6561
|
const key = keys[index];
|
|
6508
6562
|
const val = value[key];
|
|
6509
|
-
const fullKey = join([prefix, fromArray ? void 0 : key],
|
|
6563
|
+
const fullKey = join([prefix, fromArray ? void 0 : key], ".");
|
|
6510
6564
|
const encodedKey = getString(tryEncode(fullKey));
|
|
6511
|
-
const prefixedKey = fromArray ? join([encodedKey, index],
|
|
6565
|
+
const prefixedKey = fromArray ? join([encodedKey, index], ".") : encodedKey;
|
|
6512
6566
|
if (Array.isArray(val)) parts.push(...getParts(val, true, fullKey));
|
|
6513
6567
|
else if (isPlainObject(val)) parts.push(...getParts(val, false, fullKey));
|
|
6514
6568
|
else if (isDecodable(val)) parts.push(`${prefixedKey}=${getString(tryEncode(val))}`);
|
|
@@ -6535,24 +6589,10 @@ function isDecodable(value) {
|
|
|
6535
6589
|
* @returns Query string representation of the object
|
|
6536
6590
|
*/
|
|
6537
6591
|
function toQuery(parameters) {
|
|
6538
|
-
return isPlainObject(parameters) ? join(getParts(parameters, false).filter((part) => part.length > 0),
|
|
6592
|
+
return isPlainObject(parameters) ? join(getParts(parameters, false).filter((part) => part.length > 0), "&") : "";
|
|
6539
6593
|
}
|
|
6540
|
-
const QUERY_AMPERSAND = "&";
|
|
6541
|
-
const QUERY_DOT = ".";
|
|
6542
|
-
const QUERY_EQUAL = "=";
|
|
6543
|
-
const QUERY_EXPRESSION_ARRAY_SUFFIX = /\[\]$/;
|
|
6544
|
-
const QUERY_EXPRESSION_BOOLEAN = /^(false|true)$/;
|
|
6545
|
-
const QUERY_TRUE = "true";
|
|
6546
|
-
const QUERY_TYPES = /* @__PURE__ */ new Set([
|
|
6547
|
-
"boolean",
|
|
6548
|
-
"number",
|
|
6549
|
-
"string"
|
|
6550
|
-
]);
|
|
6551
6594
|
//#endregion
|
|
6552
|
-
//#region src/queue.ts
|
|
6553
|
-
const QUEUE_NAME_KEYED = "keyedQueue";
|
|
6554
|
-
const QUEUE_NAME_QUEUE = "queue";
|
|
6555
|
-
const QUEUE_PROPERTY = "$queue";
|
|
6595
|
+
//#region src/models/queue.model.ts
|
|
6556
6596
|
/**
|
|
6557
6597
|
* An error thrown by the Queue when an operation fails
|
|
6558
6598
|
*/
|
|
@@ -6562,6 +6602,25 @@ var QueueError = class extends Error {
|
|
|
6562
6602
|
this.name = QUEUE_ERROR_NAME;
|
|
6563
6603
|
}
|
|
6564
6604
|
};
|
|
6605
|
+
const QUEUE_ERROR_NAME = "QueueError";
|
|
6606
|
+
const QUEUE_HANDLE_CLEAR = "clear";
|
|
6607
|
+
const QUEUE_HANDLE_PAUSE = "pause";
|
|
6608
|
+
const QUEUE_HANDLE_RESUME = "resume";
|
|
6609
|
+
const QUEUE_MESSAGE_CALLBACK = "A Queue requires a callback function";
|
|
6610
|
+
const QUEUE_MESSAGE_CLEAR = "Queue was cleared";
|
|
6611
|
+
const QUEUE_MESSAGE_KEY = "Key must be a non-empty string";
|
|
6612
|
+
const QUEUE_MESSAGE_MAXIMUM = "Queue has reached its maximum size";
|
|
6613
|
+
const QUEUE_MESSAGE_REMOVE = "Item removed from queue";
|
|
6614
|
+
const QUEUE_NAME_KEYED = "keyedQueue";
|
|
6615
|
+
const QUEUE_NAME_QUEUE = "queue";
|
|
6616
|
+
const QUEUE_PROPERTY = "$queue";
|
|
6617
|
+
const QUEUE_STATUS_ACTIVE = "active";
|
|
6618
|
+
const QUEUE_STATUS_EMPTY = "empty";
|
|
6619
|
+
const QUEUE_STATUS_FULL = "full";
|
|
6620
|
+
const QUEUE_STATUS_PAUSED = "paused";
|
|
6621
|
+
const QUEUE_SYMBOL = Symbol(QUEUE_PROPERTY);
|
|
6622
|
+
//#endregion
|
|
6623
|
+
//#region src/queue.ts
|
|
6565
6624
|
function KeyedQueue(callback, options) {
|
|
6566
6625
|
this[QUEUE_SYMBOL] = {
|
|
6567
6626
|
callback,
|
|
@@ -6705,9 +6764,9 @@ function clearQueue() {
|
|
|
6705
6764
|
const items = this[QUEUE_SYMBOL].items.splice(0);
|
|
6706
6765
|
const { length } = items;
|
|
6707
6766
|
for (let index = 0; index < length; index += 1) {
|
|
6708
|
-
const
|
|
6709
|
-
aborter?.cancel();
|
|
6710
|
-
reject(new QueueError(QUEUE_MESSAGE_CLEAR));
|
|
6767
|
+
const item = items[index];
|
|
6768
|
+
item.aborter?.cancel();
|
|
6769
|
+
item.reject(new QueueError(QUEUE_MESSAGE_CLEAR));
|
|
6711
6770
|
}
|
|
6712
6771
|
}
|
|
6713
6772
|
function clearQueues(key) {
|
|
@@ -6834,7 +6893,7 @@ function isQueue(value) {
|
|
|
6834
6893
|
return isQueueInstance(QUEUE_NAME_QUEUE, value);
|
|
6835
6894
|
}
|
|
6836
6895
|
function isQueueInstance(name, value) {
|
|
6837
|
-
return typeof value === "object" && value != null &&
|
|
6896
|
+
return typeof value === "object" && value != null && "$queue" in value && value["$queue"] === name;
|
|
6838
6897
|
}
|
|
6839
6898
|
function keyedQueue(callback, options) {
|
|
6840
6899
|
if (typeof callback !== "function") throw new TypeError(QUEUE_MESSAGE_CALLBACK);
|
|
@@ -6869,9 +6928,9 @@ function removeQueued(id) {
|
|
|
6869
6928
|
const state = this[QUEUE_SYMBOL];
|
|
6870
6929
|
const index = state.items.findIndex((item) => item.id === id);
|
|
6871
6930
|
if (index > -1) {
|
|
6872
|
-
const
|
|
6873
|
-
aborter?.cancel();
|
|
6874
|
-
reject(new QueueError(QUEUE_MESSAGE_REMOVE));
|
|
6931
|
+
const item = state.items.splice(index, 1)[0];
|
|
6932
|
+
item.aborter?.cancel();
|
|
6933
|
+
item.reject(new QueueError(QUEUE_MESSAGE_REMOVE));
|
|
6875
6934
|
}
|
|
6876
6935
|
}
|
|
6877
6936
|
function resumeQueue() {
|
|
@@ -6917,22 +6976,13 @@ async function run$1(state) {
|
|
|
6917
6976
|
}
|
|
6918
6977
|
state.runners -= 1;
|
|
6919
6978
|
}
|
|
6920
|
-
const QUEUE_ERROR_NAME = "QueueError";
|
|
6921
|
-
const QUEUE_HANDLE_CLEAR = "clear";
|
|
6922
|
-
const QUEUE_HANDLE_PAUSE = "pause";
|
|
6923
|
-
const QUEUE_HANDLE_RESUME = "resume";
|
|
6924
|
-
const QUEUE_MESSAGE_CALLBACK = "A Queue requires a callback function";
|
|
6925
|
-
const QUEUE_MESSAGE_CLEAR = "Queue was cleared";
|
|
6926
|
-
const QUEUE_MESSAGE_KEY = "Key must be a non-empty string";
|
|
6927
|
-
const QUEUE_MESSAGE_MAXIMUM = "Queue has reached its maximum size";
|
|
6928
|
-
const QUEUE_MESSAGE_REMOVE = "Item removed from queue";
|
|
6929
|
-
const QUEUE_STATUS_ACTIVE = "active";
|
|
6930
|
-
const QUEUE_STATUS_EMPTY = "empty";
|
|
6931
|
-
const QUEUE_STATUS_FULL = "full";
|
|
6932
|
-
const QUEUE_STATUS_PAUSED = "paused";
|
|
6933
|
-
const QUEUE_SYMBOL = Symbol(QUEUE_PROPERTY);
|
|
6934
6979
|
queue.keyed = keyedQueue;
|
|
6935
6980
|
//#endregion
|
|
6981
|
+
//#region src/models/random.model.ts
|
|
6982
|
+
const RANDOM_ALPHABET = "abcdefghijklmnopqrstuvwxyz";
|
|
6983
|
+
const RANDOM_BOOLEAN_MODIFIER = .5;
|
|
6984
|
+
const RANDOM_HEX_CHARACTERS = "0123456789ABCDEF";
|
|
6985
|
+
//#endregion
|
|
6936
6986
|
//#region src/random.ts
|
|
6937
6987
|
/**
|
|
6938
6988
|
* Get a random boolean
|
|
@@ -6971,7 +7021,7 @@ function getRandomColor(prefix) {
|
|
|
6971
7021
|
* @returns Random hexadecimal character from `0-9` and `A-F`
|
|
6972
7022
|
*/
|
|
6973
7023
|
function getRandomHex() {
|
|
6974
|
-
return RANDOM_HEX_CHARACTERS[getRandomInteger(0,
|
|
7024
|
+
return RANDOM_HEX_CHARACTERS[getRandomInteger(0, 15)];
|
|
6975
7025
|
}
|
|
6976
7026
|
/**
|
|
6977
7027
|
* Get a random item from an array
|
|
@@ -6989,10 +7039,6 @@ function getRandomItems(array, amount) {
|
|
|
6989
7039
|
if (amount === 1) return [array[getRandomInteger(0, array.length - 1)]];
|
|
6990
7040
|
return typeof amount !== "number" || amount <= 0 || amount >= array.length ? shuffle(array) : shuffle(array).slice(0, amount);
|
|
6991
7041
|
}
|
|
6992
|
-
const RANDOM_ALPHABET = "abcdefghijklmnopqrstuvwxyz";
|
|
6993
|
-
const RANDOM_BOOLEAN_MODIFIER = .5;
|
|
6994
|
-
const RANDOM_HEX_CHARACTERS = "0123456789ABCDEF";
|
|
6995
|
-
const RANDOM_HEX_MAXIMUM = 15;
|
|
6996
7042
|
//#endregion
|
|
6997
7043
|
//#region src/sized/set.ts
|
|
6998
7044
|
/**
|
|
@@ -7049,4 +7095,4 @@ var SizedSet = class extends Set {
|
|
|
7049
7095
|
}
|
|
7050
7096
|
};
|
|
7051
7097
|
//#endregion
|
|
7052
|
-
export { CancelablePromise, Logger, PromiseTimeoutError,
|
|
7098
|
+
export { CancelablePromise, Logger, PromiseTimeoutError, RetryError, SORT_DIRECTION_ASCENDING, SORT_DIRECTION_DESCENDING, SizedMap, SizedSet, push as append, push, assert, assertCondition, assertDefined, assertInstanceOf, assertIs, assertProperty, assign, asyncAttempt, asyncAttemptRun, asyncDebounce, asyncFlow, asyncMatchResult, asyncOnce, asyncPipe, asyncRun, asyncThrottle, attempt, attemptAsyncFlow, attemptAsyncPipe, attemptFlow, attemptPipe, attemptPromise, attemptRun, attemptRunAsyncPlan, attemptRunPlan, average, beacon, between, camelCase, cancelable, capitalize, ceil, chunk, clamp, clone, compact, compare, copy, count, debounce, deburr, dedent, delay, deregisterCloner, deregisterComparator, deregisterEqualizer, diff, difference, drop, endsWith, endsWithArray, equal, error, exclude, exists, fail, filter, filterAndMap, filterAndMap as select, find, findLast, first, firstOrDefault, flatFreeze, flatten, floor, flow, freeze, fromQuery, toPromise as fromResult, toPromise, fuzzy, fuzzyMatch, getArray, getArrayComparison, getColor, getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getHwbColor, getHwbaColor, getNormalizedHex, getNumber, getRandomBoolean, getRandomCharacters, getRandomColor, getRandomFloatingNumber as getRandomFloat, getRandomHex, getRandomInteger, getRandomItem, getRandomItems, getRgbColor, getRgbaColor, getSortedIndex, getString, getTimedPromise, getUuid, getValue, groupArraysBy, groupBy, handleResult, hasValue, hasValueResult, herald, hexToHsl, hexToHsla, hexToHwb, hexToHwba, hexToRgb, hexToRgba, hslToHex, hslToHwb, hslToHwba, hslToRgb, hslToRgba, hwbToHex, hwbToHsl, hwbToHsla, hwbToRgb, hwbToRgba, ignoreKey, inMap, inSet, includes, includesArray, indexOf, indexOfArray, initializeAssigner, initializeCloner, initializeEqualizer, initializeMerger, initializeNormalizer, initializeSorter, initializeTemplater, initializeTransformer, insert, interpolate, intersection, isArrayOrPlainObject, isAsyncGenerator, isAsyncOnce, isAsyncPlan, isBeacon, isBeaconSubscription, isColor, isConstructor, isEmpty, isError, isFrozen, isFulfilled, isFuzzy, isGenerator, isHerald, isHeraldEvents, isHeraldSubscription, isHexColor, isHslColor, isHslaColor, isHwbColor, isHwbaColor, isInstanceOf, isKey, isKeyedQueue, isLogger, isNonArrayOrPlainObject, isNonConstructor, isNonEmpty, isNonInstanceOf, isNonKey, isNonNullable, isNonNullableOrEmpty, isNonNullableOrWhitespace, isNonNumber, isNonNumerical, isNonObject, isNonPlainObject, isNonPrimitive, isNonTemplateStringsArray, isNonTypedArray, isNullable, isNullableOrEmpty, isNullableOrWhitespace, isNumber, isNumerical, isObject, isObservable, isOk, isOnce, isPlainObject, isPlan, isPrimitive, isQueue, isQueueInstance, isRejected, isResult, isRgbColor, isRgbaColor, isSorted, isSubscription, isSubscriptions, isTemplateStringsArray, isTimeLogger, isTypedArray, join, kebabCase, keyedQueue, last, lastIndexOf, lastOrDefault, lowerCase, mapAndFilter, mapAndFilter as reverseSelect, matchResult, max, median, memoize, merge, min, move, moveIndices, moveToIndex, noop, normalize, ok, omit, once, parse, partition, pascalCase, pick, pipe, plan, promises, queue, range, registerCloner, registerComparator, registerEqualizer, resultPromises, retry, reverse, rgbToHex, rgbToHsl, rgbToHsla, rgbToHwb, rgbToHwba, round, run, runAsyncPlan, runPlan, setValue, settlePromise, shake, shuffle, single, slice, smush, snakeCase, sort, splice, startsWith, startsWithArray, subscriptions, succeed, succeedResult, sum, swap, take, template, throttle, timed, times, titleCase, toMap, toMapArrays, toQuery, toRecord, toRecordArrays, toResult, toSet, toggle, transform, trim, truncate, tryDecode, tryEncode, union, unique, unsmush, unwrap, update, upperCase, words };
|