@oscarpalmer/atoms 0.221.0 → 0.222.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 -3
- package/dist/array/difference.mjs +1 -2
- package/dist/array/exists.d.mts +1 -3
- package/dist/array/exists.mjs +1 -2
- package/dist/array/filter.d.mts +1 -3
- package/dist/array/filter.mjs +1 -2
- package/dist/array/find.d.mts +1 -3
- package/dist/array/find.mjs +1 -2
- package/dist/array/first.d.mts +1 -3
- package/dist/array/first.mjs +1 -2
- package/dist/array/flatten.d.mts +1 -3
- package/dist/array/flatten.mjs +1 -2
- package/dist/array/from.d.mts +1 -3
- package/dist/array/from.mjs +1 -2
- package/dist/array/group-by.d.mts +1 -3
- package/dist/array/group-by.mjs +1 -2
- package/dist/array/insert.d.mts +1 -3
- package/dist/array/insert.mjs +1 -2
- package/dist/array/intersection.d.mts +1 -3
- package/dist/array/intersection.mjs +1 -2
- package/dist/array/last.d.mts +1 -3
- package/dist/array/last.mjs +1 -2
- package/dist/array/move.d.mts +1 -3
- package/dist/array/move.mjs +1 -2
- package/dist/array/partition.d.mts +1 -3
- package/dist/array/partition.mjs +1 -2
- package/dist/array/push.d.mts +0 -2
- package/dist/array/push.mjs +1 -2
- package/dist/array/reverse.d.mts +1 -3
- package/dist/array/reverse.mjs +1 -2
- package/dist/array/select.d.mts +0 -2
- package/dist/array/select.mjs +1 -2
- package/dist/array/single.d.mts +1 -3
- package/dist/array/single.mjs +1 -2
- package/dist/array/slice.d.mts +1 -3
- package/dist/array/slice.mjs +1 -2
- package/dist/array/sort.d.mts +0 -2
- package/dist/array/sort.mjs +1 -2
- package/dist/array/splice.d.mts +1 -3
- package/dist/array/splice.mjs +1 -2
- package/dist/array/swap.d.mts +0 -2
- package/dist/array/swap.mjs +1 -2
- package/dist/array/to-map.d.mts +1 -3
- package/dist/array/to-map.mjs +1 -2
- package/dist/array/to-record.d.mts +1 -3
- package/dist/array/to-record.mjs +1 -2
- package/dist/array/to-set.d.mts +1 -3
- package/dist/array/to-set.mjs +1 -2
- package/dist/array/toggle.d.mts +1 -3
- package/dist/array/toggle.mjs +1 -2
- package/dist/array/union.d.mts +1 -3
- package/dist/array/union.mjs +1 -2
- package/dist/array/unique.d.mts +1 -3
- package/dist/array/unique.mjs +1 -2
- package/dist/array/update.d.mts +1 -3
- package/dist/array/update.mjs +1 -2
- package/dist/beacon.d.mts +0 -2
- package/dist/beacon.mjs +2 -3
- package/dist/color/constants.d.mts +0 -2
- package/dist/color/constants.mjs +1 -2
- package/dist/color/index.d.mts +0 -2
- package/dist/color/index.mjs +1 -2
- package/dist/color/instance.d.mts +1 -3
- package/dist/color/instance.mjs +1 -2
- package/dist/color/misc/alpha.d.mts +1 -3
- package/dist/color/misc/alpha.mjs +1 -2
- package/dist/color/misc/format.d.mts +1 -3
- package/dist/color/misc/format.mjs +1 -2
- package/dist/color/misc/get.d.mts +1 -3
- package/dist/color/misc/get.mjs +1 -2
- package/dist/color/misc/is.d.mts +1 -3
- package/dist/color/misc/is.mjs +1 -2
- package/dist/color/misc/state.d.mts +1 -3
- package/dist/color/misc/state.mjs +1 -2
- package/dist/color/space/hex.d.mts +1 -3
- package/dist/color/space/hex.mjs +1 -2
- package/dist/color/space/hsl.d.mts +1 -3
- package/dist/color/space/hsl.mjs +1 -2
- package/dist/color/space/hwb.d.mts +1 -3
- package/dist/color/space/hwb.mjs +1 -2
- package/dist/color/space/rgb.d.mts +1 -3
- package/dist/color/space/rgb.mjs +1 -2
- package/dist/function/limit.d.mts +0 -2
- package/dist/function/limit.mjs +1 -2
- package/dist/function/once.d.mts +0 -2
- package/dist/function/once.mjs +1 -2
- package/dist/function/retry.d.mts +0 -2
- package/dist/function/retry.mjs +1 -2
- package/dist/index.d.mts +1 -268
- package/dist/index.mjs +166 -331
- package/dist/internal/aborter.d.mts +1 -3
- package/dist/internal/aborter.mjs +1 -2
- package/dist/internal/array/callbacks.d.mts +1 -3
- package/dist/internal/array/callbacks.mjs +1 -2
- package/dist/internal/array/chunk.d.mts +1 -3
- package/dist/internal/array/chunk.mjs +1 -2
- package/dist/internal/array/compact.d.mts +1 -3
- package/dist/internal/array/compact.mjs +1 -2
- package/dist/internal/array/find.d.mts +1 -3
- package/dist/internal/array/find.mjs +1 -2
- package/dist/internal/array/get.d.mts +1 -3
- package/dist/internal/array/get.mjs +1 -2
- package/dist/internal/array/group.d.mts +1 -3
- package/dist/internal/array/group.mjs +1 -2
- package/dist/internal/array/index-of.d.mts +1 -3
- package/dist/internal/array/index-of.mjs +1 -2
- package/dist/internal/array/insert.d.mts +1 -3
- package/dist/internal/array/insert.mjs +1 -2
- package/dist/internal/array/match.d.mts +1 -3
- package/dist/internal/array/match.mjs +1 -2
- package/dist/internal/array/overlap.d.mts +1 -3
- package/dist/internal/array/overlap.mjs +1 -2
- package/dist/internal/array/sets.d.mts +1 -3
- package/dist/internal/array/sets.mjs +1 -2
- package/dist/internal/array/shuffle.d.mts +1 -3
- package/dist/internal/array/shuffle.mjs +1 -2
- package/dist/internal/array/update.d.mts +1 -3
- package/dist/internal/array/update.mjs +1 -2
- package/dist/internal/defaults.d.mts +1 -3
- package/dist/internal/defaults.mjs +1 -2
- package/dist/internal/function/assert.d.mts +0 -2
- package/dist/internal/function/assert.mjs +1 -2
- package/dist/internal/function/limit.d.mts +1 -3
- package/dist/internal/function/limit.mjs +1 -2
- package/dist/internal/function/memoize.d.mts +0 -2
- package/dist/internal/function/memoize.mjs +1 -2
- package/dist/internal/function/misc.d.mts +1 -2
- package/dist/internal/function/misc.mjs +7 -3
- package/dist/internal/function/work.d.mts +0 -2
- package/dist/internal/function/work.mjs +5 -13
- package/dist/internal/herald.d.mts +1 -3
- package/dist/internal/herald.mjs +1 -2
- package/dist/internal/is.d.mts +1 -3
- package/dist/internal/is.mjs +1 -2
- package/dist/internal/math/aggregate.d.mts +1 -3
- package/dist/internal/math/aggregate.mjs +1 -2
- package/dist/internal/math/misc.d.mts +1 -3
- package/dist/internal/math/misc.mjs +1 -2
- package/dist/internal/number.d.mts +1 -3
- package/dist/internal/number.mjs +1 -2
- package/dist/internal/plan/index.d.mts +1 -3
- package/dist/internal/plan/index.mjs +1 -2
- package/dist/internal/plan/plan.generate.d.mts +1 -3
- package/dist/internal/plan/plan.generate.mjs +2 -3
- package/dist/internal/random.d.mts +1 -3
- package/dist/internal/random.mjs +1 -2
- package/dist/internal/result/attempt.d.mts +1 -3
- package/dist/internal/result/attempt.mjs +1 -2
- package/dist/internal/result/misc.d.mts +1 -3
- package/dist/internal/result/misc.mjs +1 -2
- package/dist/internal/sized/map.d.mts +1 -3
- package/dist/internal/sized/map.mjs +1 -2
- package/dist/internal/sized/misc.d.mts +1 -3
- package/dist/internal/sized/misc.mjs +1 -2
- package/dist/internal/string/case.d.mts +1 -3
- package/dist/internal/string/case.mjs +1 -2
- package/dist/internal/string/misc.d.mts +1 -3
- package/dist/internal/string/misc.mjs +2 -3
- package/dist/internal/subscription.d.mts +1 -3
- package/dist/internal/subscription.mjs +1 -2
- package/dist/internal/value/compare.d.mts +1 -3
- package/dist/internal/value/compare.mjs +1 -2
- package/dist/internal/value/equal.d.mts +0 -2
- package/dist/internal/value/equal.mjs +1 -2
- package/dist/internal/value/get.d.mts +1 -3
- package/dist/internal/value/get.mjs +1 -2
- package/dist/internal/value/handlers.d.mts +1 -3
- package/dist/internal/value/handlers.mjs +1 -2
- package/dist/internal/value/has.d.mts +1 -3
- package/dist/internal/value/has.mjs +1 -2
- package/dist/internal/value/misc.d.mts +1 -3
- package/dist/internal/value/misc.mjs +2 -3
- package/dist/internal/value/partial.d.mts +1 -3
- package/dist/internal/value/partial.mjs +1 -2
- package/dist/internal/value/set.d.mts +1 -3
- package/dist/internal/value/set.mjs +1 -2
- package/dist/is.d.mts +0 -2
- package/dist/is.mjs +1 -2
- package/dist/logger.d.mts +0 -2
- package/dist/logger.mjs +1 -2
- package/dist/math.d.mts +0 -2
- package/dist/math.mjs +1 -2
- package/dist/models/aborter.model.d.mts +1 -3
- package/dist/models/aborter.model.mjs +1 -2
- package/dist/models/array/array.find.model.d.mts +1 -3
- package/dist/models/array/array.find.model.mjs +1 -2
- package/dist/models/array/array.match.model.d.mts +1 -3
- package/dist/models/array/array.match.model.mjs +1 -2
- package/dist/models/array/array.misc.model.d.mts +1 -3
- package/dist/models/array/array.misc.model.mjs +1 -2
- package/dist/models/array/array.sort.model.d.mts +1 -3
- package/dist/models/array/array.sort.model.mjs +1 -2
- package/dist/models/beacon.model.d.mts +1 -3
- package/dist/models/beacon.model.mjs +1 -2
- package/dist/models/color.model.d.mts +0 -2
- package/dist/models/function/assert.model.d.mts +1 -3
- package/dist/models/function/assert.model.mjs +1 -2
- package/dist/models/function/limiter.model.d.mts +1 -3
- package/dist/models/function/limiter.model.mjs +1 -2
- package/dist/models/function/memoize.model.d.mts +1 -3
- package/dist/models/function/memoize.model.mjs +1 -2
- package/dist/models/function/once.model.d.mts +0 -2
- package/dist/models/function/once.model.mjs +1 -2
- package/dist/models/function/retry.model.d.mts +1 -3
- package/dist/models/function/retry.model.mjs +1 -2
- package/dist/models/function/work.model.d.mts +1 -3
- package/dist/models/function/work.model.mjs +1 -2
- package/dist/models/herald.model.d.mts +1 -3
- package/dist/models/herald.model.mjs +1 -2
- package/dist/models/index.d.mts +0 -2
- package/dist/models/logger.model.d.mts +1 -3
- package/dist/models/logger.model.mjs +1 -2
- package/dist/models/math.model.d.mts +1 -3
- package/dist/models/math.model.mjs +1 -2
- package/dist/models/misc.model.d.mts +1 -3
- package/dist/models/misc.model.mjs +1 -2
- package/dist/models/plan.model.d.mts +0 -2
- package/dist/models/plan.model.mjs +1 -2
- package/dist/models/promise.model.d.mts +1 -3
- package/dist/models/promise.model.mjs +1 -2
- package/dist/models/query.model.d.mts +1 -3
- package/dist/models/query.model.mjs +1 -2
- package/dist/models/queue.model.d.mts +0 -2
- package/dist/models/queue.model.mjs +1 -2
- package/dist/models/random.model.d.mts +1 -3
- package/dist/models/random.model.mjs +1 -2
- package/dist/models/result.model.d.mts +0 -2
- package/dist/models/string/string.case.model.d.mts +1 -3
- package/dist/models/string/string.case.model.mjs +1 -2
- package/dist/models/string/string.fuzzy.model.d.mts +0 -2
- package/dist/models/string/string.fuzzy.model.mjs +1 -2
- package/dist/models/string/string.misc.model.d.mts +1 -3
- package/dist/models/string/string.misc.model.mjs +1 -2
- package/dist/models/string/string.normalize.model.d.mts +1 -3
- package/dist/models/string/string.normalize.model.mjs +1 -2
- package/dist/models/string/string.template.model.d.mts +1 -3
- package/dist/models/string/string.template.model.mjs +1 -2
- package/dist/models/subscription.model.d.mts +1 -3
- package/dist/models/subscription.model.mjs +1 -2
- package/dist/models/value/value.clone.model.d.mts +1 -3
- package/dist/models/value/value.clone.model.mjs +1 -2
- package/dist/models/value/value.diff.model.d.mts +1 -3
- package/dist/models/value/value.diff.model.mjs +1 -2
- package/dist/models/value/value.equal.model.d.mts +0 -2
- package/dist/models/value/value.equal.model.mjs +1 -2
- package/dist/models/value/value.handler.model.d.mts +1 -3
- package/dist/models/value/value.merge.model.d.mts +0 -2
- package/dist/models/value/value.merge.model.mjs +1 -2
- package/dist/models/value/value.misc.model.d.mts +0 -2
- package/dist/models/value/value.misc.model.mjs +1 -2
- package/dist/models/value/value.transform.model.d.mts +1 -3
- package/dist/models/value/value.transform.model.mjs +1 -2
- package/dist/plan/index.d.mts +1 -3
- package/dist/plan/index.mjs +1 -2
- package/dist/plan/is.d.mts +1 -3
- package/dist/plan/is.mjs +1 -2
- package/dist/plan/misc.d.mts +1 -3
- package/dist/plan/misc.mjs +1 -2
- package/dist/plan/result.d.mts +1 -3
- package/dist/plan/result.mjs +1 -2
- package/dist/plan/run.d.mts +1 -3
- package/dist/plan/run.mjs +1 -2
- package/dist/plan/use.d.mts +1 -3
- package/dist/plan/use.mjs +1 -2
- package/dist/promise/delay.d.mts +1 -3
- package/dist/promise/delay.mjs +1 -2
- package/dist/promise/helpers.d.mts +1 -3
- package/dist/promise/helpers.mjs +1 -2
- package/dist/promise/index.d.mts +0 -2
- package/dist/promise/index.mjs +1 -2
- package/dist/promise/misc.d.mts +0 -2
- package/dist/promise/misc.mjs +1 -2
- package/dist/promise/timed.d.mts +1 -3
- package/dist/promise/timed.mjs +1 -2
- package/dist/query.d.mts +1 -3
- package/dist/query.mjs +1 -2
- package/dist/queue.d.mts +0 -2
- package/dist/queue.mjs +1 -2
- package/dist/random.d.mts +0 -2
- package/dist/random.mjs +1 -2
- package/dist/result/match.d.mts +1 -3
- package/dist/result/match.mjs +1 -2
- package/dist/result/misc.d.mts +0 -2
- package/dist/result/misc.mjs +1 -2
- package/dist/result/work/flow.d.mts +1 -3
- package/dist/result/work/flow.mjs +4 -11
- package/dist/result/work/pipe.d.mts +0 -2
- package/dist/result/work/pipe.mjs +1 -2
- package/dist/sized/set.d.mts +1 -3
- package/dist/sized/set.mjs +1 -2
- package/dist/string/fuzzy.d.mts +0 -2
- package/dist/string/fuzzy.mjs +1 -2
- package/dist/string/index.d.mts +0 -2
- package/dist/string/index.mjs +1 -2
- package/dist/string/match.d.mts +1 -3
- package/dist/string/match.mjs +1 -2
- package/dist/string/normalize.d.mts +0 -2
- package/dist/string/normalize.mjs +1 -2
- package/dist/string/template.d.mts +0 -2
- package/dist/string/template.mjs +1 -2
- package/dist/value/clone.d.mts +0 -2
- package/dist/value/clone.mjs +1 -2
- package/dist/value/collection.d.mts +1 -3
- package/dist/value/collection.mjs +1 -2
- package/dist/value/diff.d.mts +0 -2
- package/dist/value/diff.mjs +1 -2
- package/dist/value/freeze.d.mts +1 -3
- package/dist/value/freeze.mjs +2 -3
- package/dist/value/merge.d.mts +0 -2
- package/dist/value/merge.mjs +1 -2
- package/dist/value/omit.d.mts +1 -3
- package/dist/value/omit.mjs +1 -2
- package/dist/value/pick.d.mts +1 -3
- package/dist/value/pick.mjs +1 -2
- package/dist/value/shake.d.mts +0 -2
- package/dist/value/shake.mjs +1 -2
- package/dist/value/smush.d.mts +0 -2
- package/dist/value/smush.mjs +1 -2
- package/dist/value/transform.d.mts +0 -2
- package/dist/value/transform.mjs +1 -2
- package/dist/value/unsmush.d.mts +0 -2
- package/dist/value/unsmush.mjs +1 -2
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
// src/models/array/array.find.model.ts
|
|
2
2
|
const ARRAY_FIND_VALUE_INDEX = "index";
|
|
3
3
|
const ARRAY_FIND_VALUE_ITEM = "item";
|
|
4
4
|
const ARRAY_FIND_VALUES_UNIQUE = "unique";
|
|
5
|
-
|
|
6
|
-
//#region src/internal/array/callbacks.ts
|
|
5
|
+
// src/internal/array/callbacks.ts
|
|
7
6
|
function getArrayCallback(value) {
|
|
8
7
|
switch (typeof value) {
|
|
9
8
|
case "function": return value;
|
|
@@ -19,8 +18,7 @@ function getArrayCallbacks(bool, key, value) {
|
|
|
19
18
|
value: getArrayCallback(value)
|
|
20
19
|
};
|
|
21
20
|
}
|
|
22
|
-
|
|
23
|
-
//#region src/internal/array/find.ts
|
|
21
|
+
// src/internal/array/find.ts
|
|
24
22
|
function addResult(result, mapped, flat) {
|
|
25
23
|
if (!flat) {
|
|
26
24
|
result.matched.push(mapped);
|
|
@@ -148,8 +146,7 @@ function findValues(type, array, parameters, options) {
|
|
|
148
146
|
};
|
|
149
147
|
return simple ? findSimpleValues(findParameters) : findComplexValues(findParameters);
|
|
150
148
|
}
|
|
151
|
-
|
|
152
|
-
//#region src/array/filter.ts
|
|
149
|
+
// src/array/filter.ts
|
|
153
150
|
function exclude(array, ...parameters) {
|
|
154
151
|
return findValues("all", array, parameters).notMatched;
|
|
155
152
|
}
|
|
@@ -157,8 +154,7 @@ function filter(array, ...parameters) {
|
|
|
157
154
|
return findValues("all", array, parameters).matched;
|
|
158
155
|
}
|
|
159
156
|
filter.remove = exclude;
|
|
160
|
-
|
|
161
|
-
//#region src/array/find.ts
|
|
157
|
+
// src/array/find.ts
|
|
162
158
|
function find(array, ...parameters) {
|
|
163
159
|
return findValue(ARRAY_FIND_VALUE_ITEM, array, parameters, false);
|
|
164
160
|
}
|
|
@@ -166,8 +162,7 @@ function findLast(array, ...parameters) {
|
|
|
166
162
|
return findValue(ARRAY_FIND_VALUE_ITEM, array, parameters, true);
|
|
167
163
|
}
|
|
168
164
|
find.last = findLast;
|
|
169
|
-
|
|
170
|
-
//#region src/array/first.ts
|
|
165
|
+
// src/array/first.ts
|
|
171
166
|
function first(array, ...parameters) {
|
|
172
167
|
return findAbsoluteValueOrDefault(array, parameters, void 0, false, false);
|
|
173
168
|
}
|
|
@@ -175,8 +170,7 @@ function firstOrDefault(array, defaultValue, ...parameters) {
|
|
|
175
170
|
return findAbsoluteValueOrDefault(array, parameters, defaultValue, true, false);
|
|
176
171
|
}
|
|
177
172
|
first.defaulted = firstOrDefault;
|
|
178
|
-
|
|
179
|
-
//#region src/internal/array/group.ts
|
|
173
|
+
// src/internal/array/group.ts
|
|
180
174
|
function groupValues(array, key, value, arrays) {
|
|
181
175
|
if (!Array.isArray(array) || array.length === 0) return {};
|
|
182
176
|
const { length } = array;
|
|
@@ -194,8 +188,7 @@ function groupValues(array, key, value, arrays) {
|
|
|
194
188
|
}
|
|
195
189
|
return record;
|
|
196
190
|
}
|
|
197
|
-
|
|
198
|
-
//#region src/array/group-by.ts
|
|
191
|
+
// src/array/group-by.ts
|
|
199
192
|
function groupBy(array, first, second) {
|
|
200
193
|
return groupValues(array, first, second, false);
|
|
201
194
|
}
|
|
@@ -203,8 +196,7 @@ function groupArraysBy(array, first, second) {
|
|
|
203
196
|
return groupValues(array, first, second, true);
|
|
204
197
|
}
|
|
205
198
|
groupBy.arrays = groupArraysBy;
|
|
206
|
-
|
|
207
|
-
//#region src/models/array/array.misc.model.ts
|
|
199
|
+
// src/models/array/array.misc.model.ts
|
|
208
200
|
const ARRAY_CHUNK_MAX_SIZE = 5e3;
|
|
209
201
|
const ARRAY_INSERT_TYPE_INSERT = "insert";
|
|
210
202
|
const ARRAY_INSERT_TYPE_PUSH = "push";
|
|
@@ -214,8 +206,7 @@ const ARRAY_SETS_COMPARE_INTERSECTION = "intersection";
|
|
|
214
206
|
const ARRAY_SETS_COMPARE_UNION = "union";
|
|
215
207
|
const ARRAY_SLICE_DROP = "drop";
|
|
216
208
|
const ARRAY_SLICE_TAKE = "take";
|
|
217
|
-
|
|
218
|
-
//#region src/internal/array/chunk.ts
|
|
209
|
+
// src/internal/array/chunk.ts
|
|
219
210
|
/**
|
|
220
211
|
* Chunk an array into smaller arrays
|
|
221
212
|
*
|
|
@@ -242,8 +233,7 @@ function chunk(array, size) {
|
|
|
242
233
|
}
|
|
243
234
|
return chunks;
|
|
244
235
|
}
|
|
245
|
-
|
|
246
|
-
//#region src/internal/array/compact.ts
|
|
236
|
+
// src/internal/array/compact.ts
|
|
247
237
|
function compact(array, strict) {
|
|
248
238
|
if (!Array.isArray(array)) return [];
|
|
249
239
|
if (strict === true) return array.filter(Boolean);
|
|
@@ -255,8 +245,7 @@ function compact(array, strict) {
|
|
|
255
245
|
}
|
|
256
246
|
return compacted;
|
|
257
247
|
}
|
|
258
|
-
|
|
259
|
-
//#region src/internal/is.ts
|
|
248
|
+
// src/internal/is.ts
|
|
260
249
|
/**
|
|
261
250
|
* Is the value an array or a plain object?
|
|
262
251
|
*
|
|
@@ -439,8 +428,7 @@ function isTypedArray(value) {
|
|
|
439
428
|
]);
|
|
440
429
|
return isTypedArray.types.has(value?.constructor);
|
|
441
430
|
}
|
|
442
|
-
|
|
443
|
-
//#region src/internal/array/get.ts
|
|
431
|
+
// src/internal/array/get.ts
|
|
444
432
|
function getArray(value, indiced) {
|
|
445
433
|
if (Array.isArray(value)) return value;
|
|
446
434
|
if (value instanceof Map) return [...value.entries()];
|
|
@@ -468,8 +456,7 @@ const arrayMatchInvalid = [-1, ARRAY_MATCH_COMPARISON_INVALID];
|
|
|
468
456
|
const arrayMatchOutside = [-1, ARRAY_MATCH_COMPARISON_OUTSIDE];
|
|
469
457
|
const arrayMatchOutsides = /* @__PURE__ */ new Set([ARRAY_MATCH_COMPARISON_INVALID, ARRAY_MATCH_COMPARISON_OUTSIDE]);
|
|
470
458
|
const arrayMatchStarts = /* @__PURE__ */ new Set([ARRAY_MATCH_COMPARISON_START, ARRAY_MATCH_COMPARISON_SAME]);
|
|
471
|
-
|
|
472
|
-
//#region src/internal/array/match.ts
|
|
459
|
+
// src/internal/array/match.ts
|
|
473
460
|
function endsWithArray(haystack, needle, key) {
|
|
474
461
|
return arrayMatchEndings.has(getPosition(haystack, needle, key)[1]);
|
|
475
462
|
}
|
|
@@ -517,8 +504,7 @@ function indexOfArray(haystack, needle, key) {
|
|
|
517
504
|
function startsWithArray(haystack, needle, key) {
|
|
518
505
|
return arrayMatchStarts.has(getPosition(haystack, needle, key)[1]);
|
|
519
506
|
}
|
|
520
|
-
|
|
521
|
-
//#region src/internal/math/misc.ts
|
|
507
|
+
// src/internal/math/misc.ts
|
|
522
508
|
/**
|
|
523
509
|
* Round a number down
|
|
524
510
|
*
|
|
@@ -559,8 +545,7 @@ function roundNumber(callback, value, decimals) {
|
|
|
559
545
|
const mod = 10 ** decimals;
|
|
560
546
|
return callback((value + Number.EPSILON) * mod) / mod;
|
|
561
547
|
}
|
|
562
|
-
|
|
563
|
-
//#region src/internal/random.ts
|
|
548
|
+
// src/internal/random.ts
|
|
564
549
|
/**
|
|
565
550
|
* Get a random number between 0 _(inclusive)_ and 1 _(exclusive)_
|
|
566
551
|
*
|
|
@@ -599,8 +584,7 @@ function getRandomInteger(minimum, maximum) {
|
|
|
599
584
|
return floor(getRandomFloatingNumberValue(true, minimum, maximum));
|
|
600
585
|
}
|
|
601
586
|
const RANDOM_DIVISOR = 2 ** 32;
|
|
602
|
-
|
|
603
|
-
//#region src/internal/array/shuffle.ts
|
|
587
|
+
// src/internal/array/shuffle.ts
|
|
604
588
|
/**
|
|
605
589
|
* Shuffle items in array
|
|
606
590
|
*
|
|
@@ -623,8 +607,7 @@ function shuffle(array) {
|
|
|
623
607
|
}
|
|
624
608
|
return shuffled;
|
|
625
609
|
}
|
|
626
|
-
|
|
627
|
-
//#region src/internal/array/sets.ts
|
|
610
|
+
// src/internal/array/sets.ts
|
|
628
611
|
function compareSets(type, first, second, key) {
|
|
629
612
|
if (!Array.isArray(first)) return [];
|
|
630
613
|
const isDifference = type === ARRAY_SETS_COMPARE_DIFFERENCE;
|
|
@@ -656,19 +639,16 @@ function getComparison(first, second, isIntersection, isUnion, key) {
|
|
|
656
639
|
}
|
|
657
640
|
return result;
|
|
658
641
|
}
|
|
659
|
-
|
|
660
|
-
//#region src/array/difference.ts
|
|
642
|
+
// src/array/difference.ts
|
|
661
643
|
function difference(first, second, key) {
|
|
662
644
|
return compareSets(ARRAY_SETS_COMPARE_DIFFERENCE, first, second, key);
|
|
663
645
|
}
|
|
664
|
-
|
|
665
|
-
//#region src/array/exists.ts
|
|
646
|
+
// src/array/exists.ts
|
|
666
647
|
function exists(array, ...parameters) {
|
|
667
648
|
if (parameters.length === 1 && typeof parameters[0] !== "function") return Array.isArray(array) ? array.includes(parameters[0]) : false;
|
|
668
649
|
return findValue(ARRAY_FIND_VALUE_INDEX, array, parameters, false) > -1;
|
|
669
650
|
}
|
|
670
|
-
|
|
671
|
-
//#region src/array/flatten.ts
|
|
651
|
+
// src/array/flatten.ts
|
|
672
652
|
/**
|
|
673
653
|
* Flatten an array _(using native `flat` and maximum depth)_
|
|
674
654
|
*
|
|
@@ -683,8 +663,7 @@ function exists(array, ...parameters) {
|
|
|
683
663
|
function flatten(array) {
|
|
684
664
|
return Array.isArray(array) ? array.flat(Number.POSITIVE_INFINITY) : [];
|
|
685
665
|
}
|
|
686
|
-
|
|
687
|
-
//#region src/array/from.ts
|
|
666
|
+
// src/array/from.ts
|
|
688
667
|
function range(first, second, third) {
|
|
689
668
|
const start = typeof second === "number" ? first : 0;
|
|
690
669
|
const end = typeof second === "number" ? second : first;
|
|
@@ -702,11 +681,9 @@ function times(length, value) {
|
|
|
702
681
|
for (let index = 0; index < length; index += 1) values.push(isFunction ? value(index) : value ?? index);
|
|
703
682
|
return values;
|
|
704
683
|
}
|
|
705
|
-
|
|
706
|
-
//#region src/models/math.model.ts
|
|
684
|
+
// src/models/math.model.ts
|
|
707
685
|
const AGGREGATION_AVERAGE = "average";
|
|
708
|
-
|
|
709
|
-
//#region src/internal/math/aggregate.ts
|
|
686
|
+
// src/internal/math/aggregate.ts
|
|
710
687
|
function aggregate(type, array, key, first) {
|
|
711
688
|
const length = Array.isArray(array) ? array.length : 0;
|
|
712
689
|
const aggregation = {
|
|
@@ -778,8 +755,7 @@ const aggregators = {
|
|
|
778
755
|
min: getAbsoluteValue.bind(void 0, isMinValue),
|
|
779
756
|
sum: calculateSum
|
|
780
757
|
};
|
|
781
|
-
|
|
782
|
-
//#region src/internal/array/insert.ts
|
|
758
|
+
// src/internal/array/insert.ts
|
|
783
759
|
function insertChunkedValues(type, array, items, start, deleteCount) {
|
|
784
760
|
const actualDeleteCount = max([deleteCount, 0]);
|
|
785
761
|
const actualStart = min([max([0, start]), array.length]);
|
|
@@ -801,24 +777,20 @@ function insertValues(type, array, items, start, deleteCount) {
|
|
|
801
777
|
if (!Array.isArray(array) || typeof start !== "number" || !Array.isArray(items) || items.length === 0) return spliceArray ? [] : 0;
|
|
802
778
|
return insertChunkedValues(type, array, items, start, spliceArray ? deleteCount : 0);
|
|
803
779
|
}
|
|
804
|
-
|
|
805
|
-
//#region src/array/insert.ts
|
|
780
|
+
// src/array/insert.ts
|
|
806
781
|
function insert(array, indexOrItems, items) {
|
|
807
782
|
return insertValues(ARRAY_INSERT_TYPE_INSERT, array, items ?? indexOrItems, typeof indexOrItems === "number" ? indexOrItems : array?.length, 0);
|
|
808
783
|
}
|
|
809
|
-
|
|
810
|
-
//#region src/array/intersection.ts
|
|
784
|
+
// src/array/intersection.ts
|
|
811
785
|
function intersection(first, second, key) {
|
|
812
786
|
return compareSets(ARRAY_SETS_COMPARE_INTERSECTION, first, second, key);
|
|
813
787
|
}
|
|
814
|
-
|
|
815
|
-
//#region src/array/partition.ts
|
|
788
|
+
// src/array/partition.ts
|
|
816
789
|
function partition(array, ...parameters) {
|
|
817
790
|
const { matched, notMatched } = findValues("all", array, parameters);
|
|
818
791
|
return [matched, notMatched];
|
|
819
792
|
}
|
|
820
|
-
|
|
821
|
-
//#region src/array/push.ts
|
|
793
|
+
// src/array/push.ts
|
|
822
794
|
/**
|
|
823
795
|
* Push items into an array _(at the end)_
|
|
824
796
|
*
|
|
@@ -836,8 +808,7 @@ function partition(array, ...parameters) {
|
|
|
836
808
|
function push(array, pushed) {
|
|
837
809
|
return insertValues(ARRAY_INSERT_TYPE_PUSH, array, pushed, array.length, 0);
|
|
838
810
|
}
|
|
839
|
-
|
|
840
|
-
//#region src/array/reverse.ts
|
|
811
|
+
// src/array/reverse.ts
|
|
841
812
|
/**
|
|
842
813
|
* Reverse the order of items in an array
|
|
843
814
|
*
|
|
@@ -863,16 +834,14 @@ function reverse(array) {
|
|
|
863
834
|
}
|
|
864
835
|
return array;
|
|
865
836
|
}
|
|
866
|
-
|
|
867
|
-
//#region src/array/single.ts
|
|
837
|
+
// src/array/single.ts
|
|
868
838
|
function single(array, ...parameters) {
|
|
869
839
|
const { matched } = findValues("all", array, parameters, { limit: 2 });
|
|
870
840
|
if (matched.length > 1) throw new Error(SINGLE_MESSAGE);
|
|
871
841
|
return matched[0];
|
|
872
842
|
}
|
|
873
843
|
const SINGLE_MESSAGE = "Multiple items were found";
|
|
874
|
-
|
|
875
|
-
//#region src/array/slice.ts
|
|
844
|
+
// src/array/slice.ts
|
|
876
845
|
function drop(array, first, second) {
|
|
877
846
|
return extract(ARRAY_SLICE_DROP, array, first, second);
|
|
878
847
|
}
|
|
@@ -933,14 +902,12 @@ function slice(array, first, second) {
|
|
|
933
902
|
function take(array, first, second) {
|
|
934
903
|
return extract(ARRAY_SLICE_TAKE, array, first, second);
|
|
935
904
|
}
|
|
936
|
-
|
|
937
|
-
//#region src/array/splice.ts
|
|
905
|
+
// src/array/splice.ts
|
|
938
906
|
function splice(array, start, deleteCountOrItems, items) {
|
|
939
907
|
const deleteCountIsNumber = typeof deleteCountOrItems === "number";
|
|
940
908
|
return insertValues(ARRAY_INSERT_TYPE_SPLICE, array, deleteCountIsNumber ? items : deleteCountOrItems, start, deleteCountIsNumber ? deleteCountOrItems : 0);
|
|
941
909
|
}
|
|
942
|
-
|
|
943
|
-
//#region src/array/to-set.ts
|
|
910
|
+
// src/array/to-set.ts
|
|
944
911
|
function toSet(array, value) {
|
|
945
912
|
if (!Array.isArray(array)) return /* @__PURE__ */ new Set();
|
|
946
913
|
const callbacks = getArrayCallbacks(void 0, void 0, value);
|
|
@@ -950,8 +917,7 @@ function toSet(array, value) {
|
|
|
950
917
|
for (let index = 0; index < length; index += 1) set.add(callbacks.value(array[index], index, array));
|
|
951
918
|
return set;
|
|
952
919
|
}
|
|
953
|
-
|
|
954
|
-
//#region src/internal/array/update.ts
|
|
920
|
+
// src/internal/array/update.ts
|
|
955
921
|
function updateInArray(array, items, key, replace) {
|
|
956
922
|
if (!Array.isArray(array)) return [];
|
|
957
923
|
const itemsIsArray = Array.isArray(items);
|
|
@@ -972,29 +938,24 @@ function updateInArray(array, items, key, replace) {
|
|
|
972
938
|
}
|
|
973
939
|
return array;
|
|
974
940
|
}
|
|
975
|
-
|
|
976
|
-
//#region src/array/toggle.ts
|
|
941
|
+
// src/array/toggle.ts
|
|
977
942
|
function toggle(array, values, key) {
|
|
978
943
|
return updateInArray(array, values, key, false);
|
|
979
944
|
}
|
|
980
|
-
|
|
981
|
-
//#region src/array/union.ts
|
|
945
|
+
// src/array/union.ts
|
|
982
946
|
function union(first, second, key) {
|
|
983
947
|
return compareSets(ARRAY_SETS_COMPARE_UNION, first, second, key);
|
|
984
948
|
}
|
|
985
|
-
|
|
986
|
-
//#region src/array/unique.ts
|
|
949
|
+
// src/array/unique.ts
|
|
987
950
|
function unique(array, key) {
|
|
988
951
|
if (!Array.isArray(array)) return [];
|
|
989
952
|
return array.length > 1 ? findValues(ARRAY_FIND_VALUES_UNIQUE, array, [key, void 0]).matched : array;
|
|
990
953
|
}
|
|
991
|
-
|
|
992
|
-
//#region src/array/update.ts
|
|
954
|
+
// src/array/update.ts
|
|
993
955
|
function update(array, values, key) {
|
|
994
956
|
return updateInArray(array, values, key, true);
|
|
995
957
|
}
|
|
996
|
-
|
|
997
|
-
//#region src/array/last.ts
|
|
958
|
+
// src/array/last.ts
|
|
998
959
|
function last(array, ...parameters) {
|
|
999
960
|
return findAbsoluteValueOrDefault(array, parameters, void 0, false, true);
|
|
1000
961
|
}
|
|
@@ -1002,8 +963,7 @@ function lastOrDefault(array, defaultValue, ...parameters) {
|
|
|
1002
963
|
return findAbsoluteValueOrDefault(array, parameters, defaultValue, true, true);
|
|
1003
964
|
}
|
|
1004
965
|
last.defaulted = lastOrDefault;
|
|
1005
|
-
|
|
1006
|
-
//#region src/internal/array/overlap.ts
|
|
966
|
+
// src/internal/array/overlap.ts
|
|
1007
967
|
function arraysOverlap(first, second) {
|
|
1008
968
|
const firstArray = first.index < second.index ? first.array : second.array;
|
|
1009
969
|
const secondArray = first.index < second.index ? second.array : first.array;
|
|
@@ -1022,8 +982,7 @@ function arraysOverlap(first, second) {
|
|
|
1022
982
|
}
|
|
1023
983
|
};
|
|
1024
984
|
}
|
|
1025
|
-
|
|
1026
|
-
//#region src/array/move.ts
|
|
985
|
+
// src/array/move.ts
|
|
1027
986
|
function move(array, from, to, key) {
|
|
1028
987
|
if (!Array.isArray(array)) return [];
|
|
1029
988
|
const firstArray = Array.isArray(from) ? from : [from];
|
|
@@ -1095,8 +1054,7 @@ function moveToIndex(array, value, index, key) {
|
|
|
1095
1054
|
}
|
|
1096
1055
|
move.indices = moveIndices;
|
|
1097
1056
|
move.toIndex = moveToIndex;
|
|
1098
|
-
|
|
1099
|
-
//#region src/array/select.ts
|
|
1057
|
+
// src/array/select.ts
|
|
1100
1058
|
function filterAndFlatMap(array, filter, mapper) {
|
|
1101
1059
|
return selectValues(array, filter, mapper, true, false);
|
|
1102
1060
|
}
|
|
@@ -1119,8 +1077,7 @@ function selectValues(array, filter, mapper, flat, reverse) {
|
|
|
1119
1077
|
filterAndMap.flat = filterAndFlatMap;
|
|
1120
1078
|
filterAndMap.reverse = mapAndFilter;
|
|
1121
1079
|
mapAndFilter.flat = flatMapAndFilter;
|
|
1122
|
-
|
|
1123
|
-
//#region src/models/value/value.misc.model.ts
|
|
1080
|
+
// src/models/value/value.misc.model.ts
|
|
1124
1081
|
const COMPARE_NAME = "compare";
|
|
1125
1082
|
const VALUE_MISC_EXPRESSION_BRACKET = /\[(\w+)\]/g;
|
|
1126
1083
|
const VALUE_MISC_EXPRESSION_DOTS = /^\.|\.$/g;
|
|
@@ -1129,16 +1086,14 @@ const VALUE_MISC_NESTED_MESSAGE_INPUT = "Expected data to be an object";
|
|
|
1129
1086
|
const VALUE_MISC_NESTED_MESSAGE_MISSING = "Expected property to exist in object";
|
|
1130
1087
|
const VALUE_MISC_NESTED_MESSAGE_PATH = "Expected path to be a string";
|
|
1131
1088
|
const VALUE_MISC_NESTED_MESSAGE_UNSAFE = "Access to this property is not allowed";
|
|
1132
|
-
|
|
1133
|
-
//#region src/models/string/string.misc.model.ts
|
|
1089
|
+
// src/models/string/string.misc.model.ts
|
|
1134
1090
|
const STRING_EXPRESSION_IGNORED = /(^|\.)(__proto__|constructor|prototype)(\.|$)/i;
|
|
1135
1091
|
const STRING_EXPRESSION_WORDS = /[\dA-Za-z\P{ASCII}]+/gu;
|
|
1136
1092
|
const STRING_EXPRESSION_WHITESPACE_PREFIX = /^(\s+)/;
|
|
1137
1093
|
const STRING_MATCH_ENDS_WITH = "endsWith";
|
|
1138
1094
|
const STRING_MATCH_INCLUDES = "includes";
|
|
1139
1095
|
const STRING_MATCH_STARTS_WITH = "startsWith";
|
|
1140
|
-
|
|
1141
|
-
//#region src/internal/result/misc.ts
|
|
1096
|
+
// src/internal/result/misc.ts
|
|
1142
1097
|
function error(value, original) {
|
|
1143
1098
|
return getError(value, original);
|
|
1144
1099
|
}
|
|
@@ -1187,8 +1142,7 @@ const RESULT_PROPERTY_ERROR = "error";
|
|
|
1187
1142
|
const RESULT_PROPERTY_VALUE = "value";
|
|
1188
1143
|
error.is = isError;
|
|
1189
1144
|
ok.is = isOk;
|
|
1190
|
-
|
|
1191
|
-
//#region src/result/misc.ts
|
|
1145
|
+
// src/result/misc.ts
|
|
1192
1146
|
async function toPromise(result) {
|
|
1193
1147
|
const actual = typeof result === "function" ? result() : result;
|
|
1194
1148
|
if (!isResult(actual)) throw new TypeError(RESULT_MESSAGE_PROMISE);
|
|
@@ -1196,8 +1150,7 @@ async function toPromise(result) {
|
|
|
1196
1150
|
throw actual.error;
|
|
1197
1151
|
}
|
|
1198
1152
|
const RESULT_MESSAGE_PROMISE = "toPromise expected to receive a Result";
|
|
1199
|
-
|
|
1200
|
-
//#region src/internal/result/attempt.ts
|
|
1153
|
+
// src/internal/result/attempt.ts
|
|
1201
1154
|
async function asyncAttempt(value, err) {
|
|
1202
1155
|
try {
|
|
1203
1156
|
let result;
|
|
@@ -1217,8 +1170,7 @@ function attempt(callback, err) {
|
|
|
1217
1170
|
}
|
|
1218
1171
|
}
|
|
1219
1172
|
attempt.async = asyncAttempt;
|
|
1220
|
-
|
|
1221
|
-
//#region src/internal/string/misc.ts
|
|
1173
|
+
// src/internal/string/misc.ts
|
|
1222
1174
|
/**
|
|
1223
1175
|
* Get the string value from any value
|
|
1224
1176
|
*
|
|
@@ -1315,8 +1267,7 @@ function words(value) {
|
|
|
1315
1267
|
if (typeof value === "string") return value.match(STRING_EXPRESSION_WORDS) ?? [];
|
|
1316
1268
|
return [];
|
|
1317
1269
|
}
|
|
1318
|
-
|
|
1319
|
-
//#region src/internal/value/handlers.ts
|
|
1270
|
+
// src/internal/value/handlers.ts
|
|
1320
1271
|
function BaseHandler(owner, options) {
|
|
1321
1272
|
this.handlers = /* @__PURE__ */ new WeakMap();
|
|
1322
1273
|
this.owner = owner;
|
|
@@ -1368,8 +1319,7 @@ function handleValue$1(value, ...parameters) {
|
|
|
1368
1319
|
if (handler == null) return this.base.options.callback(value, ...parameters);
|
|
1369
1320
|
return typeof handler === "function" ? handler(value) : value[handler]();
|
|
1370
1321
|
}
|
|
1371
|
-
|
|
1372
|
-
//#region src/internal/value/compare.ts
|
|
1322
|
+
// src/internal/value/compare.ts
|
|
1373
1323
|
/**
|
|
1374
1324
|
* Compare two values _(for sorting purposes)_
|
|
1375
1325
|
*
|
|
@@ -1452,8 +1402,7 @@ const compareHandler = createCompareHandler(compare, {
|
|
|
1452
1402
|
compare.deregister = deregisterComparator;
|
|
1453
1403
|
compare.handler = compareHandler;
|
|
1454
1404
|
compare.register = registerComparator;
|
|
1455
|
-
|
|
1456
|
-
//#region src/models/array/array.sort.model.ts
|
|
1405
|
+
// src/models/array/array.sort.model.ts
|
|
1457
1406
|
const SORT_DIRECTION_ASCENDING = "ascending";
|
|
1458
1407
|
const SORT_DIRECTION_DESCENDING = "descending";
|
|
1459
1408
|
const SORTER_SYMBOL = Symbol("sorter");
|
|
@@ -1461,8 +1410,7 @@ const arrayModifiers = {
|
|
|
1461
1410
|
[SORT_DIRECTION_ASCENDING]: 1,
|
|
1462
1411
|
[SORT_DIRECTION_DESCENDING]: -1
|
|
1463
1412
|
};
|
|
1464
|
-
|
|
1465
|
-
//#region src/array/sort.ts
|
|
1413
|
+
// src/array/sort.ts
|
|
1466
1414
|
function Sorter(sorters) {
|
|
1467
1415
|
this[SORTER_SYMBOL] = sorters;
|
|
1468
1416
|
}
|
|
@@ -1594,8 +1542,7 @@ function sortArray(array) {
|
|
|
1594
1542
|
sort.getIndex = getSortedIndex;
|
|
1595
1543
|
sort.initialize = initializeSorter;
|
|
1596
1544
|
sort.is = isSorted;
|
|
1597
|
-
|
|
1598
|
-
//#region src/internal/array/index-of.ts
|
|
1545
|
+
// src/internal/array/index-of.ts
|
|
1599
1546
|
function indexOf(array, ...parameters) {
|
|
1600
1547
|
return findValue(ARRAY_FIND_VALUE_INDEX, array, parameters, false);
|
|
1601
1548
|
}
|
|
@@ -1603,8 +1550,7 @@ function lastIndexOf(array, ...parameters) {
|
|
|
1603
1550
|
return findValue(ARRAY_FIND_VALUE_INDEX, array, parameters, true);
|
|
1604
1551
|
}
|
|
1605
1552
|
indexOf.last = lastIndexOf;
|
|
1606
|
-
|
|
1607
|
-
//#region src/array/swap.ts
|
|
1553
|
+
// src/array/swap.ts
|
|
1608
1554
|
function swap(array, first, second, third) {
|
|
1609
1555
|
if (!Array.isArray(array)) return [];
|
|
1610
1556
|
if (array.length === 0) return array;
|
|
@@ -1660,8 +1606,7 @@ function swapValues(array, from, to, key) {
|
|
|
1660
1606
|
return swapIndices(array, first, second);
|
|
1661
1607
|
}
|
|
1662
1608
|
swap.indices = swapIndices;
|
|
1663
|
-
|
|
1664
|
-
//#region src/array/to-map.ts
|
|
1609
|
+
// src/array/to-map.ts
|
|
1665
1610
|
function getMapValues(array, first, second, arrays) {
|
|
1666
1611
|
if (!Array.isArray(array)) return /* @__PURE__ */ new Map();
|
|
1667
1612
|
const { length } = array;
|
|
@@ -1686,8 +1631,7 @@ function toMapArrays(array, first, second) {
|
|
|
1686
1631
|
return getMapValues(array, first, second, true);
|
|
1687
1632
|
}
|
|
1688
1633
|
toMap.arrays = toMapArrays;
|
|
1689
|
-
|
|
1690
|
-
//#region src/array/to-record.ts
|
|
1634
|
+
// src/array/to-record.ts
|
|
1691
1635
|
function toRecord(array, first, second) {
|
|
1692
1636
|
return groupValues(array, first, second, false);
|
|
1693
1637
|
}
|
|
@@ -1695,14 +1639,16 @@ function toRecordArrays(array, first, second) {
|
|
|
1695
1639
|
return groupValues(array, first, second, true);
|
|
1696
1640
|
}
|
|
1697
1641
|
toRecord.arrays = toRecordArrays;
|
|
1698
|
-
|
|
1699
|
-
//#region src/internal/function/misc.ts
|
|
1642
|
+
// src/internal/function/misc.ts
|
|
1700
1643
|
/**
|
|
1701
1644
|
* A function that does nothing, which can be useful, I guess…
|
|
1702
1645
|
*/
|
|
1703
1646
|
function noop() {}
|
|
1704
|
-
|
|
1705
|
-
|
|
1647
|
+
function unwrapWork(value) {
|
|
1648
|
+
if (isError(value)) throw value.error;
|
|
1649
|
+
return isOk(value) ? value.value : value;
|
|
1650
|
+
}
|
|
1651
|
+
// src/models/function/limiter.model.ts
|
|
1706
1652
|
const LIMITER_DEBOUNCE = "debounce";
|
|
1707
1653
|
const LIMITER_NAME_ASYNC = "asyncLimiter";
|
|
1708
1654
|
const LIMITER_NAME_SYNC = "limiter";
|
|
@@ -1714,16 +1660,14 @@ const LIMITER_WAIT = "wait";
|
|
|
1714
1660
|
const clearTimer = typeof cancelAnimationFrame === "function" ? cancelAnimationFrame : clearTimeout;
|
|
1715
1661
|
// istanbul ignore next
|
|
1716
1662
|
const startTimer = typeof requestAnimationFrame === "function" ? requestAnimationFrame : setTimeout;
|
|
1717
|
-
|
|
1718
|
-
//#region src/internal/defaults.ts
|
|
1663
|
+
// src/internal/defaults.ts
|
|
1719
1664
|
function getBooleanOrDefault(value, defaultValue) {
|
|
1720
1665
|
return typeof value === "boolean" ? value : defaultValue;
|
|
1721
1666
|
}
|
|
1722
1667
|
function getNumberOrDefault(value, defaultValue, minimum) {
|
|
1723
1668
|
return typeof value === "number" && !Number.isNaN(value) && value >= (minimum ?? 0) ? value : defaultValue;
|
|
1724
1669
|
}
|
|
1725
|
-
|
|
1726
|
-
//#region src/internal/function/limit.ts
|
|
1670
|
+
// src/internal/function/limit.ts
|
|
1727
1671
|
function AsyncLimiter(type, callback, time) {
|
|
1728
1672
|
this[LIMITER_SYMBOL] = {
|
|
1729
1673
|
callback,
|
|
@@ -1813,8 +1757,7 @@ function runLimiter(...parameters) {
|
|
|
1813
1757
|
if (state.throttle) handleLimiter(state);
|
|
1814
1758
|
else state.timer = startTimer(() => handleLimiter(state));
|
|
1815
1759
|
}
|
|
1816
|
-
|
|
1817
|
-
//#region src/function/limit.ts
|
|
1760
|
+
// src/function/limit.ts
|
|
1818
1761
|
/**
|
|
1819
1762
|
* Debounce a function, ensuring it is only called after `time` milliseconds have passed
|
|
1820
1763
|
*
|
|
@@ -1869,8 +1812,7 @@ function throttle(callback, time) {
|
|
|
1869
1812
|
}
|
|
1870
1813
|
debounce.async = asyncDebounce;
|
|
1871
1814
|
throttle.async = asyncThrottle;
|
|
1872
|
-
|
|
1873
|
-
//#region src/internal/value/misc.ts
|
|
1815
|
+
// src/internal/value/misc.ts
|
|
1874
1816
|
function findKey(needle, haystack) {
|
|
1875
1817
|
const keys = Object.keys(haystack);
|
|
1876
1818
|
const index = keys.map((key) => key.toLowerCase()).indexOf(needle.toLowerCase());
|
|
@@ -1907,8 +1849,7 @@ function handleValue(data, path, value, get, ignoreCase) {
|
|
|
1907
1849
|
}
|
|
1908
1850
|
if (get) return error(VALUE_MISC_NESTED_MESSAGE_MISSING);
|
|
1909
1851
|
}
|
|
1910
|
-
|
|
1911
|
-
//#region src/internal/value/has.ts
|
|
1852
|
+
// src/internal/value/has.ts
|
|
1912
1853
|
function hasValue(data, path, ignoreCase) {
|
|
1913
1854
|
return getNestedValue(data, path, ignoreCase === true).ok;
|
|
1914
1855
|
}
|
|
@@ -1916,8 +1857,7 @@ function hasValueResult(data, path, ignoreCase) {
|
|
|
1916
1857
|
return getNestedValue(data, path, ignoreCase === true);
|
|
1917
1858
|
}
|
|
1918
1859
|
hasValue.get = hasValueResult;
|
|
1919
|
-
|
|
1920
|
-
//#region src/internal/function/assert.ts
|
|
1860
|
+
// src/internal/function/assert.ts
|
|
1921
1861
|
/**
|
|
1922
1862
|
* Asserts that a condition is true, throwing an error if it is not
|
|
1923
1863
|
*
|
|
@@ -2007,16 +1947,14 @@ assert.defined = assertDefined;
|
|
|
2007
1947
|
assert.instanceOf = assertInstanceOf;
|
|
2008
1948
|
assert.is = assertIs;
|
|
2009
1949
|
assert.property = assertProperty;
|
|
2010
|
-
|
|
2011
|
-
//#region src/models/function/once.model.ts
|
|
1950
|
+
// src/models/function/once.model.ts
|
|
2012
1951
|
const ONCE_NAME_ASYNC = "asyncOnce";
|
|
2013
1952
|
const ONCE_NAME_SYNC = "once";
|
|
2014
1953
|
const ONCE_PROPERTY = "$once";
|
|
2015
1954
|
const ONCE_MESSAGE_CLEARED = "Once has been cleared";
|
|
2016
1955
|
const ONCE_MESSAGE_EXPECTATION = "Once expected a function";
|
|
2017
1956
|
const ONCE_SYMBOL = Symbol(ONCE_PROPERTY);
|
|
2018
|
-
|
|
2019
|
-
//#region src/function/once.ts
|
|
1957
|
+
// src/function/once.ts
|
|
2020
1958
|
function AsyncOnce(callback) {
|
|
2021
1959
|
this[ONCE_SYMBOL] = {
|
|
2022
1960
|
callback,
|
|
@@ -2179,8 +2117,7 @@ asyncOnce.is = isAsyncOnce;
|
|
|
2179
2117
|
once.async = asyncOnce;
|
|
2180
2118
|
once.is = isOnce;
|
|
2181
2119
|
once.isAsync = isAsyncOnce;
|
|
2182
|
-
|
|
2183
|
-
//#region src/models/function/retry.model.ts
|
|
2120
|
+
// src/models/function/retry.model.ts
|
|
2184
2121
|
/**
|
|
2185
2122
|
* An error thrown when a retry fails
|
|
2186
2123
|
*/
|
|
@@ -2195,8 +2132,7 @@ var RetryError = class extends Error {
|
|
|
2195
2132
|
const RETRY_ERROR_NAME = "RetryError";
|
|
2196
2133
|
const RETRY_MESSAGE_EXPECTATION = "Retry expected a function";
|
|
2197
2134
|
const RETRY_MESSAGE_FAILED = "Retry failed";
|
|
2198
|
-
|
|
2199
|
-
//#region src/function/retry.ts
|
|
2135
|
+
// src/function/retry.ts
|
|
2200
2136
|
/**
|
|
2201
2137
|
* Retry a callback a specified number of times, with a delay between attempts
|
|
2202
2138
|
*
|
|
@@ -2264,13 +2200,11 @@ function shouldRetry() {
|
|
|
2264
2200
|
return true;
|
|
2265
2201
|
}
|
|
2266
2202
|
retry.async = asyncRetry;
|
|
2267
|
-
|
|
2268
|
-
//#region src/models/function/memoize.model.ts
|
|
2203
|
+
// src/models/function/memoize.model.ts
|
|
2269
2204
|
const MEMOIZED_CACHE_SIZE_DEFAULT = 1024;
|
|
2270
2205
|
const MEMOIZED_CALLBACK = "Memoized requires a callback function";
|
|
2271
2206
|
const MEMOIZED_SYMBOL = Symbol("memoized");
|
|
2272
|
-
|
|
2273
|
-
//#region src/models/misc.model.ts
|
|
2207
|
+
// src/models/misc.model.ts
|
|
2274
2208
|
const EXPRESSION_INTEGER = /^\d+$/;
|
|
2275
2209
|
const EXPRESSION_NUMBER_BINARY = /^0b[01]+$/i;
|
|
2276
2210
|
const EXPRESSION_NUMBER_OCTAL = /^0o[0-7]+$/i;
|
|
@@ -2278,8 +2212,7 @@ const EXPRESSION_NUMBER_ZEROISH = /^\s*0+\s*$/;
|
|
|
2278
2212
|
const EXPRESSION_NUMERICAL_PREFIX = /^\d/;
|
|
2279
2213
|
const EXPRESSION_WHITESPACE_MULTIPLE = /\s+/g;
|
|
2280
2214
|
const EXPRESSION_WHITESPACE_ONLY = /^\s*$/;
|
|
2281
|
-
|
|
2282
|
-
//#region src/internal/number.ts
|
|
2215
|
+
// src/internal/number.ts
|
|
2283
2216
|
/**
|
|
2284
2217
|
* Is the number between a minimum and maximum value?
|
|
2285
2218
|
*
|
|
@@ -2363,8 +2296,7 @@ function getNumber(value) {
|
|
|
2363
2296
|
if (isBinary || EXPRESSION_NUMBER_OCTAL.test(trimmed)) return Number.parseInt(trimmed.slice(2), isBinary ? 2 : 8);
|
|
2364
2297
|
return Number(trimmed);
|
|
2365
2298
|
}
|
|
2366
|
-
|
|
2367
|
-
//#region src/internal/sized/misc.ts
|
|
2299
|
+
// src/internal/sized/misc.ts
|
|
2368
2300
|
function getSizedMaximum(first, second) {
|
|
2369
2301
|
let actual;
|
|
2370
2302
|
if (typeof first === "number") actual = first;
|
|
@@ -2373,8 +2305,7 @@ function getSizedMaximum(first, second) {
|
|
|
2373
2305
|
}
|
|
2374
2306
|
const SIZED_MAXIMUM_ABSOLUTE = 16777216;
|
|
2375
2307
|
const SIZED_MAXIMUM_DEFAULT = 1048576;
|
|
2376
|
-
|
|
2377
|
-
//#region src/internal/sized/map.ts
|
|
2308
|
+
// src/internal/sized/map.ts
|
|
2378
2309
|
/**
|
|
2379
2310
|
* A _Map_ with a maximum size
|
|
2380
2311
|
*
|
|
@@ -2428,8 +2359,7 @@ var SizedMap = class extends Map {
|
|
|
2428
2359
|
return this;
|
|
2429
2360
|
}
|
|
2430
2361
|
};
|
|
2431
|
-
|
|
2432
|
-
//#region src/internal/function/memoize.ts
|
|
2362
|
+
// src/internal/function/memoize.ts
|
|
2433
2363
|
function Memoized(callback, options) {
|
|
2434
2364
|
this[MEMOIZED_SYMBOL] = {
|
|
2435
2365
|
options,
|
|
@@ -2501,8 +2431,7 @@ function memoize(callback, options) {
|
|
|
2501
2431
|
function runMemoized(...parameters) {
|
|
2502
2432
|
return this[MEMOIZED_SYMBOL].getter(...parameters);
|
|
2503
2433
|
}
|
|
2504
|
-
|
|
2505
|
-
//#region src/models/function/work.model.ts
|
|
2434
|
+
// src/models/function/work.model.ts
|
|
2506
2435
|
const WORK_MESSAGE_FLOW_ARRAY = "Flow expected to receive an array of functions";
|
|
2507
2436
|
const WORK_MESSAGE_FLOW_PROMISE = "Synchronous Flow received a promise. Use `flow.async` instead.";
|
|
2508
2437
|
const WORK_MESSAGE_NESTING = "Return values are too deeply nested.";
|
|
@@ -2510,21 +2439,14 @@ const WORK_MESSAGE_PIPE_ARRAY = "Pipe expected to receive an array of functions"
|
|
|
2510
2439
|
const WORK_MESSAGE_PIPE_PROMISE = "Synchronous Pipe received a promise. Use `pipe.async` instead.";
|
|
2511
2440
|
const assertFlowFunctions = assert.condition((value) => Array.isArray(value) && value.every((item) => typeof item === "function"), WORK_MESSAGE_FLOW_ARRAY, TypeError);
|
|
2512
2441
|
const assertPipeFunctions = assert.condition((value) => Array.isArray(value) && value.every((item) => typeof item === "function"), WORK_MESSAGE_PIPE_ARRAY, TypeError);
|
|
2513
|
-
|
|
2514
|
-
//#region src/internal/function/work.ts
|
|
2442
|
+
// src/internal/function/work.ts
|
|
2515
2443
|
function asyncFlow(...fns) {
|
|
2516
2444
|
assertFlowFunctions(fns);
|
|
2517
|
-
return (...args) => asyncWork(args.map(
|
|
2518
|
-
if (isError(value)) throw value.error;
|
|
2519
|
-
return isOk(value) ? value.value : value;
|
|
2520
|
-
}), fns, true);
|
|
2445
|
+
return (...args) => asyncWork(args.map(unwrapWork), fns, true);
|
|
2521
2446
|
}
|
|
2522
2447
|
function flow(...fns) {
|
|
2523
2448
|
assertFlowFunctions(fns);
|
|
2524
|
-
return (...args) => work(args.map(
|
|
2525
|
-
if (isError(value)) throw value.error;
|
|
2526
|
-
return isOk(value) ? value.value : value;
|
|
2527
|
-
}), fns, true);
|
|
2449
|
+
return (...args) => work(args.map(unwrapWork), fns, true);
|
|
2528
2450
|
}
|
|
2529
2451
|
async function asyncPipe(value, ...pipes) {
|
|
2530
2452
|
assertPipeFunctions(pipes);
|
|
@@ -2549,8 +2471,7 @@ function unwrapValue(value, flow, nested) {
|
|
|
2549
2471
|
return unwrapValue(value(), flow, true);
|
|
2550
2472
|
}
|
|
2551
2473
|
if (flow != null && value instanceof Promise) throw new TypeError(flow ? WORK_MESSAGE_FLOW_PROMISE : WORK_MESSAGE_PIPE_PROMISE);
|
|
2552
|
-
|
|
2553
|
-
return isOk(value) ? value.value : value;
|
|
2474
|
+
return unwrapWork(value);
|
|
2554
2475
|
}
|
|
2555
2476
|
function work(initial, functions, flow) {
|
|
2556
2477
|
const { length } = functions;
|
|
@@ -2563,8 +2484,7 @@ function work(initial, functions, flow) {
|
|
|
2563
2484
|
}
|
|
2564
2485
|
flow.async = asyncFlow;
|
|
2565
2486
|
pipe.async = asyncPipe;
|
|
2566
|
-
|
|
2567
|
-
//#region src/models/string/string.case.model.ts
|
|
2487
|
+
// src/models/string/string.case.model.ts
|
|
2568
2488
|
const STRING_CASE_CAMEL = "camel";
|
|
2569
2489
|
const STRING_CASE_CAPITALIZE = "capitalize";
|
|
2570
2490
|
const STRING_CASE_KEBAB = "kebab";
|
|
@@ -2577,8 +2497,7 @@ const STRING_EXPRESSION_CAMEL_CASE = /(\p{Ll})(\p{Lu})/gu;
|
|
|
2577
2497
|
const STRING_EXPRESSION_ACRONYM = /(?<=\p{Lu})(?=\p{Lu}\p{Ll})(?!\p{Lu}s(?!\p{Ll}))/gu;
|
|
2578
2498
|
const STRING_REPLACEMENT_CAMEL_CASE = "$1-$2";
|
|
2579
2499
|
const ignoreCachingCases = /* @__PURE__ */ new Set(["lower", "upper"]);
|
|
2580
|
-
|
|
2581
|
-
//#region src/internal/string/case.ts
|
|
2500
|
+
// src/internal/string/case.ts
|
|
2582
2501
|
/**
|
|
2583
2502
|
* Convert a string to camel case _(thisIsCamelCase)_
|
|
2584
2503
|
*
|
|
@@ -2771,13 +2690,11 @@ const delimiters = {
|
|
|
2771
2690
|
[STRING_CASE_SNAKE]: "_"
|
|
2772
2691
|
};
|
|
2773
2692
|
const simpleMemoizers = {};
|
|
2774
|
-
|
|
2775
|
-
//#region src/models/value/value.equal.model.ts
|
|
2693
|
+
// src/models/value/value.equal.model.ts
|
|
2776
2694
|
const EQUAL_ERROR_PROPERTIES = ["name", "message"];
|
|
2777
2695
|
const EQUAL_EXPRESSION_PROPERTIES = ["source", "flags"];
|
|
2778
2696
|
const EQUAL_SYMBOL = Symbol("equal");
|
|
2779
|
-
|
|
2780
|
-
//#region src/internal/value/equal.ts
|
|
2697
|
+
// src/internal/value/equal.ts
|
|
2781
2698
|
function Equalizer(options) {
|
|
2782
2699
|
this[EQUAL_SYMBOL] = options;
|
|
2783
2700
|
}
|
|
@@ -2950,13 +2867,11 @@ equal.deregister = deregisterEqualizer;
|
|
|
2950
2867
|
equal.handler = equalHandler;
|
|
2951
2868
|
equal.initialize = initializeEqualizer;
|
|
2952
2869
|
equal.register = registerEqualizer;
|
|
2953
|
-
|
|
2954
|
-
//#region src/internal/value/get.ts
|
|
2870
|
+
// src/internal/value/get.ts
|
|
2955
2871
|
function getValue(data, path, ignoreCase) {
|
|
2956
2872
|
return getNestedValue(data, path, ignoreCase === true).value;
|
|
2957
2873
|
}
|
|
2958
|
-
|
|
2959
|
-
//#region src/internal/value/set.ts
|
|
2874
|
+
// src/internal/value/set.ts
|
|
2960
2875
|
function setValue(data, path, value, ignoreCase) {
|
|
2961
2876
|
if (typeof data !== "object" || data === null || typeof path !== "string" || path.trim().length === 0) return data;
|
|
2962
2877
|
const shouldIgnoreCase = ignoreCase === true;
|
|
@@ -2985,8 +2900,7 @@ function setValue(data, path, value, ignoreCase) {
|
|
|
2985
2900
|
}
|
|
2986
2901
|
return data;
|
|
2987
2902
|
}
|
|
2988
|
-
|
|
2989
|
-
//#region src/models/plan.model.ts
|
|
2903
|
+
// src/models/plan.model.ts
|
|
2990
2904
|
const GENERATOR_FUNCTION_TYPE_ASYNC = "[object AsyncGeneratorFunction]";
|
|
2991
2905
|
const GENERATOR_FUNCTION_TYPE_SYNC = "[object GeneratorFunction]";
|
|
2992
2906
|
const GENERATOR_TYPE_ASYNC = "[object AsyncGenerator]";
|
|
@@ -3004,12 +2918,10 @@ const PLAN_SUCCESS_SYNC = "success";
|
|
|
3004
2918
|
const PLAN_SYMBOL = Symbol("plan");
|
|
3005
2919
|
const PLAN_TYPE_ASYNC = "asyncPlan";
|
|
3006
2920
|
const PLAN_TYPE_SYNC = "plan";
|
|
3007
|
-
|
|
3008
|
-
//#region src/models/aborter.model.ts
|
|
2921
|
+
// src/models/aborter.model.ts
|
|
3009
2922
|
const ABORTER_EVENT = "abort";
|
|
3010
2923
|
const ABORTER_OPTIONS = { once: true };
|
|
3011
|
-
|
|
3012
|
-
//#region src/internal/aborter.ts
|
|
2924
|
+
// src/internal/aborter.ts
|
|
3013
2925
|
function createAborter(value, onAbort) {
|
|
3014
2926
|
if (!(value instanceof AbortSignal)) return;
|
|
3015
2927
|
value.addEventListener(ABORTER_EVENT, onAbort, ABORTER_OPTIONS);
|
|
@@ -3019,8 +2931,7 @@ function createAborter(value, onAbort) {
|
|
|
3019
2931
|
cancel: () => value.removeEventListener(ABORTER_EVENT, onAbort)
|
|
3020
2932
|
};
|
|
3021
2933
|
}
|
|
3022
|
-
|
|
3023
|
-
//#region src/internal/plan/plan.generate.ts
|
|
2934
|
+
// src/internal/plan/plan.generate.ts
|
|
3024
2935
|
async function asyncGenerate(input, unwrap, first, second) {
|
|
3025
2936
|
const aborter = createAborter(second ?? first, noop);
|
|
3026
2937
|
if (aborter?.signal.aborted) throw aborter.signal.reason;
|
|
@@ -3077,8 +2988,7 @@ function generate(input, parameters, unwrap) {
|
|
|
3077
2988
|
if (success) return unwrap && isOk(lastValue) ? lastValue.value : lastValue;
|
|
3078
2989
|
throw lastValue;
|
|
3079
2990
|
}
|
|
3080
|
-
|
|
3081
|
-
//#region src/internal/plan/index.ts
|
|
2991
|
+
// src/internal/plan/index.ts
|
|
3082
2992
|
function attemptRunPlan(...parameters) {
|
|
3083
2993
|
return attempt(() => generate(this[PLAN_SYMBOL], parameters, true));
|
|
3084
2994
|
}
|
|
@@ -3091,8 +3001,7 @@ function runAsyncPlan(first, second) {
|
|
|
3091
3001
|
function runPlan(...parameters) {
|
|
3092
3002
|
return generate(this[PLAN_SYMBOL], parameters, false);
|
|
3093
3003
|
}
|
|
3094
|
-
|
|
3095
|
-
//#region src/plan/is.ts
|
|
3004
|
+
// src/plan/is.ts
|
|
3096
3005
|
/**
|
|
3097
3006
|
* Is the value an asynchronous, immediately failing plan?
|
|
3098
3007
|
*
|
|
@@ -3207,8 +3116,7 @@ function isStep(value) {
|
|
|
3207
3116
|
function isSuccess(value) {
|
|
3208
3117
|
return isPlanInstance(PLAN_SUCCESS_SYNC, value);
|
|
3209
3118
|
}
|
|
3210
|
-
|
|
3211
|
-
//#region src/plan/result.ts
|
|
3119
|
+
// src/plan/result.ts
|
|
3212
3120
|
function asyncAttemptRun(input, first, second) {
|
|
3213
3121
|
let generator;
|
|
3214
3122
|
if (isAsyncPlan(input)) generator = input[PLAN_SYMBOL];
|
|
@@ -3224,8 +3132,7 @@ function attemptRun(input, ...parameters) {
|
|
|
3224
3132
|
return attempt(() => generate(generator, parameters, true));
|
|
3225
3133
|
}
|
|
3226
3134
|
attemptRun.async = asyncAttemptRun;
|
|
3227
|
-
|
|
3228
|
-
//#region src/plan/index.ts
|
|
3135
|
+
// src/plan/index.ts
|
|
3229
3136
|
function AsyncPlan(generator) {
|
|
3230
3137
|
this[PLAN_SYMBOL] = {
|
|
3231
3138
|
generator,
|
|
@@ -3252,8 +3159,7 @@ function plan(generator) {
|
|
|
3252
3159
|
if (isGeneratorFunction(generator)) return new Plan(generator);
|
|
3253
3160
|
throw new Error(PLAN_MESSAGE_PLAN_INPUT);
|
|
3254
3161
|
}
|
|
3255
|
-
|
|
3256
|
-
//#region src/plan/misc.ts
|
|
3162
|
+
// src/plan/misc.ts
|
|
3257
3163
|
function AsyncFailure(generator) {
|
|
3258
3164
|
this[PLAN_SYMBOL] = {
|
|
3259
3165
|
generator,
|
|
@@ -3304,8 +3210,7 @@ function succeed(value) {
|
|
|
3304
3210
|
}
|
|
3305
3211
|
fail.async = asyncFail;
|
|
3306
3212
|
succeed.async = asyncSucceed;
|
|
3307
|
-
|
|
3308
|
-
//#region src/plan/run.ts
|
|
3213
|
+
// src/plan/run.ts
|
|
3309
3214
|
function asyncRun(input, first, second) {
|
|
3310
3215
|
if (isAsyncPlan(input)) return asyncGenerate(input[PLAN_SYMBOL], false, first, second);
|
|
3311
3216
|
if (isAsyncGeneratorFunction(input)) return asyncGenerate(input, false, first, second);
|
|
@@ -3319,8 +3224,7 @@ function run(input, ...parameters) {
|
|
|
3319
3224
|
asyncRun.attempt = asyncAttemptRun;
|
|
3320
3225
|
run.async = asyncRun;
|
|
3321
3226
|
run.attempt = attemptRun;
|
|
3322
|
-
|
|
3323
|
-
//#region src/plan/use.ts
|
|
3227
|
+
// src/plan/use.ts
|
|
3324
3228
|
function AsyncStep(generator) {
|
|
3325
3229
|
this[PLAN_SYMBOL] = {
|
|
3326
3230
|
generator,
|
|
@@ -3382,8 +3286,7 @@ function validateUseInput(value, resolved) {
|
|
|
3382
3286
|
if (resolved && typeof value === "function") throw new Error(PLAN_MESSAGE_USE_NESTED_FN);
|
|
3383
3287
|
}
|
|
3384
3288
|
use.async = asyncUse;
|
|
3385
|
-
|
|
3386
|
-
//#region src/models/promise.model.ts
|
|
3289
|
+
// src/models/promise.model.ts
|
|
3387
3290
|
/**
|
|
3388
3291
|
* A _Promise_ that can be canceled
|
|
3389
3292
|
*/
|
|
@@ -3426,8 +3329,7 @@ const PROMISE_STRATEGY_ALL = /* @__PURE__ */ new Set(["complete", "first"]);
|
|
|
3426
3329
|
const PROMISE_STRATEGY_DEFAULT = "complete";
|
|
3427
3330
|
const PROMISE_TYPE_FULFILLED = "fulfilled";
|
|
3428
3331
|
const PROMISE_TYPE_REJECTED = "rejected";
|
|
3429
|
-
|
|
3430
|
-
//#region src/promise/helpers.ts
|
|
3332
|
+
// src/promise/helpers.ts
|
|
3431
3333
|
function createPromiseOptions(input) {
|
|
3432
3334
|
if (typeof input === "number") return { time: getNumberOrDefault(input, 0) };
|
|
3433
3335
|
if (input instanceof AbortSignal) return {
|
|
@@ -3487,8 +3389,7 @@ function isPromiseResult(value, type) {
|
|
|
3487
3389
|
function isRejected(value) {
|
|
3488
3390
|
return isPromiseResult(value, PROMISE_TYPE_REJECTED);
|
|
3489
3391
|
}
|
|
3490
|
-
|
|
3491
|
-
//#region src/promise/misc.ts
|
|
3392
|
+
// src/promise/misc.ts
|
|
3492
3393
|
/**
|
|
3493
3394
|
* Create a cancelable _Promise_
|
|
3494
3395
|
*
|
|
@@ -3536,8 +3437,7 @@ async function toResult(value) {
|
|
|
3536
3437
|
if (!(actual instanceof Promise)) throw new TypeError(PROMISE_MESSAGE_EXPECTATION_RESULT);
|
|
3537
3438
|
return actual.then((result) => ok(result)).catch((reason) => error(reason));
|
|
3538
3439
|
}
|
|
3539
|
-
|
|
3540
|
-
//#region src/promise/delay.ts
|
|
3440
|
+
// src/promise/delay.ts
|
|
3541
3441
|
function delay(options) {
|
|
3542
3442
|
const { signal, time } = createPromiseOptions(options);
|
|
3543
3443
|
if (signal?.aborted ?? false) return Promise.reject(signal?.reason);
|
|
@@ -3555,8 +3455,7 @@ function delay(options) {
|
|
|
3555
3455
|
else limiter.run();
|
|
3556
3456
|
});
|
|
3557
3457
|
}
|
|
3558
|
-
|
|
3559
|
-
//#region src/promise/timed.ts
|
|
3458
|
+
// src/promise/timed.ts
|
|
3560
3459
|
/**
|
|
3561
3460
|
* @internal
|
|
3562
3461
|
*/
|
|
@@ -3583,8 +3482,7 @@ async function timed(promise, options) {
|
|
|
3583
3482
|
if (signal?.aborted ?? false) throw signal?.reason;
|
|
3584
3483
|
return time > 0 ? getTimedPromise(promise, time, signal) : promise;
|
|
3585
3484
|
}
|
|
3586
|
-
|
|
3587
|
-
//#region src/promise/index.ts
|
|
3485
|
+
// src/promise/index.ts
|
|
3588
3486
|
async function attemptPromise(value, options) {
|
|
3589
3487
|
const isFunction = typeof value === "function";
|
|
3590
3488
|
if (!isFunction && !(value instanceof Promise)) throw new TypeError(PROMISE_MESSAGE_EXPECTATION_ATTEMPT);
|
|
@@ -3654,8 +3552,7 @@ async function resultPromises(items, signal) {
|
|
|
3654
3552
|
return promises(items, signal).then(getResultsFromPromises);
|
|
3655
3553
|
}
|
|
3656
3554
|
promises.result = resultPromises;
|
|
3657
|
-
|
|
3658
|
-
//#region src/result/match.ts
|
|
3555
|
+
// src/result/match.ts
|
|
3659
3556
|
async function asyncMatchResult(result, first, second) {
|
|
3660
3557
|
let value;
|
|
3661
3558
|
if (typeof result === "function") value = await result();
|
|
@@ -3690,31 +3587,23 @@ const MATCH_MESSAGE_ERROR = "`result.match` expected an Error callback";
|
|
|
3690
3587
|
const MATCH_MESSAGE_OK = "`result.match` expected an Ok callback";
|
|
3691
3588
|
const MATCH_MESSAGE_RESULT = "`result.match` expected a Result or a function that returns a Result";
|
|
3692
3589
|
matchResult.async = asyncMatchResult;
|
|
3693
|
-
|
|
3694
|
-
//#region src/result/work/flow.ts
|
|
3590
|
+
// src/result/work/flow.ts
|
|
3695
3591
|
function attemptAsyncFlow(...fns) {
|
|
3696
3592
|
let Flow;
|
|
3697
3593
|
return (...args) => asyncAttempt(() => {
|
|
3698
3594
|
Flow ??= asyncFlow(...fns);
|
|
3699
|
-
return Flow(...args.map(
|
|
3700
|
-
if (isError(value)) throw value.error;
|
|
3701
|
-
return isOk(value) ? value.value : value;
|
|
3702
|
-
}));
|
|
3595
|
+
return Flow(...args.map(unwrapWork));
|
|
3703
3596
|
});
|
|
3704
3597
|
}
|
|
3705
3598
|
function attemptFlow(...fns) {
|
|
3706
3599
|
let Flow;
|
|
3707
3600
|
return (...args) => attempt(() => {
|
|
3708
3601
|
Flow ??= flow(...fns);
|
|
3709
|
-
return Flow(...args.map(
|
|
3710
|
-
if (isError(value)) throw value.error;
|
|
3711
|
-
return isOk(value) ? value.value : value;
|
|
3712
|
-
}));
|
|
3602
|
+
return Flow(...args.map(unwrapWork));
|
|
3713
3603
|
});
|
|
3714
3604
|
}
|
|
3715
3605
|
attemptFlow.async = attemptAsyncFlow;
|
|
3716
|
-
|
|
3717
|
-
//#region src/result/work/pipe.ts
|
|
3606
|
+
// src/result/work/pipe.ts
|
|
3718
3607
|
async function attemptAsyncPipe(initial, first, ...seconds) {
|
|
3719
3608
|
return asyncAttempt(async () => {
|
|
3720
3609
|
if (isError(initial)) throw initial.error;
|
|
@@ -3736,15 +3625,13 @@ function attemptPipe(initial, first, ...seconds) {
|
|
|
3736
3625
|
});
|
|
3737
3626
|
}
|
|
3738
3627
|
attemptPipe.async = attemptAsyncPipe;
|
|
3739
|
-
|
|
3740
|
-
//#region src/models/string/string.fuzzy.model.ts
|
|
3628
|
+
// src/models/string/string.fuzzy.model.ts
|
|
3741
3629
|
const FUZZY_BOUNDARY_SEPARATOR = /[\s./:\\_-]/;
|
|
3742
3630
|
const FUZZY_MESSAGE_ARRAY = "Fuzzy requires an array of items";
|
|
3743
3631
|
const FUZZY_MESSAGE_HANDLER = "Fuzzy requires a key or function to stringify items";
|
|
3744
3632
|
const FUZZY_PROPERTY = "$fuzzy";
|
|
3745
3633
|
const FUZZY_SYMBOL = Symbol(FUZZY_PROPERTY);
|
|
3746
|
-
|
|
3747
|
-
//#region src/string/fuzzy.ts
|
|
3634
|
+
// src/string/fuzzy.ts
|
|
3748
3635
|
function Fuzzy(state) {
|
|
3749
3636
|
this[FUZZY_SYMBOL] = state;
|
|
3750
3637
|
}
|
|
@@ -4002,8 +3889,7 @@ function setItems(value) {
|
|
|
4002
3889
|
let defaultSorter;
|
|
4003
3890
|
fuzzy.is = isFuzzy;
|
|
4004
3891
|
fuzzy.match = fuzzyMatch;
|
|
4005
|
-
|
|
4006
|
-
//#region src/string/index.ts
|
|
3892
|
+
// src/string/index.ts
|
|
4007
3893
|
function dedent(value, ...values) {
|
|
4008
3894
|
let actual;
|
|
4009
3895
|
if (isTemplateStringsArray(value)) actual = interpolate(value, values);
|
|
@@ -4106,8 +3992,7 @@ function truncate(value, length, suffix) {
|
|
|
4106
3992
|
const truncatedLength = length - actualSuffixLength;
|
|
4107
3993
|
return `${value.slice(0, truncatedLength)}${actualSuffix}`;
|
|
4108
3994
|
}
|
|
4109
|
-
|
|
4110
|
-
//#region src/string/match.ts
|
|
3995
|
+
// src/string/match.ts
|
|
4111
3996
|
/**
|
|
4112
3997
|
* Check if a string ends with a specified substring
|
|
4113
3998
|
*
|
|
@@ -4174,8 +4059,7 @@ function startsWith(haystack, needle, ignoreCase) {
|
|
|
4174
4059
|
return match(STRING_MATCH_STARTS_WITH, haystack, needle, ignoreCase === true);
|
|
4175
4060
|
}
|
|
4176
4061
|
const matchMemoizers = {};
|
|
4177
|
-
|
|
4178
|
-
//#region src/models/string/string.normalize.model.ts
|
|
4062
|
+
// src/models/string/string.normalize.model.ts
|
|
4179
4063
|
const NORMALIZE_DEBURR_CHARACTERS = {
|
|
4180
4064
|
Æ: "AE",
|
|
4181
4065
|
æ: "ae",
|
|
@@ -4212,8 +4096,7 @@ const NORMALIZE_DEBURR_PATTERN_CHARACTERS = new RegExp(`(${Object.keys(NORMALIZE
|
|
|
4212
4096
|
const NORMALIZE_DEBURR_PATTERN_SIMPLE = /[\u0300-\u036f]/g;
|
|
4213
4097
|
const NORMALIZE_SPECIAL_PATTERN = /[\p{P}\p{S}]/gu;
|
|
4214
4098
|
const NORMALIZE_SYMBOL = Symbol("normalize");
|
|
4215
|
-
|
|
4216
|
-
//#region src/string/normalize.ts
|
|
4099
|
+
// src/string/normalize.ts
|
|
4217
4100
|
function Normalizer(options) {
|
|
4218
4101
|
this[NORMALIZE_SYMBOL] = options;
|
|
4219
4102
|
}
|
|
@@ -4279,12 +4162,10 @@ function normalizeString(value) {
|
|
|
4279
4162
|
}
|
|
4280
4163
|
let deburrMemoizer;
|
|
4281
4164
|
normalize.initialize = initializeNormalizer;
|
|
4282
|
-
|
|
4283
|
-
//#region src/models/string/string.template.model.ts
|
|
4165
|
+
// src/models/string/string.template.model.ts
|
|
4284
4166
|
const TEMPLATE_EXPRESSION_VARIABLE = /{{([^{}]+)}}/g;
|
|
4285
4167
|
const TEMPLATE_SYMBOL = Symbol("template");
|
|
4286
|
-
|
|
4287
|
-
//#region src/string/template.ts
|
|
4168
|
+
// src/string/template.ts
|
|
4288
4169
|
function Templater(options) {
|
|
4289
4170
|
this[TEMPLATE_SYMBOL] = options;
|
|
4290
4171
|
}
|
|
@@ -4335,8 +4216,7 @@ function template(value, ...parameters) {
|
|
|
4335
4216
|
return handleTemplate(value, pattern, ignoreCase, parameters[0]);
|
|
4336
4217
|
}
|
|
4337
4218
|
template.initialize = initializeTemplater;
|
|
4338
|
-
|
|
4339
|
-
//#region src/models/value/value.clone.model.ts
|
|
4219
|
+
// src/models/value/value.clone.model.ts
|
|
4340
4220
|
const CLONE_NAME = "clone";
|
|
4341
4221
|
const CLONE_COPY_OPTIONS = {
|
|
4342
4222
|
copyFunctions: true,
|
|
@@ -4357,8 +4237,7 @@ const CLONE_PRIMITIVES = {
|
|
|
4357
4237
|
undefined: true
|
|
4358
4238
|
};
|
|
4359
4239
|
const CLONE_SYMBOL = Symbol(CLONE_NAME);
|
|
4360
|
-
|
|
4361
|
-
//#region src/value/clone.ts
|
|
4240
|
+
// src/value/clone.ts
|
|
4362
4241
|
function Cloner(options) {
|
|
4363
4242
|
this[CLONE_SYMBOL] = options;
|
|
4364
4243
|
}
|
|
@@ -4523,8 +4402,7 @@ clone.deregister = deregisterCloner;
|
|
|
4523
4402
|
clone.handlers = cloneHandler;
|
|
4524
4403
|
clone.initialize = initializeCloner;
|
|
4525
4404
|
clone.register = registerCloner;
|
|
4526
|
-
|
|
4527
|
-
//#region src/value/collection.ts
|
|
4405
|
+
// src/value/collection.ts
|
|
4528
4406
|
function inMap(map, value, key) {
|
|
4529
4407
|
const getKey = key === true;
|
|
4530
4408
|
if (!(map instanceof Map)) return getKey ? void 0 : false;
|
|
@@ -4547,13 +4425,11 @@ function inSet(set, value) {
|
|
|
4547
4425
|
for (const item of set) if (equal(item, value)) return true;
|
|
4548
4426
|
return false;
|
|
4549
4427
|
}
|
|
4550
|
-
|
|
4551
|
-
//#region src/models/value/value.diff.model.ts
|
|
4428
|
+
// src/models/value/value.diff.model.ts
|
|
4552
4429
|
const DIFF_FULL = "full";
|
|
4553
4430
|
const DIFF_NONE = "none";
|
|
4554
4431
|
const DIFF_PARTIAL = "partial";
|
|
4555
|
-
|
|
4556
|
-
//#region src/value/diff.ts
|
|
4432
|
+
// src/value/diff.ts
|
|
4557
4433
|
/**
|
|
4558
4434
|
* Find the differences between two values
|
|
4559
4435
|
*
|
|
@@ -4652,8 +4528,7 @@ function setChanges(parameters) {
|
|
|
4652
4528
|
const diffsLength = diffs.length;
|
|
4653
4529
|
for (let diffIndex = 0; diffIndex < diffsLength; diffIndex += 1) changes.push(diffs[diffIndex]);
|
|
4654
4530
|
}
|
|
4655
|
-
|
|
4656
|
-
//#region src/value/freeze.ts
|
|
4531
|
+
// src/value/freeze.ts
|
|
4657
4532
|
function fakeDelete() {
|
|
4658
4533
|
return false;
|
|
4659
4534
|
}
|
|
@@ -4731,8 +4606,7 @@ function isFrozen(value) {
|
|
|
4731
4606
|
const frozenValues = /* @__PURE__ */ new WeakSet();
|
|
4732
4607
|
freeze.flat = flatFreeze;
|
|
4733
4608
|
freeze.is = isFrozen;
|
|
4734
|
-
|
|
4735
|
-
//#region src/internal/value/partial.ts
|
|
4609
|
+
// src/internal/value/partial.ts
|
|
4736
4610
|
function partial(value, providedKeys, omit) {
|
|
4737
4611
|
if (!isPlainObject(value)) return {};
|
|
4738
4612
|
let keys;
|
|
@@ -4748,8 +4622,7 @@ function partial(value, providedKeys, omit) {
|
|
|
4748
4622
|
}
|
|
4749
4623
|
return partials;
|
|
4750
4624
|
}
|
|
4751
|
-
|
|
4752
|
-
//#region src/value/omit.ts
|
|
4625
|
+
// src/value/omit.ts
|
|
4753
4626
|
/**
|
|
4754
4627
|
* Create a new object without the specified keys
|
|
4755
4628
|
*
|
|
@@ -4760,8 +4633,7 @@ function partial(value, providedKeys, omit) {
|
|
|
4760
4633
|
function omit(value, keys) {
|
|
4761
4634
|
return partial(value, keys, true);
|
|
4762
4635
|
}
|
|
4763
|
-
|
|
4764
|
-
//#region src/value/pick.ts
|
|
4636
|
+
// src/value/pick.ts
|
|
4765
4637
|
/**
|
|
4766
4638
|
* Create a new object with only the specified keys
|
|
4767
4639
|
*
|
|
@@ -4772,8 +4644,7 @@ function omit(value, keys) {
|
|
|
4772
4644
|
function pick(value, keys) {
|
|
4773
4645
|
return partial(value, keys, false);
|
|
4774
4646
|
}
|
|
4775
|
-
|
|
4776
|
-
//#region src/value/shake.ts
|
|
4647
|
+
// src/value/shake.ts
|
|
4777
4648
|
/**
|
|
4778
4649
|
* Shake an object, removing all keys with `undefined` values
|
|
4779
4650
|
*
|
|
@@ -4792,8 +4663,7 @@ function shake(value) {
|
|
|
4792
4663
|
}
|
|
4793
4664
|
return shaken;
|
|
4794
4665
|
}
|
|
4795
|
-
|
|
4796
|
-
//#region src/value/smush.ts
|
|
4666
|
+
// src/value/smush.ts
|
|
4797
4667
|
function flattenObject(value, depth, smushed, prefix) {
|
|
4798
4668
|
if (depth >= 100) return {};
|
|
4799
4669
|
if (smushed.has(value)) return smushed.get(value);
|
|
@@ -4827,8 +4697,7 @@ function flattenObject(value, depth, smushed, prefix) {
|
|
|
4827
4697
|
function smush(value) {
|
|
4828
4698
|
return typeof value === "object" && value !== null ? flattenObject(value, 0, /* @__PURE__ */ new WeakMap()) : {};
|
|
4829
4699
|
}
|
|
4830
|
-
|
|
4831
|
-
//#region src/value/unsmush.ts
|
|
4700
|
+
// src/value/unsmush.ts
|
|
4832
4701
|
function getKeys(value) {
|
|
4833
4702
|
const keys = Object.keys(value);
|
|
4834
4703
|
const { length } = keys;
|
|
@@ -4862,12 +4731,10 @@ function unsmush(value) {
|
|
|
4862
4731
|
}
|
|
4863
4732
|
return unsmushed;
|
|
4864
4733
|
}
|
|
4865
|
-
|
|
4866
|
-
//#region src/models/value/value.merge.model.ts
|
|
4734
|
+
// src/models/value/value.merge.model.ts
|
|
4867
4735
|
const MERGE_SYMBOL_ASSIGN = Symbol("assign");
|
|
4868
4736
|
const MERGE_SYMBOL_MERGE = Symbol("merge");
|
|
4869
|
-
|
|
4870
|
-
//#region src/value/merge.ts
|
|
4737
|
+
// src/value/merge.ts
|
|
4871
4738
|
function Assigner(options) {
|
|
4872
4739
|
this[MERGE_SYMBOL_ASSIGN] = {
|
|
4873
4740
|
...options,
|
|
@@ -4994,11 +4861,9 @@ function skipMerge(next, options, isArray) {
|
|
|
4994
4861
|
}
|
|
4995
4862
|
assign.initialize = initializeAssigner;
|
|
4996
4863
|
merge.initialize = initializeMerger;
|
|
4997
|
-
|
|
4998
|
-
//#region src/models/value/value.transform.model.ts
|
|
4864
|
+
// src/models/value/value.transform.model.ts
|
|
4999
4865
|
const TRANSFORM_SYMBOL = Symbol("transform");
|
|
5000
|
-
|
|
5001
|
-
//#region src/value/transform.ts
|
|
4866
|
+
// src/value/transform.ts
|
|
5002
4867
|
function Transformer(transformer) {
|
|
5003
4868
|
this[TRANSFORM_SYMBOL] = transformer;
|
|
5004
4869
|
}
|
|
@@ -5037,8 +4902,7 @@ function transformValue(value) {
|
|
|
5037
4902
|
return value;
|
|
5038
4903
|
}
|
|
5039
4904
|
transform.initialize = initializeTransformer;
|
|
5040
|
-
|
|
5041
|
-
//#region src/models/subscription.model.ts
|
|
4905
|
+
// src/models/subscription.model.ts
|
|
5042
4906
|
const SUBSCRIPTION_DISALLOWED_KEY = "Disallowed key for subscription";
|
|
5043
4907
|
const SUBSCRIPTION_INVALID_KEY = "Invalid key for subscription";
|
|
5044
4908
|
const SUBSCRIPTION_INVALID_VALUE = "A subscription requires a non-null value to identify it";
|
|
@@ -5046,8 +4910,7 @@ const SUBSCRIPTION_NAME = "subscription";
|
|
|
5046
4910
|
const SUBSCRIPTION_PROPERTY = "$subscription";
|
|
5047
4911
|
const SUBSCRIPTION_STORE = "subscriptions";
|
|
5048
4912
|
const SUBSCRIPTION_SYMBOL = Symbol(SUBSCRIPTION_PROPERTY);
|
|
5049
|
-
|
|
5050
|
-
//#region src/internal/subscription.ts
|
|
4913
|
+
// src/internal/subscription.ts
|
|
5051
4914
|
function Subscription(state, property, parameters) {
|
|
5052
4915
|
this[SUBSCRIPTION_SYMBOL] = state;
|
|
5053
4916
|
this[property.key] = property.value;
|
|
@@ -5251,8 +5114,7 @@ function removeSubscription() {
|
|
|
5251
5114
|
function subscriptions(parameters) {
|
|
5252
5115
|
return new Subscriptions(parameters);
|
|
5253
5116
|
}
|
|
5254
|
-
|
|
5255
|
-
//#region src/models/beacon.model.ts
|
|
5117
|
+
// src/models/beacon.model.ts
|
|
5256
5118
|
const BEACON_MESSAGE_RETRIEVE = "Cannot retrieve observable from a closed beacon";
|
|
5257
5119
|
const BEACON_MESSAGE_SUBSCRIBE = "Cannot subscribe to a closed observable";
|
|
5258
5120
|
const BEACON_PROPERTY = "$beacon";
|
|
@@ -5265,8 +5127,7 @@ const beaconSubscription = {
|
|
|
5265
5127
|
key: BEACON_PROPERTY,
|
|
5266
5128
|
value: SUBSCRIPTION_NAME
|
|
5267
5129
|
};
|
|
5268
|
-
|
|
5269
|
-
//#region src/beacon.ts
|
|
5130
|
+
// src/beacon.ts
|
|
5270
5131
|
function Beacon(value, options) {
|
|
5271
5132
|
this[BEACON_SYMBOL] = {
|
|
5272
5133
|
value,
|
|
@@ -5433,8 +5294,7 @@ function updateBeacon(instance, type, value, finish) {
|
|
|
5433
5294
|
if (subscriptions != null && subscriptions.size > 0) for (const [, observer] of subscriptions) observer[type]?.(value);
|
|
5434
5295
|
if (finish === true) closeBeacon(state, true);
|
|
5435
5296
|
}
|
|
5436
|
-
|
|
5437
|
-
//#region src/models/herald.model.ts
|
|
5297
|
+
// src/models/herald.model.ts
|
|
5438
5298
|
const HERALD_MESSAGE_ARRAY = "Herald requires an array of event names.";
|
|
5439
5299
|
const HERALD_MESSAGE_ONCREATE = `Herald requires a valid onCreate callback for subscription creation`;
|
|
5440
5300
|
const HERALD_MESSAGE_PROPERTY = `Herald requires valid property information for subscription identification`;
|
|
@@ -5446,8 +5306,7 @@ const heraldSubscription = {
|
|
|
5446
5306
|
key: HERALD_PROPERTY,
|
|
5447
5307
|
value: SUBSCRIPTION_NAME
|
|
5448
5308
|
};
|
|
5449
|
-
|
|
5450
|
-
//#region src/internal/herald.ts
|
|
5309
|
+
// src/internal/herald.ts
|
|
5451
5310
|
function Events(herald, state) {
|
|
5452
5311
|
for (const key of state.keys) Object.defineProperty(this, key, { value: (callback, signal) => herald.subscribe(key, callback, signal) });
|
|
5453
5312
|
}
|
|
@@ -5555,8 +5414,7 @@ function subscribeToHerald(key, callback, signal) {
|
|
|
5555
5414
|
if (!existing) state.onCreate?.(key, callback, subscription);
|
|
5556
5415
|
return subscription;
|
|
5557
5416
|
}
|
|
5558
|
-
|
|
5559
|
-
//#region src/color/constants.ts
|
|
5417
|
+
// src/color/constants.ts
|
|
5560
5418
|
const COLOR_ALPHA = {
|
|
5561
5419
|
fullHexShort: "f",
|
|
5562
5420
|
fullHexLong: "ff",
|
|
@@ -5666,8 +5524,7 @@ const colorSubscription = {
|
|
|
5666
5524
|
key: COLOR_PROPERTY,
|
|
5667
5525
|
value: SUBSCRIPTION_NAME
|
|
5668
5526
|
};
|
|
5669
|
-
|
|
5670
|
-
//#region src/color/misc/alpha.ts
|
|
5527
|
+
// src/color/misc/alpha.ts
|
|
5671
5528
|
function getAlpha(value, hex) {
|
|
5672
5529
|
if (typeof value === "number") return getAlphaFromValue(value);
|
|
5673
5530
|
if (typeof value !== "string" || value.toLowerCase() === COLOR_ALPHA.fullHexLong) return { ...COLOR_DEFAULTS.alpha };
|
|
@@ -5699,8 +5556,7 @@ function getAlphaValue(original) {
|
|
|
5699
5556
|
function setColorAlpha(value) {
|
|
5700
5557
|
if (typeof value === "number" && !Number.isNaN(value)) this[COLOR_SYMBOL].values.alpha = getAlpha(value, false);
|
|
5701
5558
|
}
|
|
5702
|
-
|
|
5703
|
-
//#region src/color/misc/get.ts
|
|
5559
|
+
// src/color/misc/get.ts
|
|
5704
5560
|
function getClampedValue(value, minimum, maximum, rounding) {
|
|
5705
5561
|
if (typeof value !== "number" || Number.isNaN(value)) return minimum;
|
|
5706
5562
|
return clamp(rounding ?? false ? round(value) : value, minimum, maximum);
|
|
@@ -5839,8 +5695,7 @@ function getRgbaColor(value) {
|
|
|
5839
5695
|
function getRgbColor(value) {
|
|
5840
5696
|
return getColorFromState(getColorState(value), COLOR_TYPE.rgb);
|
|
5841
5697
|
}
|
|
5842
|
-
|
|
5843
|
-
//#region src/color/misc/is.ts
|
|
5698
|
+
// src/color/misc/is.ts
|
|
5844
5699
|
function hasKeys(value, keys) {
|
|
5845
5700
|
return typeof value === "object" && value !== null && keys.every((key) => key in value);
|
|
5846
5701
|
}
|
|
@@ -5976,8 +5831,7 @@ const validators = {
|
|
|
5976
5831
|
red: isBytey,
|
|
5977
5832
|
whiteness: isPercentage
|
|
5978
5833
|
};
|
|
5979
|
-
|
|
5980
|
-
//#region src/color/space/rgb.ts
|
|
5834
|
+
// src/color/space/rgb.ts
|
|
5981
5835
|
function convertRgbToHex(rgb, alpha) {
|
|
5982
5836
|
const hex = `${join([
|
|
5983
5837
|
rgb.red,
|
|
@@ -6168,8 +6022,7 @@ function setRgbColorValueInState(instance, value, alpha) {
|
|
|
6168
6022
|
function setRgbaValue(value) {
|
|
6169
6023
|
setRgbColorValueInState(this, value, true);
|
|
6170
6024
|
}
|
|
6171
|
-
|
|
6172
|
-
//#region src/color/space/hex.ts
|
|
6025
|
+
// src/color/space/hex.ts
|
|
6173
6026
|
function convertHexToRgba(value) {
|
|
6174
6027
|
const normalized = getNormalizedHex(value, true);
|
|
6175
6028
|
const pairs = COLOR_EXPRESSION.hexLong.exec(normalized);
|
|
@@ -6318,8 +6171,7 @@ function setHexValueInState(instance, value, alpha) {
|
|
|
6318
6171
|
function setHexaValue(value) {
|
|
6319
6172
|
setHexValueInState(this, value, true);
|
|
6320
6173
|
}
|
|
6321
|
-
|
|
6322
|
-
//#region src/color/space/hsl.ts
|
|
6174
|
+
// src/color/space/hsl.ts
|
|
6323
6175
|
function convertHslToHwba(input) {
|
|
6324
6176
|
let { hue, lightness, saturation } = isHslLike(input) ? getHslValues(input) : { ...COLOR_DEFAULTS.hsl };
|
|
6325
6177
|
lightness /= COLOR_MAX.percent;
|
|
@@ -6464,8 +6316,7 @@ function setHSLValueInState(instance, value, alpha) {
|
|
|
6464
6316
|
function setHslaValue(value) {
|
|
6465
6317
|
setHSLValueInState(this, value, true);
|
|
6466
6318
|
}
|
|
6467
|
-
|
|
6468
|
-
//#region src/color/space/hwb.ts
|
|
6319
|
+
// src/color/space/hwb.ts
|
|
6469
6320
|
function convertHwbToHsl(input) {
|
|
6470
6321
|
let { blackness, hue, whiteness } = isHwbLike(input) ? getHwbValues(input) : COLOR_DEFAULTS.hwb;
|
|
6471
6322
|
blackness /= COLOR_MAX.percent;
|
|
@@ -6588,8 +6439,7 @@ function setHwbColorValueInState(instance, value, alpha) {
|
|
|
6588
6439
|
function setHwbaValue(value) {
|
|
6589
6440
|
setHwbColorValueInState(this, value, true);
|
|
6590
6441
|
}
|
|
6591
|
-
|
|
6592
|
-
//#region src/color/misc/state.ts
|
|
6442
|
+
// src/color/misc/state.ts
|
|
6593
6443
|
function getColorFromState(state, type) {
|
|
6594
6444
|
const { origin } = state;
|
|
6595
6445
|
if (type === origin) return state[origin];
|
|
@@ -6669,8 +6519,7 @@ const getters = {
|
|
|
6669
6519
|
hwb: getColorFromHwb,
|
|
6670
6520
|
rgb: getColorFromRgb
|
|
6671
6521
|
};
|
|
6672
|
-
|
|
6673
|
-
//#region src/color/misc/format.ts
|
|
6522
|
+
// src/color/misc/format.ts
|
|
6674
6523
|
function formatHexColor(alpha) {
|
|
6675
6524
|
return `#${alpha === true ? this.hexa : this.hex}`;
|
|
6676
6525
|
}
|
|
@@ -6692,8 +6541,7 @@ function formatRgbColor(alpha) {
|
|
|
6692
6541
|
function getSuffix(state, alpha) {
|
|
6693
6542
|
return alpha === true ? ` / ${state.alpha.value}%` : "";
|
|
6694
6543
|
}
|
|
6695
|
-
|
|
6696
|
-
//#region src/color/instance.ts
|
|
6544
|
+
// src/color/instance.ts
|
|
6697
6545
|
function Color(value) {
|
|
6698
6546
|
this[COLOR_SYMBOL] = {
|
|
6699
6547
|
changes: herald({
|
|
@@ -6789,8 +6637,7 @@ function subscribeToColor(callback, signal) {
|
|
|
6789
6637
|
function unsubscribeFromColor() {
|
|
6790
6638
|
this[COLOR_SYMBOL].changes.clear();
|
|
6791
6639
|
}
|
|
6792
|
-
|
|
6793
|
-
//#region src/color/index.ts
|
|
6640
|
+
// src/color/index.ts
|
|
6794
6641
|
/**
|
|
6795
6642
|
* Get a _Color_ from any kind of value
|
|
6796
6643
|
*
|
|
@@ -6803,8 +6650,7 @@ function unsubscribeFromColor() {
|
|
|
6803
6650
|
function getColor(value) {
|
|
6804
6651
|
return isColor(value) ? value : color(value);
|
|
6805
6652
|
}
|
|
6806
|
-
|
|
6807
|
-
//#region src/is.ts
|
|
6653
|
+
// src/is.ts
|
|
6808
6654
|
/**
|
|
6809
6655
|
* Is the value empty, or only containing `null` or `undefined` values?
|
|
6810
6656
|
*
|
|
@@ -6921,14 +6767,12 @@ function isNumerical(value) {
|
|
|
6921
6767
|
function isObject(value) {
|
|
6922
6768
|
return typeof value === "object" && value !== null || typeof value === "function";
|
|
6923
6769
|
}
|
|
6924
|
-
|
|
6925
|
-
//#region src/models/logger.model.ts
|
|
6770
|
+
// src/models/logger.model.ts
|
|
6926
6771
|
const LOGGER_NAME = "Logger";
|
|
6927
6772
|
const LOGGER_NAME_TIMED = "TimedLogger";
|
|
6928
6773
|
const LOGGER_PROPERTY = "$logger";
|
|
6929
6774
|
const LOGGER_SYMBOL = Symbol(LOGGER_PROPERTY);
|
|
6930
|
-
|
|
6931
|
-
//#region src/logger.ts
|
|
6775
|
+
// src/logger.ts
|
|
6932
6776
|
function Lumberjack() {}
|
|
6933
6777
|
Lumberjack.prototype[LOGGER_PROPERTY] = LOGGER_NAME;
|
|
6934
6778
|
Lumberjack.prototype.time = getTimeLogger;
|
|
@@ -7022,8 +6866,7 @@ function setLoggerEnabled(value) {
|
|
|
7022
6866
|
*/
|
|
7023
6867
|
const Logger = new Lumberjack();
|
|
7024
6868
|
let enabled = true;
|
|
7025
|
-
|
|
7026
|
-
//#region src/math.ts
|
|
6869
|
+
// src/math.ts
|
|
7027
6870
|
function average(array, key) {
|
|
7028
6871
|
const aggregated = aggregate(AGGREGATION_AVERAGE, array, key);
|
|
7029
6872
|
return aggregated.count > 0 ? aggregated.value / aggregated.count : NaN;
|
|
@@ -7076,8 +6919,7 @@ function median(array, key) {
|
|
|
7076
6919
|
function sum(array, key) {
|
|
7077
6920
|
return getAggregated("sum", array, key);
|
|
7078
6921
|
}
|
|
7079
|
-
|
|
7080
|
-
//#region src/models/query.model.ts
|
|
6922
|
+
// src/models/query.model.ts
|
|
7081
6923
|
const QUERY_EXPRESSION_ARRAY_SUFFIX = /\[\]$/;
|
|
7082
6924
|
const QUERY_EXPRESSION_BOOLEAN = /^(false|true)$/;
|
|
7083
6925
|
const QUERY_TRUE = "true";
|
|
@@ -7086,8 +6928,7 @@ const QUERY_TYPES = /* @__PURE__ */ new Set([
|
|
|
7086
6928
|
"number",
|
|
7087
6929
|
"string"
|
|
7088
6930
|
]);
|
|
7089
|
-
|
|
7090
|
-
//#region src/query.ts
|
|
6931
|
+
// src/query.ts
|
|
7091
6932
|
/**
|
|
7092
6933
|
* Convert a query string to a plain _(nested)_ object
|
|
7093
6934
|
*
|
|
@@ -7157,8 +6998,7 @@ function isDecodable(value) {
|
|
|
7157
6998
|
function toQuery(parameters) {
|
|
7158
6999
|
return isPlainObject(parameters) ? join(getParts(parameters, false).filter((part) => part.length > 0), "&") : "";
|
|
7159
7000
|
}
|
|
7160
|
-
|
|
7161
|
-
//#region src/models/queue.model.ts
|
|
7001
|
+
// src/models/queue.model.ts
|
|
7162
7002
|
/**
|
|
7163
7003
|
* An error thrown by the Queue when an operation fails
|
|
7164
7004
|
*/
|
|
@@ -7185,8 +7025,7 @@ const QUEUE_STATUS_EMPTY = "empty";
|
|
|
7185
7025
|
const QUEUE_STATUS_FULL = "full";
|
|
7186
7026
|
const QUEUE_STATUS_PAUSED = "paused";
|
|
7187
7027
|
const QUEUE_SYMBOL = Symbol(QUEUE_PROPERTY);
|
|
7188
|
-
|
|
7189
|
-
//#region src/queue.ts
|
|
7028
|
+
// src/queue.ts
|
|
7190
7029
|
function KeyedQueue(callback, options) {
|
|
7191
7030
|
this[QUEUE_SYMBOL] = {
|
|
7192
7031
|
callback,
|
|
@@ -7542,13 +7381,11 @@ async function run$1(state) {
|
|
|
7542
7381
|
state.runners -= 1;
|
|
7543
7382
|
}
|
|
7544
7383
|
queue.keyed = keyedQueue;
|
|
7545
|
-
|
|
7546
|
-
//#region src/models/random.model.ts
|
|
7384
|
+
// src/models/random.model.ts
|
|
7547
7385
|
const RANDOM_ALPHABET = "abcdefghijklmnopqrstuvwxyz";
|
|
7548
7386
|
const RANDOM_BOOLEAN_MODIFIER = .5;
|
|
7549
7387
|
const RANDOM_HEX_CHARACTERS = "0123456789ABCDEF";
|
|
7550
|
-
|
|
7551
|
-
//#region src/random.ts
|
|
7388
|
+
// src/random.ts
|
|
7552
7389
|
/**
|
|
7553
7390
|
* Get a random boolean
|
|
7554
7391
|
*
|
|
@@ -7604,8 +7441,7 @@ function getRandomItems(array, amount) {
|
|
|
7604
7441
|
if (amount === 1) return [array[getRandomInteger(0, array.length - 1)]];
|
|
7605
7442
|
return typeof amount !== "number" || amount <= 0 || amount >= array.length ? shuffle(array) : shuffle(array).slice(0, amount);
|
|
7606
7443
|
}
|
|
7607
|
-
|
|
7608
|
-
//#region src/sized/set.ts
|
|
7444
|
+
// src/sized/set.ts
|
|
7609
7445
|
/**
|
|
7610
7446
|
* A _Set_ with a maximum size
|
|
7611
7447
|
*
|
|
@@ -7659,5 +7495,4 @@ var SizedSet = class extends Set {
|
|
|
7659
7495
|
return value;
|
|
7660
7496
|
}
|
|
7661
7497
|
};
|
|
7662
|
-
|
|
7663
|
-
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, asyncFail, asyncFlow, asyncMatchResult, asyncOnce, asyncPipe, asyncRun, asyncSucceed, asyncThrottle, asyncUse, attempt, attemptAsyncFlow, attemptAsyncPipe, attemptFlow, attemptPipe, attemptPromise, attemptRun, 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, filterAndFlatMap, filterAndMap, filterAndMap as select, find, findLast, first, firstOrDefault, flatFreeze, flatMapAndFilter, flatten, floor, flow, freeze, fromQuery, toPromise as fromResult, toPromise, fuzzy, fuzzyMatch, getArray, getArrayComparison, getColor, getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getHwbColor, getHwbaColor, getNormalizedHex, getNumber, getRandom, 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, isAsyncFailure, isAsyncGenerator, isAsyncGeneratorFunction, isAsyncOnce, isAsyncPlan, isAsyncStep, isAsyncSuccess, isBeacon, isBeaconSubscription, isColor, isConstructor, isEmpty, isError, isFailure, isFrozen, isFulfilled, isFuzzy, isGenerator, isGeneratorFunction, 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, isRejected, isResult, isRgbColor, isRgbaColor, isSorted, isStep, isSubscription, isSubscriptions, isSuccess, 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, setValue, settlePromise, shake, shuffle, single, slice, smush, snakeCase, sort, splice, startsWith, startsWithArray, subscriptions, succeed, sum, swap, take, template, throttle, timed, times, titleCase, toCaseCallback, toMap, toMapArrays, toQuery, toRecord, toRecordArrays, toResult, toSet, toggle, transform, trim, truncate, tryDecode, tryEncode, union, unique, unsmush, unwrap, update, upperCase, use, words };
|
|
7498
|
+
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, asyncFail, asyncFlow, asyncMatchResult, asyncOnce, asyncPipe, asyncRun, asyncSucceed, asyncThrottle, asyncUse, attempt, attemptAsyncFlow, attemptAsyncPipe, attemptFlow, attemptPipe, attemptPromise, attemptRun, 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, filterAndFlatMap, filterAndMap, filterAndMap as select, find, findLast, first, firstOrDefault, flatFreeze, flatMapAndFilter, flatten, floor, flow, freeze, fromQuery, toPromise as fromResult, toPromise, fuzzy, fuzzyMatch, getArray, getArrayComparison, getColor, getForegroundColor, getHexColor, getHexaColor, getHslColor, getHslaColor, getHwbColor, getHwbaColor, getNormalizedHex, getNumber, getRandom, 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, isAsyncFailure, isAsyncGenerator, isAsyncGeneratorFunction, isAsyncOnce, isAsyncPlan, isAsyncStep, isAsyncSuccess, isBeacon, isBeaconSubscription, isColor, isConstructor, isEmpty, isError, isFailure, isFrozen, isFulfilled, isFuzzy, isGenerator, isGeneratorFunction, 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, isRejected, isResult, isRgbColor, isRgbaColor, isSorted, isStep, isSubscription, isSubscriptions, isSuccess, 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, setValue, settlePromise, shake, shuffle, single, slice, smush, snakeCase, sort, splice, startsWith, startsWithArray, subscriptions, succeed, sum, swap, take, template, throttle, timed, times, titleCase, toCaseCallback, toMap, toMapArrays, toQuery, toRecord, toRecordArrays, toResult, toSet, toggle, transform, trim, truncate, tryDecode, tryEncode, union, unique, unsmush, unwrap, unwrapWork, update, upperCase, use, words };
|