@oscarpalmer/atoms 0.216.0 → 0.218.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.
Files changed (77) hide show
  1. package/dist/array/insert.mjs +1 -1
  2. package/dist/array/slice.mjs +27 -14
  3. package/dist/array/sort.mjs +2 -1
  4. package/dist/array/swap.d.mts +2 -1
  5. package/dist/color/constants.d.mts +2 -1
  6. package/dist/color/misc/get.mjs +3 -1
  7. package/dist/color/space/hex.mjs +1 -1
  8. package/dist/color/space/rgb.d.mts +1 -0
  9. package/dist/function/index.mjs +1 -2
  10. package/dist/function/retry.d.mts +1 -1
  11. package/dist/function/retry.mjs +5 -2
  12. package/dist/herald.mjs +1 -2
  13. package/dist/index.d.mts +335 -113
  14. package/dist/index.mjs +483 -241
  15. package/dist/internal/array/find.mjs +57 -34
  16. package/dist/internal/array/insert.mjs +1 -1
  17. package/dist/internal/array/match.mjs +21 -17
  18. package/dist/internal/array/sets.mjs +7 -1
  19. package/dist/internal/math/aggregate.mjs +4 -1
  20. package/dist/internal/number.d.mts +1 -1
  21. package/dist/internal/number.mjs +4 -2
  22. package/dist/internal/plan/index.d.mts +7 -0
  23. package/dist/internal/plan/index.mjs +18 -0
  24. package/dist/{plan/generate.d.mts → internal/plan/plan.generate.d.mts} +2 -2
  25. package/dist/{plan/generate.mjs → internal/plan/plan.generate.mjs} +7 -7
  26. package/dist/internal/random.d.mts +6 -0
  27. package/dist/internal/random.mjs +13 -2
  28. package/dist/internal/result/attempt.mjs +4 -4
  29. package/dist/internal/string/misc.mjs +2 -1
  30. package/dist/internal/subscription.mjs +1 -1
  31. package/dist/internal/value/equal.mjs +2 -1
  32. package/dist/internal/value/partial.mjs +3 -1
  33. package/dist/models/color.model.d.mts +2 -1
  34. package/dist/models/function/once.model.d.mts +2 -1
  35. package/dist/models/index.d.mts +2 -1
  36. package/dist/models/plan.model.d.mts +160 -29
  37. package/dist/models/plan.model.mjs +15 -5
  38. package/dist/models/queue.model.d.mts +2 -1
  39. package/dist/models/result.model.d.mts +2 -1
  40. package/dist/models/string/string.fuzzy.model.d.mts +1 -1
  41. package/dist/models/string/string.misc.model.mjs +1 -1
  42. package/dist/models/value/value.equal.model.d.mts +2 -1
  43. package/dist/models/value/value.merge.model.d.mts +3 -2
  44. package/dist/models/value/value.misc.model.d.mts +2 -1
  45. package/dist/number.mjs +1 -2
  46. package/dist/plan/index.d.mts +1 -4
  47. package/dist/plan/index.mjs +14 -15
  48. package/dist/plan/is.d.mts +59 -3
  49. package/dist/plan/is.mjs +82 -10
  50. package/dist/plan/misc.d.mts +51 -3
  51. package/dist/plan/misc.mjs +47 -30
  52. package/dist/plan/models.d.mts +2 -2
  53. package/dist/plan/result.d.mts +15 -3
  54. package/dist/plan/result.mjs +5 -11
  55. package/dist/plan/run.d.mts +1 -3
  56. package/dist/plan/run.mjs +5 -11
  57. package/dist/plan/use.d.mts +36 -0
  58. package/dist/plan/use.mjs +69 -0
  59. package/dist/promise/index.d.mts +6 -4
  60. package/dist/promise/index.mjs +4 -4
  61. package/dist/promise/misc.mjs +5 -2
  62. package/dist/promise/models.mjs +1 -2
  63. package/dist/promise/timed.mjs +2 -2
  64. package/dist/queue.mjs +4 -5
  65. package/dist/random.d.mts +2 -2
  66. package/dist/random.mjs +3 -3
  67. package/dist/result/index.mjs +1 -2
  68. package/dist/result/match.mjs +2 -2
  69. package/dist/result/misc.mjs +3 -10
  70. package/dist/result/work/pipe.d.mts +26 -23
  71. package/dist/result/work/pipe.mjs +7 -3
  72. package/dist/string/fuzzy.mjs +1 -1
  73. package/dist/string/index.mjs +1 -1
  74. package/dist/subscription.mjs +1 -2
  75. package/dist/value/clone.mjs +1 -1
  76. package/dist/value/merge.mjs +17 -4
  77. package/package.json +8 -10
package/dist/index.mjs CHANGED
@@ -29,15 +29,47 @@ function createFindParameters(original) {
29
29
  value: length === 1 && typeof original[0] !== "function" ? original[0] : original[1]
30
30
  };
31
31
  }
32
+ function findComplexValues(parameters) {
33
+ const { array, keyCallback, length, mapAfter, mapBefore, result, type, value } = parameters;
34
+ const keys = /* @__PURE__ */ new Set();
35
+ for (let index = 0; index < length; index += 1) {
36
+ const item = array[index];
37
+ let keyed;
38
+ let transformed;
39
+ if (mapBefore == null) {
40
+ keyed = keyCallback?.(item, index, array) ?? item;
41
+ transformed = item;
42
+ } else {
43
+ transformed = mapBefore(item, index, array);
44
+ keyed = keyCallback?.(transformed, index, array) ?? transformed;
45
+ }
46
+ if (type === "all" && Object.is(keyed, value) || type === "unique" && !keys.has(keyed)) {
47
+ keys.add(keyed);
48
+ result.matched.push(mapAfter?.(item, index, array) ?? transformed);
49
+ } else result.notMatched.push(item);
50
+ }
51
+ return result;
52
+ }
53
+ function findSimpleValue(array, value, findIndex, reversed) {
54
+ if (findIndex) return reversed ? array.lastIndexOf(value) : array.indexOf(value);
55
+ return reversed ? array.findLast((item) => Object.is(item, value)) : array.find((item) => Object.is(item, value));
56
+ }
57
+ function findSimpleValues(array, length, value, boolCallback, mapBefore, mapAfter, result) {
58
+ const callback = boolCallback ?? ((item) => Object.is(item, value));
59
+ for (let index = 0; index < length; index += 1) {
60
+ const item = array[index];
61
+ const transformed = mapBefore?.(item, index, array) ?? item;
62
+ if (callback(transformed, index, array)) result.matched.push(mapAfter?.(item, index, array) ?? transformed);
63
+ else result.notMatched.push(item);
64
+ }
65
+ return result;
66
+ }
32
67
  function findValue(type, array, parameters, reversed) {
33
68
  const findIndex = type === ARRAY_FIND_VALUE_INDEX;
34
69
  if (!Array.isArray(array) || array.length === 0) return findIndex ? -1 : void 0;
35
70
  const { bool, key, value } = createFindParameters(parameters);
36
71
  const callbacks = getArrayCallbacks(bool, key);
37
- if (callbacks?.bool == null && callbacks?.keyed == null) {
38
- if (findIndex) return reversed ? array.lastIndexOf(value) : array.indexOf(value);
39
- return reversed ? array.findLast((item) => Object.is(item, value)) : array.find((item) => Object.is(item, value));
40
- }
72
+ if (callbacks?.bool == null && callbacks?.keyed == null) return findSimpleValue(array, value, findIndex, reversed);
41
73
  if (callbacks.bool != null) {
42
74
  const index = reversed ? array.findLastIndex(callbacks.bool) : array.findIndex(callbacks.bool);
43
75
  return findIndex ? index : array[index];
@@ -58,7 +90,8 @@ function findAbsoluteValueOrDefault(array, parameters, defaultValue, useDefaultV
58
90
  return useDefaultValue ? defaultValue : void 0;
59
91
  }
60
92
  const index = findValue(ARRAY_FIND_VALUE_INDEX, array, parameters, reversed);
61
- return index > -1 ? array[index] : useDefaultValue ? defaultValue : void 0;
93
+ if (index === -1) return useDefaultValue ? defaultValue : void 0;
94
+ return array[index];
62
95
  }
63
96
  function findValues(type, array, parameters, mapper) {
64
97
  const result = {
@@ -75,36 +108,26 @@ function findValues(type, array, parameters, mapper) {
75
108
  }
76
109
  const mapCallback = getArrayCallback(mapper?.callback);
77
110
  const mapReverse = mapper?.reverse ?? false;
78
- const mapAfter = mapCallback == null ? void 0 : mapReverse ? void 0 : mapCallback;
79
- const mapBefore = mapCallback == null ? void 0 : mapReverse ? mapCallback : void 0;
80
- if (callbacks?.bool != null || type === "all" && key == null) {
81
- const callback = callbacks?.bool ?? ((item) => Object.is(item, value));
82
- for (let index = 0; index < length; index += 1) {
83
- const item = array[index];
84
- const transformed = mapBefore?.(item, index, array) ?? item;
85
- if (callback(transformed, index, array)) result.matched.push(mapAfter?.(item, index, array) ?? transformed);
86
- else result.notMatched.push(item);
87
- }
88
- return result;
89
- }
90
- const keys = /* @__PURE__ */ new Set();
91
- for (let index = 0; index < length; index += 1) {
92
- const item = array[index];
93
- let keyed;
94
- let transformed;
95
- if (mapBefore == null) {
96
- keyed = callbacks?.keyed?.(item, index, array) ?? item;
97
- transformed = item;
98
- } else {
99
- transformed = mapBefore(item, index, array);
100
- keyed = callbacks?.keyed?.(transformed, index, array) ?? transformed;
101
- }
102
- if (type === "all" && Object.is(keyed, value) || type === "unique" && !keys.has(keyed)) {
103
- keys.add(keyed);
104
- result.matched.push(mapAfter?.(item, index, array) ?? transformed);
105
- } else result.notMatched.push(item);
106
- }
107
- return result;
111
+ let mapAfter;
112
+ let mapBefore;
113
+ if (mapCallback == null) {
114
+ mapAfter = void 0;
115
+ mapBefore = void 0;
116
+ } else {
117
+ mapAfter = mapReverse ? void 0 : mapCallback;
118
+ mapBefore = mapReverse ? mapCallback : void 0;
119
+ }
120
+ if (callbacks?.bool != null || type === "all" && key == null) return findSimpleValues(array, length, value, callbacks?.bool, mapBefore, mapAfter, result);
121
+ return findComplexValues({
122
+ array,
123
+ length,
124
+ mapAfter,
125
+ mapBefore,
126
+ result,
127
+ type,
128
+ value,
129
+ keyCallback: callbacks?.keyed
130
+ });
108
131
  }
109
132
  //#endregion
110
133
  //#region src/array/filter.ts
@@ -431,6 +454,21 @@ const arrayMatchStarts = /* @__PURE__ */ new Set([ARRAY_MATCH_COMPARISON_START,
431
454
  function endsWithArray(haystack, needle, key) {
432
455
  return arrayMatchEndings.has(getPosition(haystack, needle, key)[1]);
433
456
  }
457
+ function evaluatePosition(haystack, haystackLength, needle, needleLength, key) {
458
+ const callback = getArrayCallback(key);
459
+ const limit = haystackLength - needleLength + 1;
460
+ let needleValues = callback == null ? needle : needle.slice();
461
+ if (callback != null) for (let needleIndex = 0; needleIndex < needleLength; needleIndex += 1) needleValues[needleIndex] = callback(needle[needleIndex], needleIndex, needle);
462
+ for (let haystackIndex = 0; haystackIndex < limit; haystackIndex += 1) {
463
+ if (!inHaystack(haystack, haystackIndex, needleValues, 0, callback)) continue;
464
+ if (needleLength === 1) return [haystackIndex, getName(haystackIndex, haystackLength, needleLength)];
465
+ for (let needleIndex = 1; needleIndex < needleLength; needleIndex += 1) {
466
+ if (!inHaystack(haystack, haystackIndex, needleValues, needleIndex, callback)) break;
467
+ if (needleIndex === needleLength - 1) return [haystackIndex, getName(haystackIndex, haystackLength, needleLength)];
468
+ }
469
+ }
470
+ return arrayMatchOutside;
471
+ }
434
472
  function getArrayComparison(haystack, needle, key) {
435
473
  return getPosition(haystack, needle, key)[1];
436
474
  }
@@ -444,23 +482,12 @@ function getPosition(haystack, needle, key) {
444
482
  const needleLength = needle.length;
445
483
  if (haystackLength === 0 || needleLength === 0) return arrayMatchOutside;
446
484
  if (needleLength > haystackLength) return arrayMatchOutside;
447
- const callback = getArrayCallback(key);
448
- const limit = haystackLength - needleLength + 1;
449
- let needleValues = callback == null ? needle : needle.slice();
450
- if (callback != null) for (let needleIndex = 0; needleIndex < needleLength; needleIndex += 1) needleValues[needleIndex] = callback(needle[needleIndex], needleIndex, needle);
451
- for (let haystackIndex = 0; haystackIndex < limit; haystackIndex += 1) {
452
- let haystackItem = haystack[haystackIndex];
453
- let haystackValue = callback?.(haystackItem, haystackIndex, haystack) ?? haystackItem;
454
- if (!Object.is(haystackValue, needleValues[0])) continue;
455
- if (needleLength === 1) return [haystackIndex, getName(haystackIndex, haystackLength, needleLength)];
456
- for (let needleIndex = 1; needleIndex < needleLength; needleIndex += 1) {
457
- haystackItem = haystack[haystackIndex + needleIndex];
458
- haystackValue = callback?.(haystackItem, haystackIndex + needleIndex, haystack) ?? haystackItem;
459
- if (!Object.is(haystackValue, needleValues[needleIndex])) break;
460
- if (needleIndex === needleLength - 1) return [haystackIndex, getName(haystackIndex, haystackLength, needleLength)];
461
- }
462
- }
463
- return arrayMatchOutside;
485
+ return evaluatePosition(haystack, haystackLength, needle, needleLength, key);
486
+ }
487
+ function inHaystack(haystack, haystackIndex, needleValues, needleIndex, callback) {
488
+ const haystackItem = haystack[haystackIndex + needleIndex];
489
+ const haystackValue = callback?.(haystackItem, haystackIndex + needleIndex, haystack) ?? haystackItem;
490
+ return Object.is(haystackValue, needleValues[needleIndex]);
464
491
  }
465
492
  function includesArray(haystack, needle, key) {
466
493
  return !arrayMatchOutsides.has(getPosition(haystack, needle, key)[1]);
@@ -501,12 +528,22 @@ function roundNumber(callback, value, decimals) {
501
528
  }
502
529
  //#endregion
503
530
  //#region src/internal/random.ts
531
+ /**
532
+ * Get a random number between 0 _(inclusive)_ and 1 _(exclusive)_
533
+ *
534
+ * @returns Random number
535
+ */
536
+ function getRandom() {
537
+ /* istanbul ignore if */
538
+ if (globalThis.crypto == null) return Math.random();
539
+ return globalThis.crypto.getRandomValues(/* @__PURE__ */ new Uint32Array(1))[0] / RANDOM_DIVISOR;
540
+ }
504
541
  function getRandomFloatingNumberValue(inclusive, minimum, maximum) {
505
542
  let maxFloat = isNumber(maximum) && maximum <= Number.MAX_SAFE_INTEGER ? maximum : Number.MAX_SAFE_INTEGER;
506
543
  let minFloat = isNumber(minimum) && minimum >= Number.MIN_SAFE_INTEGER ? minimum : Number.MIN_SAFE_INTEGER;
507
544
  if (minFloat === maxFloat) return minFloat;
508
545
  if (minFloat > maxFloat) [minFloat, maxFloat] = [maxFloat, minFloat];
509
- return Math.random() * (maxFloat + (inclusive ? 1 : 0) - minFloat) + minFloat;
546
+ return getRandom() * (maxFloat + (inclusive ? 1 : 0) - minFloat) + minFloat;
510
547
  }
511
548
  /**
512
549
  * Get a random floating-point number
@@ -528,6 +565,7 @@ function getRandomFloatingNumber(minimum, maximum) {
528
565
  function getRandomInteger(minimum, maximum) {
529
566
  return floor(getRandomFloatingNumberValue(true, minimum, maximum));
530
567
  }
568
+ const RANDOM_DIVISOR = 2 ** 32;
531
569
  //#endregion
532
570
  //#region src/internal/array/shuffle.ts
533
571
  /**
@@ -554,8 +592,14 @@ function compareSets(type, first, second, key) {
554
592
  const isDifference = type === ARRAY_SETS_COMPARE_DIFFERENCE;
555
593
  const isIntersection = type === ARRAY_SETS_COMPARE_INTERSECTION;
556
594
  const isUnion = type === ARRAY_SETS_COMPARE_UNION;
557
- if (first.length === 0) return isDifference ? first.slice() : isIntersection ? [] : second.slice();
595
+ if (first.length === 0) {
596
+ if (isDifference) return first.slice();
597
+ return isIntersection ? [] : second.slice();
598
+ }
558
599
  if (!Array.isArray(second) || second.length === 0) return isIntersection ? [] : first.slice();
600
+ return getComparison(first, second, isIntersection, isUnion, key);
601
+ }
602
+ function getComparison(first, second, isIntersection, isUnion, key) {
559
603
  const callback = getArrayCallback(key);
560
604
  const values = isUnion ? first : second;
561
605
  let { length } = values;
@@ -668,7 +712,10 @@ function getAggregateCallback(key) {
668
712
  }
669
713
  function getAggregated(type, array, key, first) {
670
714
  const aggregation = aggregate(type, array, key, first);
671
- if (aggregation.count === 0) return aggregation.array ? aggregation.first ? void 0 : [] : NaN;
715
+ if (aggregation.count === 0) {
716
+ if (aggregation.array) return aggregation.first ? void 0 : [];
717
+ return NaN;
718
+ }
672
719
  if (aggregation.array) {
673
720
  const array = aggregation.items[aggregation.value];
674
721
  return aggregation.first ? array[0] : array;
@@ -696,7 +743,7 @@ const aggregators = {
696
743
  //#endregion
697
744
  //#region src/internal/array/insert.ts
698
745
  function insertChunkedValues(type, array, items, start, deleteCount) {
699
- const actualDeleteCount = deleteCount < 0 ? 0 : deleteCount;
746
+ const actualDeleteCount = max([deleteCount, 0]);
700
747
  const actualStart = min([max([0, start]), array.length]);
701
748
  const chunked = chunk(items);
702
749
  const lastIndex = chunked.length - 1;
@@ -719,7 +766,7 @@ function insertValues(type, array, items, start, deleteCount) {
719
766
  //#endregion
720
767
  //#region src/array/insert.ts
721
768
  function insert(array, indexOrItems, items) {
722
- return insertValues(ARRAY_INSERT_TYPE_INSERT, array, items == null ? indexOrItems : items, typeof indexOrItems === "number" ? indexOrItems : array?.length, 0);
769
+ return insertValues(ARRAY_INSERT_TYPE_INSERT, array, items ?? indexOrItems, typeof indexOrItems === "number" ? indexOrItems : array?.length, 0);
723
770
  }
724
771
  //#endregion
725
772
  //#region src/array/intersection.ts
@@ -789,34 +836,47 @@ function extract(type, array, first, second) {
789
836
  if (!Array.isArray(array)) return [];
790
837
  const { length } = array;
791
838
  if (length === 0) return [];
792
- const isTake = type === ARRAY_SLICE_TAKE;
793
- if (typeof first === "number") {
794
- if (Math.abs(first) >= length) return isTake ? array.slice() : [];
795
- if (first === 0) return isTake ? [] : array.slice();
796
- if (isTake) return first >= 0 ? array.slice(0, first) : array.slice(array.length + first);
797
- return first >= 0 ? array.slice(first) : array.slice(0, array.length + first);
798
- }
799
- const callbacks = second == null ? getArrayCallbacks(first) : getArrayCallbacks(void 0, void 0, first);
839
+ const take = type === ARRAY_SLICE_TAKE;
840
+ return typeof first === "number" ? getSlice(array, length, first, take) : extractSlice(array, length, first, second, take);
841
+ }
842
+ function extractSlice(array, length, first, second, take) {
843
+ const callbacks = getCallbacks(first, second);
844
+ if (callbacks?.bool == null && callbacks?.value == null) return take ? array.slice() : [];
800
845
  const isBoolean = callbacks?.bool != null;
801
- if (callbacks?.bool == null && callbacks?.value == null) return isTake ? array.slice() : [];
802
846
  const extracted = [];
803
847
  let push = false;
804
848
  for (let index = 0; index < length; index += 1) {
805
849
  const item = array[index];
806
- const matches = isBoolean ? callbacks.bool(item, index, array) : Object.is(callbacks.value(item, index, array), second);
807
- if (isTake) {
808
- if (isBoolean ? !matches : matches) break;
850
+ const matches = isMatch(item, index, array, callbacks, second, isBoolean);
851
+ const reached = isBoolean ? !matches : matches;
852
+ if (take && reached) break;
853
+ if (push || take) {
809
854
  extracted.push(item);
810
855
  continue;
811
856
  }
812
- if (push) extracted.push(item);
813
- else if (isBoolean ? !matches : matches) {
857
+ if (reached) {
814
858
  push = true;
815
859
  if (isBoolean) extracted.push(item);
816
860
  }
817
861
  }
818
862
  return extracted;
819
863
  }
864
+ function getCallbacks(first, second) {
865
+ let callbacks;
866
+ if (second == null) callbacks = getArrayCallbacks(first);
867
+ else callbacks = getArrayCallbacks(void 0, void 0, first);
868
+ return callbacks;
869
+ }
870
+ function getSlice(array, length, amount, take) {
871
+ if (Math.abs(amount) >= length) return take ? array.slice() : [];
872
+ if (amount === 0) return take ? [] : array.slice();
873
+ if (take) return amount >= 0 ? array.slice(0, amount) : array.slice(length + amount);
874
+ return amount >= 0 ? array.slice(amount) : array.slice(0, length + amount);
875
+ }
876
+ function isMatch(item, index, array, callbacks, second, isBoolean) {
877
+ if (isBoolean) return callbacks.bool(item, index, array);
878
+ return Object.is(callbacks.value(item, index, array), second);
879
+ }
820
880
  function slice(array, first, second) {
821
881
  if (!Array.isArray(array) || array.length === 0) return [];
822
882
  const firstIsNumber = typeof first === "number";
@@ -1022,7 +1082,7 @@ const VALUE_MISC_NESTED_MESSAGE_UNSAFE = "Access to this property is not allowed
1022
1082
  //#endregion
1023
1083
  //#region src/models/string/string.misc.model.ts
1024
1084
  const STRING_EXPRESSION_IGNORED = /(^|\.)(__proto__|constructor|prototype)(\.|$)/i;
1025
- const STRING_EXPRESSION_WORDS = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
1085
+ const STRING_EXPRESSION_WORDS = /([^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+)/g;
1026
1086
  const STRING_EXPRESSION_WHITESPACE_PREFIX = /^(\s+)/;
1027
1087
  const STRING_MATCH_ENDS_WITH = "endsWith";
1028
1088
  const STRING_MATCH_INCLUDES = "includes";
@@ -1079,18 +1139,11 @@ error.is = isError;
1079
1139
  ok.is = isOk;
1080
1140
  //#endregion
1081
1141
  //#region src/result/misc.ts
1082
- /**
1083
- * Converts a _Result_ to a _Promise_
1084
- *
1085
- * Resolves if ok, rejects for error
1086
- *
1087
- * @param result _Result_ to convert
1088
- * @returns Promised result
1089
- */
1090
1142
  async function toPromise(result) {
1091
1143
  const actual = typeof result === "function" ? result() : result;
1092
- if (!isResult(actual)) return Promise.reject(new Error(RESULT_MESSAGE_PROMISE));
1093
- return isOk(actual) ? Promise.resolve(actual.value) : Promise.reject(actual.error);
1144
+ if (!isResult(actual)) throw new TypeError(RESULT_MESSAGE_PROMISE);
1145
+ if (isOk(actual)) return actual.value;
1146
+ throw actual.error;
1094
1147
  }
1095
1148
  const RESULT_MESSAGE_PROMISE = "toPromise expected to receive a Result";
1096
1149
  //#endregion
@@ -1102,15 +1155,15 @@ async function asyncAttempt(value, err) {
1102
1155
  else result = value;
1103
1156
  if (result instanceof Promise) result = await result;
1104
1157
  return ok(result);
1105
- } catch (thrown) {
1106
- return getError(err ?? thrown, err == null ? void 0 : thrown);
1158
+ } catch (error) {
1159
+ return getError(err ?? error, err == null ? void 0 : error);
1107
1160
  }
1108
1161
  }
1109
1162
  function attempt(callback, err) {
1110
1163
  try {
1111
1164
  return ok(callback());
1112
- } catch (thrown) {
1113
- return getError(err ?? thrown, err == null ? void 0 : thrown);
1165
+ } catch (error) {
1166
+ return getError(err ?? error, err == null ? void 0 : error);
1114
1167
  }
1115
1168
  }
1116
1169
  attempt.async = asyncAttempt;
@@ -1189,7 +1242,8 @@ function tryEncode(value) {
1189
1242
  * @returns Array of words found in the string
1190
1243
  */
1191
1244
  function words(value) {
1192
- return typeof value === "string" ? value.match(STRING_EXPRESSION_WORDS) ?? [] : [];
1245
+ if (typeof value === "string") return value.match(STRING_EXPRESSION_WORDS) ?? [];
1246
+ return [];
1193
1247
  }
1194
1248
  //#endregion
1195
1249
  //#region src/internal/value/handlers.ts
@@ -1442,7 +1496,7 @@ function isSortedArray(array) {
1442
1496
  let offset = 0;
1443
1497
  if (length >= 100) {
1444
1498
  offset = round(length / 10);
1445
- offset = offset > 100 ? 100 : offset;
1499
+ offset = min([offset, 100]);
1446
1500
  for (let index = 0; index < offset; index += 1) {
1447
1501
  const [firstItem, firstOffset] = [array[index], array[index + 1]];
1448
1502
  const [secondItem, secondOffset] = [array[length - index - 2], array[length - index - 1]];
@@ -2088,8 +2142,11 @@ async function asyncRetry(callback, options) {
2088
2142
  if (typeof callback !== "function") throw new TypeError(RETRY_MESSAGE_EXPECTATION);
2089
2143
  async function handle() {
2090
2144
  const result = await asyncAttempt(async () => callback());
2091
- if (result.ok) resolver(result.value);
2092
- else if (attempts >= times || !when(result.error)) rejector(new RetryError(RETRY_MESSAGE_FAILED, result.error));
2145
+ if (result.ok) {
2146
+ resolver(result.value);
2147
+ return;
2148
+ }
2149
+ if (attempts >= times || !when(result.error)) rejector(new RetryError(RETRY_MESSAGE_FAILED, result.error));
2093
2150
  else {
2094
2151
  attempts += 1;
2095
2152
  limiter.run();
@@ -2160,7 +2217,7 @@ const EXPRESSION_WHITESPACE_ONLY = /^\s*$/;
2160
2217
  *
2161
2218
  * @param value Value to check
2162
2219
  * @param minimum Minimum value
2163
- * @param maximum Maximum value
2220
+ * @param maximum Maximum value _(inclusive)_
2164
2221
  * @returns `true` if the value is between the minimum and maximum, otherwise `false`
2165
2222
  */
2166
2223
  function between(value, minimum, maximum) {
@@ -2170,7 +2227,8 @@ function between(value, minimum, maximum) {
2170
2227
  maximum
2171
2228
  ].every(isNumber)) return false;
2172
2229
  if (Object.is(minimum, maximum)) return Object.is(value, minimum);
2173
- return value >= (maximum > minimum ? minimum : maximum) && value <= (maximum > minimum ? maximum : minimum);
2230
+ const maximumValue = max([maximum, minimum]);
2231
+ return value >= min([maximum, minimum]) && value <= maximumValue;
2174
2232
  }
2175
2233
  /**
2176
2234
  * Clamp a number between a minimum and maximum value
@@ -2619,7 +2677,7 @@ function equalArray(first, second, options) {
2619
2677
  let offset = 0;
2620
2678
  if (length >= 100) {
2621
2679
  offset = round(length / 10);
2622
- offset = offset > 100 ? 100 : offset;
2680
+ offset = min([offset, 100]);
2623
2681
  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;
2624
2682
  }
2625
2683
  const end = length - offset;
@@ -2768,57 +2826,23 @@ function setValue(data, path, value, ignoreCase) {
2768
2826
  }
2769
2827
  //#endregion
2770
2828
  //#region src/models/plan.model.ts
2771
- const GENERATOR_NAME_ASYNC = "AsyncGeneratorFunction";
2772
- const GENERATOR_NAME_SYNC = "GeneratorFunction";
2829
+ const GENERATOR_FUNCTION_TYPE_ASYNC = "[object AsyncGeneratorFunction]";
2830
+ const GENERATOR_FUNCTION_TYPE_SYNC = "[object GeneratorFunction]";
2831
+ const GENERATOR_TYPE_ASYNC = "[object AsyncGenerator]";
2832
+ const GENERATOR_TYPE_SYNC = "[object Generator]";
2833
+ const PLAN_FAILURE_ASYNC = "asyncFailure";
2834
+ const PLAN_FAILURE_SYNC = "failure";
2773
2835
  const PLAN_MESSAGE_PLAN_INPUT = "plan requires a generator function";
2774
2836
  const PLAN_MESSAGE_RUN_INPUT = "run requires a plan or a generator function";
2837
+ const PLAN_MESSAGE_USE_NESTED_FN = "Cannot use nested functions with 'use'";
2838
+ const PLAN_MESSAGE_USE_SYNC_ASYNC = "Cannot use asynchronous values with 'use'";
2839
+ const PLAN_STEP_ASYNC = "asyncStep";
2840
+ const PLAN_STEP_SYNC = "step";
2841
+ const PLAN_SUCCESS_ASYNC = "asyncSuccess";
2842
+ const PLAN_SUCCESS_SYNC = "success";
2775
2843
  const PLAN_SYMBOL = Symbol("plan");
2776
- const PLAN_TYPE_PLAN_ASYNC = "asyncPlan";
2777
- const PLAN_TYPE_PLAN_SYNC = "plan";
2778
- //#endregion
2779
- //#region src/plan/is.ts
2780
- /**
2781
- * Is the value an asynchronous generator function?
2782
- *
2783
- * @param value Value to check
2784
- * @returns `true` if the value is an asynchronous generator function, otherwise `false`
2785
- */
2786
- function isAsyncGenerator(value) {
2787
- return isGeneratorInstance(GENERATOR_NAME_ASYNC, value);
2788
- }
2789
- /**
2790
- * Is the value an asynchronous plan?
2791
- *
2792
- * @param value Value to check
2793
- * @returns `true` if the value is an asynchronous plan, otherwise `false`
2794
- */
2795
- function isAsyncPlan(value) {
2796
- return isPlanInstance(PLAN_TYPE_PLAN_ASYNC, value);
2797
- }
2798
- /**
2799
- * Is the value a generator function?
2800
- *
2801
- * @param value Value to check
2802
- * @returns `true` if the value is a generator function, otherwise `false`
2803
- */
2804
- function isGenerator(value) {
2805
- return isGeneratorInstance(GENERATOR_NAME_SYNC, value);
2806
- }
2807
- function isGeneratorInstance(name, value) {
2808
- return typeof value === "function" && value !== null && value.constructor.name === name && typeof value.prototype.next === "function" && typeof value.prototype.return === "function" && typeof value.prototype.throw === "function";
2809
- }
2810
- /**
2811
- * Is the value a plan?
2812
- *
2813
- * @param value Value to check
2814
- * @returns `true` if the value is a plan, otherwise `false`
2815
- */
2816
- function isPlan(value) {
2817
- return isPlanInstance(PLAN_TYPE_PLAN_SYNC, value);
2818
- }
2819
- function isPlanInstance(type, value) {
2820
- return typeof value === "object" && value !== null && PLAN_SYMBOL in value && value[PLAN_SYMBOL].type === type;
2821
- }
2844
+ const PLAN_TYPE_ASYNC = "asyncPlan";
2845
+ const PLAN_TYPE_SYNC = "plan";
2822
2846
  //#endregion
2823
2847
  //#region src/models/aborter.model.ts
2824
2848
  const ABORTER_EVENT = "abort";
@@ -2835,10 +2859,10 @@ function createAborter(value, onAbort) {
2835
2859
  };
2836
2860
  }
2837
2861
  //#endregion
2838
- //#region src/plan/generate.ts
2862
+ //#region src/internal/plan/plan.generate.ts
2839
2863
  async function asyncGenerate(input, unwrap, first, second) {
2840
2864
  const aborter = createAborter(second ?? first, noop);
2841
- if (aborter != null && aborter.signal.aborted) throw aborter.signal.reason;
2865
+ if (aborter?.signal.aborted) throw aborter.signal.reason;
2842
2866
  const parameters = Array.isArray(first) ? first : [];
2843
2867
  let generator;
2844
2868
  if (typeof input === "function") generator = input(...parameters);
@@ -2847,7 +2871,7 @@ async function asyncGenerate(input, unwrap, first, second) {
2847
2871
  let lastValue;
2848
2872
  try {
2849
2873
  while (true) {
2850
- if (aborter != null && aborter.signal.aborted) await generator.throw(aborter.signal.reason);
2874
+ if (aborter?.signal.aborted) await generator.throw(aborter.signal.reason);
2851
2875
  const next = await generator.next(lastValue);
2852
2876
  const done = next.done === true;
2853
2877
  const { value } = next;
@@ -2863,7 +2887,7 @@ async function asyncGenerate(input, unwrap, first, second) {
2863
2887
  aborter?.cancel();
2864
2888
  await generator.return(lastValue);
2865
2889
  }
2866
- if (aborter != null && aborter.signal.aborted) throw aborter.signal.reason;
2890
+ if (aborter?.signal.aborted) throw aborter.signal.reason;
2867
2891
  if (success) return unwrap && isOk(lastValue) ? lastValue.value : lastValue;
2868
2892
  throw lastValue;
2869
2893
  }
@@ -2893,114 +2917,310 @@ function generate(input, parameters, unwrap) {
2893
2917
  throw lastValue;
2894
2918
  }
2895
2919
  //#endregion
2920
+ //#region src/internal/plan/index.ts
2921
+ function attemptRunPlan(...parameters) {
2922
+ return attempt(() => generate(this[PLAN_SYMBOL], parameters, true));
2923
+ }
2924
+ function getGenerator() {
2925
+ return this[PLAN_SYMBOL].generator();
2926
+ }
2927
+ function runAsyncPlan(first, second) {
2928
+ return asyncGenerate(this[PLAN_SYMBOL], false, first, second);
2929
+ }
2930
+ function runPlan(...parameters) {
2931
+ return generate(this[PLAN_SYMBOL], parameters, false);
2932
+ }
2933
+ //#endregion
2934
+ //#region src/plan/is.ts
2935
+ /**
2936
+ * Is the value an asynchronous, immediately failing plan?
2937
+ *
2938
+ * @param value Value to check
2939
+ * @returns `true` if the value is an asynchronous, immediately failing plan, otherwise `false`
2940
+ */
2941
+ function isAsyncFailure(value) {
2942
+ return isPlanInstance(PLAN_FAILURE_ASYNC, value);
2943
+ }
2944
+ /**
2945
+ * Is the value an asynchronous generator?
2946
+ *
2947
+ * @param value Value to check
2948
+ * @returns `true` if the value is an asynchronous generator, otherwise `false`
2949
+ */
2950
+ function isAsyncGenerator(value) {
2951
+ return isGeneratorInstance(GENERATOR_TYPE_ASYNC, value);
2952
+ }
2953
+ /**
2954
+ * Is the value an asynchronous generator function?
2955
+ *
2956
+ * @param value Value to check
2957
+ * @returns `true` if the value is an asynchronous generator function, otherwise `false`
2958
+ */
2959
+ function isAsyncGeneratorFunction(value) {
2960
+ return isGeneratorInstance(GENERATOR_FUNCTION_TYPE_ASYNC, value);
2961
+ }
2962
+ /**
2963
+ * Is the value an asynchronous plan?
2964
+ *
2965
+ * @param value Value to check
2966
+ * @returns `true` if the value is an asynchronous plan, otherwise `false`
2967
+ */
2968
+ function isAsyncPlan(value) {
2969
+ return isPlanInstance(PLAN_TYPE_ASYNC, value);
2970
+ }
2971
+ /**
2972
+ * Is the value an asynchronous step?
2973
+ *
2974
+ * @param value Value to check
2975
+ * @returns `true` if the value is an asynchronous step, otherwise `false`
2976
+ */
2977
+ function isAsyncStep(value) {
2978
+ return isPlanInstance(PLAN_STEP_ASYNC, value);
2979
+ }
2980
+ /**
2981
+ * Is the value an asynchronous, immediately successful plan?
2982
+ *
2983
+ * @param value Value to check
2984
+ * @returns `true` if the value is an asynchronous, immediately successful plan, otherwise `false`
2985
+ */
2986
+ function isAsyncSuccess(value) {
2987
+ return isPlanInstance(PLAN_SUCCESS_ASYNC, value);
2988
+ }
2989
+ /**
2990
+ * Is the value an immediately failing plan?
2991
+ *
2992
+ * @param value Value to check
2993
+ * @returns `true` if the value is an immediately failing plan, otherwise `false`
2994
+ */
2995
+ function isFailure(value) {
2996
+ return isPlanInstance(PLAN_FAILURE_SYNC, value);
2997
+ }
2998
+ /**
2999
+ * Is the value a generator?
3000
+ *
3001
+ * @param value Value to check
3002
+ * @returns `true` if the value is a generator, otherwise `false`
3003
+ */
3004
+ function isGenerator(value) {
3005
+ return isGeneratorInstance(GENERATOR_TYPE_SYNC, value);
3006
+ }
3007
+ /**
3008
+ * Is the value a generator function?
3009
+ *
3010
+ * @param value Value to check
3011
+ * @returns `true` if the value is a generator function, otherwise `false`
3012
+ */
3013
+ function isGeneratorFunction(value) {
3014
+ return isGeneratorInstance(GENERATOR_FUNCTION_TYPE_SYNC, value);
3015
+ }
3016
+ function isGeneratorInstance(type, value) {
3017
+ return Object.prototype.toString.call(value) === type;
3018
+ }
3019
+ /**
3020
+ * Is the value a plan?
3021
+ *
3022
+ * @param value Value to check
3023
+ * @returns `true` if the value is a plan, otherwise `false`
3024
+ */
3025
+ function isPlan(value) {
3026
+ return isPlanInstance(PLAN_TYPE_SYNC, value);
3027
+ }
3028
+ function isPlanInstance(type, value) {
3029
+ return typeof value === "object" && value !== null && PLAN_SYMBOL in value && value[PLAN_SYMBOL].type === type;
3030
+ }
3031
+ /**
3032
+ * Is the value a step?
3033
+ *
3034
+ * @param value Value to check
3035
+ * @returns `true` if the value is a step, otherwise `false`
3036
+ */
3037
+ function isStep(value) {
3038
+ return isPlanInstance(PLAN_STEP_SYNC, value);
3039
+ }
3040
+ /**
3041
+ * Is the value an immediately successful plan?
3042
+ *
3043
+ * @param value Value to check
3044
+ * @returns `true` if the value is an immediately successful plan, otherwise `false`
3045
+ */
3046
+ function isSuccess(value) {
3047
+ return isPlanInstance(PLAN_SUCCESS_SYNC, value);
3048
+ }
3049
+ //#endregion
2896
3050
  //#region src/plan/result.ts
2897
3051
  function asyncAttemptRun(input, first, second) {
2898
3052
  let generator;
2899
3053
  if (isAsyncPlan(input)) generator = input[PLAN_SYMBOL];
2900
- else if (isAsyncGenerator(input)) generator = input;
3054
+ else if (isAsyncGeneratorFunction(input)) generator = input;
2901
3055
  if (generator == null) throw new Error(PLAN_MESSAGE_RUN_INPUT);
2902
3056
  return asyncAttempt(() => asyncGenerate(generator, true, first, second));
2903
3057
  }
2904
3058
  function attemptRun(input, ...parameters) {
2905
3059
  let generator;
2906
3060
  if (isPlan(input)) generator = input[PLAN_SYMBOL];
2907
- else if (isGenerator(input)) generator = input;
3061
+ else if (isGeneratorFunction(input)) generator = input;
2908
3062
  if (generator == null) throw new Error(PLAN_MESSAGE_RUN_INPUT);
2909
3063
  return attempt(() => generate(generator, parameters, true));
2910
3064
  }
2911
- function attemptRunAsyncPlan(first, second) {
2912
- return asyncAttemptRun(this, first, second);
2913
- }
2914
- function attemptRunPlan(...parameters) {
2915
- return attempt(() => generate(this[PLAN_SYMBOL], parameters, true));
2916
- }
2917
3065
  attemptRun.async = asyncAttemptRun;
2918
3066
  //#endregion
2919
- //#region src/plan/run.ts
2920
- function asyncRun(input, first, second) {
2921
- if (isAsyncPlan(input)) return asyncGenerate(input[PLAN_SYMBOL], false, first, second);
2922
- if (isAsyncGenerator(input)) return asyncGenerate(input, false, first, second);
2923
- throw new Error(PLAN_MESSAGE_RUN_INPUT);
2924
- }
2925
- function run(input, ...parameters) {
2926
- if (isPlan(input)) return input.run(...parameters);
2927
- if (isGenerator(input)) return generate(input, parameters, false);
2928
- throw new Error(PLAN_MESSAGE_RUN_INPUT);
2929
- }
2930
- function runAsyncPlan(first, second) {
2931
- return asyncGenerate(this[PLAN_SYMBOL], false, first, second);
2932
- }
2933
- function runPlan(...parameters) {
2934
- return generate(this[PLAN_SYMBOL], parameters, false);
2935
- }
2936
- asyncRun.attempt = asyncAttemptRun;
2937
- run.async = asyncRun;
2938
- run.attempt = attemptRun;
2939
- //#endregion
2940
3067
  //#region src/plan/index.ts
2941
3068
  function AsyncPlan(generator) {
2942
3069
  this[PLAN_SYMBOL] = {
2943
3070
  generator,
2944
- type: PLAN_TYPE_PLAN_ASYNC
3071
+ type: PLAN_TYPE_ASYNC
2945
3072
  };
2946
3073
  }
2947
- AsyncPlan.prototype[Symbol.asyncIterator] = function() {
2948
- return this[PLAN_SYMBOL].generator();
2949
- };
3074
+ AsyncPlan.prototype[Symbol.asyncIterator] = getGenerator;
2950
3075
  AsyncPlan.prototype.attempt = attemptRunAsyncPlan;
2951
3076
  AsyncPlan.prototype.run = runAsyncPlan;
2952
3077
  function Plan(generator) {
2953
3078
  this[PLAN_SYMBOL] = {
2954
3079
  generator,
2955
- type: PLAN_TYPE_PLAN_SYNC
3080
+ type: PLAN_TYPE_SYNC
2956
3081
  };
2957
3082
  }
2958
- Plan.prototype[Symbol.iterator] = function() {
2959
- return this[PLAN_SYMBOL].generator();
2960
- };
3083
+ Plan.prototype[Symbol.iterator] = getGenerator;
2961
3084
  Plan.prototype.attempt = attemptRunPlan;
2962
3085
  Plan.prototype.run = runPlan;
3086
+ function attemptRunAsyncPlan(first, second) {
3087
+ return asyncAttemptRun(this, first, second);
3088
+ }
2963
3089
  function plan(generator) {
2964
- if (isAsyncGenerator(generator)) return new AsyncPlan(generator);
2965
- if (isGenerator(generator)) return new Plan(generator);
3090
+ if (isAsyncGeneratorFunction(generator)) return new AsyncPlan(generator);
3091
+ if (isGeneratorFunction(generator)) return new Plan(generator);
2966
3092
  throw new Error(PLAN_MESSAGE_PLAN_INPUT);
2967
3093
  }
2968
3094
  //#endregion
2969
3095
  //#region src/plan/misc.ts
2970
- function PlanFailure(generator) {
2971
- this[PLAN_SYMBOL] = { generator };
3096
+ function AsyncFailure(generator) {
3097
+ this[PLAN_SYMBOL] = {
3098
+ generator,
3099
+ type: PLAN_FAILURE_ASYNC
3100
+ };
2972
3101
  }
2973
- PlanFailure.prototype[Symbol.iterator] = function() {
2974
- return this[PLAN_SYMBOL].generator();
2975
- };
2976
- function PlanSuccess(generator) {
2977
- this[PLAN_SYMBOL] = { generator };
3102
+ AsyncFailure.prototype[Symbol.asyncIterator] = getGenerator;
3103
+ function AsyncSuccess(generator) {
3104
+ this[PLAN_SYMBOL] = {
3105
+ generator,
3106
+ type: PLAN_SUCCESS_ASYNC
3107
+ };
3108
+ }
3109
+ AsyncSuccess.prototype[Symbol.asyncIterator] = getGenerator;
3110
+ function Failure(generator) {
3111
+ this[PLAN_SYMBOL] = {
3112
+ generator,
3113
+ type: PLAN_FAILURE_SYNC
3114
+ };
3115
+ }
3116
+ Failure.prototype[Symbol.iterator] = getGenerator;
3117
+ function Success(generator) {
3118
+ this[PLAN_SYMBOL] = {
3119
+ generator,
3120
+ type: PLAN_SUCCESS_SYNC
3121
+ };
3122
+ }
3123
+ Success.prototype[Symbol.iterator] = getGenerator;
3124
+ function asyncFail(value) {
3125
+ return new AsyncFailure(async function* () {
3126
+ yield error(await (typeof value === "function" ? value() : value));
3127
+ });
3128
+ }
3129
+ function asyncSucceed(value) {
3130
+ return new AsyncSuccess(async function* () {
3131
+ return typeof value === "function" ? value() : value;
3132
+ });
2978
3133
  }
2979
- PlanSuccess.prototype[Symbol.iterator] = function() {
2980
- return this[PLAN_SYMBOL].generator();
2981
- };
2982
- /**
2983
- * Create an immediately failing plan
2984
- *
2985
- * @param value Failure value
2986
- * @returns Plan failure
2987
- */
2988
3134
  function fail(value) {
2989
- return new PlanFailure(function* () {
2990
- yield error(value);
3135
+ return new Failure(function* () {
3136
+ yield error(typeof value === "function" ? value() : value);
2991
3137
  });
2992
3138
  }
2993
- /**
2994
- * Create an immediately succeeding plan
2995
- *
2996
- * @param value Success value
2997
- * @returns Plan success
2998
- */
2999
3139
  function succeed(value) {
3000
- return new PlanSuccess(function* () {
3001
- return value;
3140
+ return new Success(function* () {
3141
+ return typeof value === "function" ? value() : value;
3142
+ });
3143
+ }
3144
+ fail.async = asyncFail;
3145
+ succeed.async = asyncSucceed;
3146
+ //#endregion
3147
+ //#region src/plan/run.ts
3148
+ function asyncRun(input, first, second) {
3149
+ if (isAsyncPlan(input)) return asyncGenerate(input[PLAN_SYMBOL], false, first, second);
3150
+ if (isAsyncGeneratorFunction(input)) return asyncGenerate(input, false, first, second);
3151
+ throw new Error(PLAN_MESSAGE_RUN_INPUT);
3152
+ }
3153
+ function run(input, ...parameters) {
3154
+ if (isPlan(input)) return input.run(...parameters);
3155
+ if (isGeneratorFunction(input)) return generate(input, parameters, false);
3156
+ throw new Error(PLAN_MESSAGE_RUN_INPUT);
3157
+ }
3158
+ asyncRun.attempt = asyncAttemptRun;
3159
+ run.async = asyncRun;
3160
+ run.attempt = attemptRun;
3161
+ //#endregion
3162
+ //#region src/plan/use.ts
3163
+ function AsyncStep(generator) {
3164
+ this[PLAN_SYMBOL] = {
3165
+ generator,
3166
+ type: PLAN_STEP_ASYNC
3167
+ };
3168
+ }
3169
+ AsyncStep.prototype[Symbol.asyncIterator] = getGenerator;
3170
+ function Step(generator) {
3171
+ this[PLAN_SYMBOL] = {
3172
+ generator,
3173
+ type: PLAN_STEP_SYNC
3174
+ };
3175
+ }
3176
+ Step.prototype[Symbol.iterator] = getGenerator;
3177
+ function asyncUse(value) {
3178
+ return new AsyncStep(async function* () {
3179
+ let actual = value;
3180
+ if (typeof actual === "function") actual = actual();
3181
+ actual = await actual;
3182
+ if (typeof actual === "function") throw new TypeError(PLAN_MESSAGE_USE_NESTED_FN);
3183
+ if (typeof actual === "object" && actual !== null && PLAN_SYMBOL in actual) return yield* actual;
3184
+ if (isAsyncGenerator(actual) || isGenerator(actual)) return yield* actual;
3185
+ if (isError(actual)) {
3186
+ yield* fail(actual.error);
3187
+ return;
3188
+ }
3189
+ if (isOk(actual)) return actual.value;
3190
+ if (actual instanceof Error) {
3191
+ yield* fail(actual);
3192
+ return;
3193
+ }
3194
+ return actual;
3195
+ });
3196
+ }
3197
+ function use(value) {
3198
+ validateUseInput(value, false);
3199
+ return new Step(function* () {
3200
+ let actual = value;
3201
+ if (typeof actual === "function") {
3202
+ actual = actual();
3203
+ validateUseInput(actual, true);
3204
+ }
3205
+ if (typeof actual === "object" && actual !== null && PLAN_SYMBOL in actual) return yield* actual;
3206
+ if (isGenerator(actual)) return yield* actual;
3207
+ if (isError(actual)) {
3208
+ yield* fail(actual.error);
3209
+ return;
3210
+ }
3211
+ if (isOk(actual)) return actual.value;
3212
+ if (actual instanceof Error) {
3213
+ yield* fail(actual);
3214
+ return;
3215
+ }
3216
+ return actual;
3002
3217
  });
3003
3218
  }
3219
+ function validateUseInput(value, resolved) {
3220
+ if (value instanceof Promise || isAsyncFailure(value) || isAsyncGenerator(value) || isAsyncGeneratorFunction(value) || isAsyncPlan(value) || isAsyncStep(value) || isAsyncSuccess(value)) throw new Error(PLAN_MESSAGE_USE_SYNC_ASYNC);
3221
+ if (resolved && typeof value === "function") throw new Error(PLAN_MESSAGE_USE_NESTED_FN);
3222
+ }
3223
+ use.async = asyncUse;
3004
3224
  //#endregion
3005
3225
  //#region src/models/promise.model.ts
3006
3226
  /**
@@ -3125,13 +3345,16 @@ function handleResult(status, parameters) {
3125
3345
  handlers.reject(value);
3126
3346
  return;
3127
3347
  }
3128
- data.result[key] = !complete ? value : status === "fulfilled" ? {
3348
+ let resultValue;
3349
+ if (complete) resultValue = status === "fulfilled" ? {
3129
3350
  status,
3130
3351
  value
3131
3352
  } : {
3132
3353
  status,
3133
3354
  reason: value
3134
3355
  };
3356
+ else resultValue = value;
3357
+ data.result[key] = resultValue;
3135
3358
  if (index === data.last) {
3136
3359
  aborter?.cancel();
3137
3360
  handlers.resolve(data.result);
@@ -3143,7 +3366,7 @@ function settlePromise(settler, value, aborter) {
3143
3366
  }
3144
3367
  async function toResult(value) {
3145
3368
  const actual = typeof value === "function" ? value() : value;
3146
- if (!(actual instanceof Promise)) return Promise.reject(/* @__PURE__ */ new TypeError(PROMISE_MESSAGE_EXPECTATION_RESULT));
3369
+ if (!(actual instanceof Promise)) throw new TypeError(PROMISE_MESSAGE_EXPECTATION_RESULT);
3147
3370
  return actual.then((result) => ok(result)).catch((reason) => error(reason));
3148
3371
  }
3149
3372
  //#endregion
@@ -3185,18 +3408,18 @@ async function getTimedPromise(promise, time, signal) {
3185
3408
  });
3186
3409
  }
3187
3410
  async function timed(promise, options) {
3188
- if (!(promise instanceof Promise)) return Promise.reject(/* @__PURE__ */ new TypeError(PROMISE_MESSAGE_EXPECTATION_TIMED));
3411
+ if (!(promise instanceof Promise)) throw new TypeError(PROMISE_MESSAGE_EXPECTATION_TIMED);
3189
3412
  const { signal, time } = createPromiseOptions(options);
3190
- if (signal?.aborted ?? false) return Promise.reject(signal?.reason);
3413
+ if (signal?.aborted ?? false) throw signal?.reason;
3191
3414
  return time > 0 ? getTimedPromise(promise, time, signal) : promise;
3192
3415
  }
3193
3416
  //#endregion
3194
3417
  //#region src/promise/index.ts
3195
3418
  async function attemptPromise(value, options) {
3196
3419
  const isFunction = typeof value === "function";
3197
- if (!isFunction && !(value instanceof Promise)) return Promise.reject(/* @__PURE__ */ new TypeError(PROMISE_MESSAGE_EXPECTATION_ATTEMPT));
3420
+ if (!isFunction && !(value instanceof Promise)) throw new TypeError(PROMISE_MESSAGE_EXPECTATION_ATTEMPT);
3198
3421
  const { signal, time } = createPromiseOptions(options);
3199
- if (signal?.aborted ?? false) return Promise.reject(signal?.reason);
3422
+ if (signal?.aborted ?? false) throw signal?.reason;
3200
3423
  const aborter = createAborter(signal, () => {
3201
3424
  rejector(signal?.reason);
3202
3425
  });
@@ -3218,8 +3441,8 @@ async function attemptPromise(value, options) {
3218
3441
  }
3219
3442
  async function promises(items, options) {
3220
3443
  const { signal, strategy } = createPromisesOptions(options);
3221
- if (signal?.aborted ?? false) return Promise.reject(signal?.reason);
3222
- if (!isArrayOrPlainObject(items)) return Promise.reject(PROMISE_MESSAGE_EXPECTATION_ITEMS_TYPE);
3444
+ if (signal?.aborted ?? false) throw signal?.reason;
3445
+ if (!isArrayOrPlainObject(items)) throw new TypeError(PROMISE_MESSAGE_EXPECTATION_ITEMS_TYPE);
3223
3446
  const isArray = Array.isArray(items);
3224
3447
  const actual = (isArray ? items.map((item, index) => [index, item]) : Object.entries(items)).map(([key, value]) => [key, typeof value === "function" ? value() : value]).filter(([, value]) => value instanceof Promise);
3225
3448
  const aborter = createAborter(signal, () => {
@@ -3282,10 +3505,10 @@ function handleResult$1(result, first, second) {
3282
3505
  error = second;
3283
3506
  }
3284
3507
  if (isOk(result)) {
3285
- if (typeof ok !== "function") throw new Error(MATCH_MESSAGE_OK);
3508
+ if (typeof ok !== "function") throw new TypeError(MATCH_MESSAGE_OK);
3286
3509
  return ok(result.value);
3287
3510
  }
3288
- if (typeof error !== "function") throw new Error(MATCH_MESSAGE_ERROR);
3511
+ if (typeof error !== "function") throw new TypeError(MATCH_MESSAGE_ERROR);
3289
3512
  return error(result.error, result.original);
3290
3513
  }
3291
3514
  function matchResult(result, first, second) {
@@ -3323,9 +3546,11 @@ attemptFlow.async = attemptAsyncFlow;
3323
3546
  //#endregion
3324
3547
  //#region src/result/work/pipe.ts
3325
3548
  async function attemptAsyncPipe(initial, first, ...seconds) {
3326
- return asyncAttempt(() => {
3549
+ return asyncAttempt(async () => {
3327
3550
  if (isError(initial)) throw initial.error;
3328
- const value = typeof initial === "function" ? initial() : isOk(initial) ? initial.value : initial;
3551
+ let value;
3552
+ if (typeof initial === "function") value = initial();
3553
+ else value = isOk(initial) ? initial.value : initial;
3329
3554
  if (first == null) return value;
3330
3555
  return asyncPipe(value, ...[first, ...seconds]);
3331
3556
  });
@@ -3333,7 +3558,9 @@ async function attemptAsyncPipe(initial, first, ...seconds) {
3333
3558
  function attemptPipe(initial, first, ...seconds) {
3334
3559
  return attempt(() => {
3335
3560
  if (isError(initial)) throw initial.error;
3336
- const value = typeof initial === "function" ? initial() : isOk(initial) ? initial.value : initial;
3561
+ let value;
3562
+ if (typeof initial === "function") value = initial();
3563
+ else value = isOk(initial) ? initial.value : initial;
3337
3564
  if (first == null) return value;
3338
3565
  return pipe(value, ...[first, ...seconds]);
3339
3566
  });
@@ -3408,7 +3635,7 @@ Object.defineProperties(Fuzzy.prototype, {
3408
3635
  }
3409
3636
  });
3410
3637
  function createFuzzyItems(items) {
3411
- return items.sort((first, second) => first.haystack.localeCompare(second.haystack)).map(({ item }) => item);
3638
+ return items.toSorted((first, second) => first.haystack.localeCompare(second.haystack)).map(({ item }) => item);
3412
3639
  }
3413
3640
  function createFuzzyOptions(input, state) {
3414
3641
  const options = isPlainObject(input) ? input : {};
@@ -3591,7 +3818,7 @@ function dedent(value, ...values) {
3591
3818
  }
3592
3819
  if (lengths.length === 0) return actual.trim();
3593
3820
  const minimum = min(lengths);
3594
- const pattern = new RegExp(`^\\s{0,${minimum}}`);
3821
+ const pattern = new RegExp(String.raw`^\s{0,${minimum}}`);
3595
3822
  let result = "";
3596
3823
  for (let index = 0; index < length; index += 1) {
3597
3824
  const line = lines[index];
@@ -3860,7 +4087,7 @@ function clone(value, options) {
3860
4087
  function cloneAny(value, parameters, depth, options) {
3861
4088
  switch (true) {
3862
4089
  case value === null || CLONE_PRIMITIVES[typeof value]: return value;
3863
- case value instanceof Date: return new Date(value.getTime());
4090
+ case value instanceof Date: return new Date(value);
3864
4091
  case typeof value === "function":
3865
4092
  parameters.options ??= createCloneOptions(options);
3866
4093
  return parameters.options.copyFunctions ? value : void 0;
@@ -4224,7 +4451,9 @@ freeze.is = isFrozen;
4224
4451
  //#region src/internal/value/partial.ts
4225
4452
  function partial(value, providedKeys, omit) {
4226
4453
  if (!isPlainObject(value)) return {};
4227
- const keys = omit ? Object.keys(value) : Array.isArray(providedKeys) ? providedKeys : [];
4454
+ let keys;
4455
+ if (omit) keys = Object.keys(value);
4456
+ else keys = Array.isArray(providedKeys) ? providedKeys : [];
4228
4457
  const { length } = keys;
4229
4458
  if (length === 0) return omit ? value : {};
4230
4459
  const partials = {};
@@ -4397,6 +4626,12 @@ function createMergingOptions(input) {
4397
4626
  actual.skipNullableInArrays = options.skipNullableInArrays === true;
4398
4627
  return actual;
4399
4628
  }
4629
+ function getFullKey(prefix, key, options) {
4630
+ let full;
4631
+ if (options.replaceableObjects == null) full = void 0;
4632
+ else full = prefix == null ? key : `${prefix}.${key}`;
4633
+ return full;
4634
+ }
4400
4635
  function getReplaceableObjects(value) {
4401
4636
  const items = (Array.isArray(value) ? value : [value]).filter((item) => typeof item === "string" || item instanceof RegExp);
4402
4637
  if (items.length === 0) return;
@@ -4424,6 +4659,9 @@ function initializeAssigner(options) {
4424
4659
  function initializeMerger(options) {
4425
4660
  return new Merger(createMergingOptions(options));
4426
4661
  }
4662
+ function isMergeable(next, previous, options, full) {
4663
+ return isArrayOrPlainObject(next) && isArrayOrPlainObject(previous) && !(options.replaceableObjects?.(full) ?? false);
4664
+ }
4427
4665
  /**
4428
4666
  * Merge multiple arrays or objects into a single one
4429
4667
  *
@@ -4450,9 +4688,9 @@ function mergeObjects(values, options, destination, prefix) {
4450
4688
  const key = keys[innerIndex];
4451
4689
  const next = item[key];
4452
4690
  const previous = merged[key];
4453
- if (next == null && (options.skipNullableAny || isArray && options.skipNullableInArrays)) continue;
4454
- const full = options.replaceableObjects == null ? void 0 : prefix == null ? key : `${prefix}.${key}`;
4455
- if (isArrayOrPlainObject(next) && isArrayOrPlainObject(previous) && !(options.replaceableObjects?.(full) ?? false)) merged[key] = mergeObjects([previous, next], options, destination == null ? void 0 : merged[key], full);
4691
+ if (skipMerge(next, options, isArray)) continue;
4692
+ const fullKey = getFullKey(prefix, key, options);
4693
+ if (isMergeable(next, previous, options, fullKey)) merged[key] = mergeObjects([previous, next], options, destination == null ? void 0 : merged[key], fullKey);
4456
4694
  else merged[key] = next;
4457
4695
  }
4458
4696
  }
@@ -4464,7 +4702,11 @@ function mergeValues(values, options, prefix) {
4464
4702
  if (actual.length === 0) return {};
4465
4703
  if (options.assignValues && actual.length === 2 && !Array.isArray(actual[0]) && Object.keys(actual[0]).length === 0) return Object.assign(actual[0], actual[1]);
4466
4704
  if (actual.length > 1) return mergeObjects(actual, options, options.assignValues ? actual[0] : void 0, prefix);
4467
- return options.assignValues ? actual[0] : Array.isArray(actual[0]) ? actual[0].slice() : { ...actual[0] };
4705
+ if (options.assignValues) return actual[0];
4706
+ return Array.isArray(actual[0]) ? actual[0].slice() : { ...actual[0] };
4707
+ }
4708
+ function skipMerge(next, options, isArray) {
4709
+ return next == null && (options.skipNullableAny || isArray && options.skipNullableInArrays);
4468
4710
  }
4469
4711
  assign.initialize = initializeAssigner;
4470
4712
  merge.initialize = initializeMerger;
@@ -4645,7 +4887,7 @@ function createSubscriptionsProperty(input) {
4645
4887
  const values = isPlainObject(input) ? input : {};
4646
4888
  return {
4647
4889
  key: typeof values.key === "string" ? values.key : SUBSCRIPTION_PROPERTY,
4648
- value: values.value == null ? SUBSCRIPTION_NAME : values.value
4890
+ value: values.value ?? "subscription"
4649
4891
  };
4650
4892
  }
4651
4893
  function createSubscriptionsState(property, keys) {
@@ -5180,7 +5422,8 @@ function setColorAlpha(value) {
5180
5422
  //#endregion
5181
5423
  //#region src/color/misc/get.ts
5182
5424
  function getClampedValue(value, minimum, maximum, rounding) {
5183
- return typeof value === "number" && !Number.isNaN(value) ? clamp(rounding ?? false ? round(value) : value, minimum, maximum) : minimum;
5425
+ if (typeof value !== "number" || Number.isNaN(value)) return minimum;
5426
+ return clamp(rounding ?? false ? round(value) : value, minimum, maximum);
5184
5427
  }
5185
5428
  function getForegroundColor(value, hex) {
5186
5429
  const { blue, green, red } = getColorFromState(getColorState(value), COLOR_TYPE.rgb);
@@ -5688,7 +5931,7 @@ function getHexaColor$1() {
5688
5931
  * @returns Normalized hex color
5689
5932
  */
5690
5933
  function getNormalizedHex(value, alpha) {
5691
- const includeAlpha = alpha ?? false;
5934
+ const includeAlpha = alpha === true;
5692
5935
  if (!isHexColor(value)) return `${COLOR_DEFAULTS.hexBlack}${includeAlpha ? COLOR_ALPHA.fullHexLong : ""}`;
5693
5936
  const normalized = value.replace(COLOR_EXPRESSION.prefix, "");
5694
5937
  if (normalized.length < COLOR_LENGTHS.hexLong) return join(`${normalized.slice(0, COLOR_LENGTHS.hexShort)}${includeAlpha ? normalized[COLOR_LENGTHS.hexShort] ?? COLOR_ALPHA.fullHexShort : ""}`.split("").map((character) => character.repeat(2)));
@@ -6968,14 +7211,13 @@ async function run$1(state) {
6968
7211
  state.runners += 1;
6969
7212
  let item = state.items.shift();
6970
7213
  while (item != null) {
7214
+ const next = item;
6971
7215
  let error = false;
6972
7216
  let result;
6973
7217
  const attempted = await asyncAttempt(async () => {
6974
- if (item != null && !(item.aborter?.signal?.aborted ?? false)) {
6975
- const parameters = item.key == null ? item.parameters : [item.key, ...item.parameters];
6976
- return await state.callback(...parameters);
6977
- }
6978
- throw new Error();
7218
+ if (next.aborter?.signal?.aborted) throw next.aborter.signal.reason;
7219
+ const parameters = next.key == null ? next.parameters : [next.key, ...next.parameters];
7220
+ return await state.callback(...parameters);
6979
7221
  });
6980
7222
  if (attempted.ok) result = attempted.value;
6981
7223
  else {
@@ -7006,7 +7248,7 @@ const RANDOM_HEX_CHARACTERS = "0123456789ABCDEF";
7006
7248
  * @returns Random boolean
7007
7249
  */
7008
7250
  function getRandomBoolean() {
7009
- return Math.random() > RANDOM_BOOLEAN_MODIFIER;
7251
+ return getRandom() > RANDOM_BOOLEAN_MODIFIER;
7010
7252
  }
7011
7253
  /**
7012
7254
  * Get a random string of characters with a specified length
@@ -7111,4 +7353,4 @@ var SizedSet = class extends Set {
7111
7353
  }
7112
7354
  };
7113
7355
  //#endregion
7114
- 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, 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 };
7356
+ 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, 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, 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, isQueueInstance, 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, toMap, toMapArrays, toQuery, toRecord, toRecordArrays, toResult, toSet, toggle, transform, trim, truncate, tryDecode, tryEncode, union, unique, unsmush, unwrap, update, upperCase, use, words };