@oscarpalmer/atoms 0.202.0 → 0.204.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 (187) hide show
  1. package/dist/array/difference.d.mts +4 -5
  2. package/dist/array/exists.d.mts +5 -6
  3. package/dist/array/filter.d.mts +10 -11
  4. package/dist/array/filter.mjs +0 -1
  5. package/dist/array/find.d.mts +10 -11
  6. package/dist/array/find.mjs +0 -1
  7. package/dist/array/first.d.mts +10 -11
  8. package/dist/array/first.mjs +0 -1
  9. package/dist/array/flatten.d.mts +2 -3
  10. package/dist/array/from.d.mts +7 -8
  11. package/dist/array/group-by.d.mts +7 -8
  12. package/dist/array/group-by.mjs +0 -1
  13. package/dist/array/insert.d.mts +3 -4
  14. package/dist/array/intersection.d.mts +4 -5
  15. package/dist/array/last.d.mts +10 -11
  16. package/dist/array/last.mjs +0 -1
  17. package/dist/array/move.d.mts +9 -10
  18. package/dist/array/move.mjs +0 -4
  19. package/dist/array/partition.d.mts +5 -6
  20. package/dist/array/push.d.mts +2 -3
  21. package/dist/array/reverse.d.mts +2 -3
  22. package/dist/array/select.d.mts +11 -12
  23. package/dist/array/select.mjs +0 -1
  24. package/dist/array/single.d.mts +4 -5
  25. package/dist/array/slice.d.mts +12 -13
  26. package/dist/array/sort.d.mts +31 -32
  27. package/dist/array/sort.mjs +38 -39
  28. package/dist/array/splice.d.mts +5 -6
  29. package/dist/array/swap.d.mts +8 -9
  30. package/dist/array/swap.mjs +0 -1
  31. package/dist/array/to-map.d.mts +7 -8
  32. package/dist/array/to-map.mjs +0 -1
  33. package/dist/array/to-record.d.mts +7 -8
  34. package/dist/array/to-record.mjs +0 -1
  35. package/dist/array/to-set.d.mts +4 -5
  36. package/dist/array/toggle.d.mts +4 -5
  37. package/dist/array/union.d.mts +4 -5
  38. package/dist/array/unique.d.mts +4 -5
  39. package/dist/array/update.d.mts +4 -5
  40. package/dist/beacon.d.mts +8 -9
  41. package/dist/beacon.mjs +96 -71
  42. package/dist/color/constants.d.mts +14 -13
  43. package/dist/color/constants.mjs +9 -2
  44. package/dist/color/index.d.mts +2 -2
  45. package/dist/color/instance.d.mts +3 -3
  46. package/dist/color/instance.mjs +91 -69
  47. package/dist/color/misc/alpha.d.mts +7 -6
  48. package/dist/color/misc/alpha.mjs +8 -2
  49. package/dist/color/misc/format.d.mts +6 -7
  50. package/dist/color/misc/format.mjs +15 -12
  51. package/dist/color/misc/get.d.mts +14 -15
  52. package/dist/color/misc/is.d.mts +16 -17
  53. package/dist/color/misc/is.mjs +7 -7
  54. package/dist/color/misc/state.d.mts +33 -10
  55. package/dist/color/misc/state.mjs +28 -48
  56. package/dist/color/models.d.mts +25 -19
  57. package/dist/color/space/hex.d.mts +14 -11
  58. package/dist/color/space/hex.mjs +21 -2
  59. package/dist/color/space/hsl.d.mts +13 -10
  60. package/dist/color/space/hsl.mjs +25 -4
  61. package/dist/color/space/hwb.d.mts +14 -11
  62. package/dist/color/space/hwb.mjs +24 -3
  63. package/dist/color/space/rgb.d.mts +16 -13
  64. package/dist/color/space/rgb.mjs +41 -20
  65. package/dist/function/limit.d.mts +9 -8
  66. package/dist/function/limit.mjs +5 -7
  67. package/dist/function/once.d.mts +26 -6
  68. package/dist/function/once.mjs +129 -76
  69. package/dist/function/retry.d.mts +5 -6
  70. package/dist/function/retry.mjs +3 -4
  71. package/dist/index.d.mts +184 -60
  72. package/dist/index.mjs +1292 -970
  73. package/dist/internal/aborter.d.mts +9 -0
  74. package/dist/internal/{abort.mjs → aborter.mjs} +1 -1
  75. package/dist/internal/array/callbacks.d.mts +4 -5
  76. package/dist/internal/array/chunk.d.mts +2 -3
  77. package/dist/internal/array/compact.d.mts +3 -4
  78. package/dist/internal/array/find.d.mts +10 -11
  79. package/dist/internal/array/get.d.mts +7 -8
  80. package/dist/internal/array/get.mjs +3 -2
  81. package/dist/internal/array/group.d.mts +2 -3
  82. package/dist/internal/array/index-of.d.mts +10 -11
  83. package/dist/internal/array/index-of.mjs +0 -1
  84. package/dist/internal/array/insert.d.mts +5 -6
  85. package/dist/internal/array/match.d.mts +17 -18
  86. package/dist/internal/array/overlap.d.mts +2 -3
  87. package/dist/internal/array/sets.d.mts +5 -6
  88. package/dist/internal/array/shuffle.d.mts +2 -3
  89. package/dist/internal/array/update.d.mts +2 -3
  90. package/dist/internal/defaults.d.mts +3 -4
  91. package/dist/internal/function/assert.d.mts +10 -11
  92. package/dist/internal/function/assert.mjs +0 -7
  93. package/dist/internal/function/limit.d.mts +41 -0
  94. package/dist/internal/function/limit.mjs +106 -0
  95. package/dist/internal/function/memoize.d.mts +4 -5
  96. package/dist/internal/function/memoize.mjs +55 -31
  97. package/dist/internal/function/misc.d.mts +2 -3
  98. package/dist/internal/function/work.d.mts +53 -54
  99. package/dist/internal/function/work.mjs +0 -2
  100. package/dist/internal/herald.d.mts +8 -9
  101. package/dist/internal/herald.mjs +38 -27
  102. package/dist/internal/is.d.mts +19 -20
  103. package/dist/internal/math/aggregate.d.mts +14 -15
  104. package/dist/internal/math/misc.d.mts +3 -4
  105. package/dist/internal/number.d.mts +4 -5
  106. package/dist/internal/random.d.mts +3 -4
  107. package/dist/internal/result/misc.d.mts +29 -14
  108. package/dist/internal/result/misc.mjs +4 -3
  109. package/dist/internal/result/models.d.mts +9 -10
  110. package/dist/internal/sized/map.d.mts +2 -3
  111. package/dist/internal/sized/misc.d.mts +2 -3
  112. package/dist/internal/string/case.d.mts +9 -10
  113. package/dist/internal/string/misc.d.mts +8 -9
  114. package/dist/internal/subscription.d.mts +10 -11
  115. package/dist/internal/subscription.mjs +72 -58
  116. package/dist/internal/value/compare.d.mts +17 -9
  117. package/dist/internal/value/compare.mjs +6 -11
  118. package/dist/internal/value/equal.d.mts +34 -15
  119. package/dist/internal/value/equal.mjs +20 -13
  120. package/dist/internal/value/get.d.mts +3 -4
  121. package/dist/internal/value/handlers.d.mts +19 -9
  122. package/dist/internal/value/handlers.mjs +48 -50
  123. package/dist/internal/value/has.d.mts +6 -7
  124. package/dist/internal/value/has.mjs +0 -1
  125. package/dist/internal/value/misc.d.mts +6 -7
  126. package/dist/internal/value/misc.mjs +4 -3
  127. package/dist/internal/value/partial.d.mts +3 -4
  128. package/dist/internal/value/partial.mjs +2 -1
  129. package/dist/internal/value/set.d.mts +4 -5
  130. package/dist/internal/value/set.mjs +2 -1
  131. package/dist/is.d.mts +13 -13
  132. package/dist/logger.d.mts +5 -4
  133. package/dist/logger.mjs +72 -64
  134. package/dist/math.d.mts +20 -20
  135. package/dist/models.d.mts +45 -49
  136. package/dist/promise/constants.d.mts +14 -15
  137. package/dist/promise/delay.d.mts +3 -4
  138. package/dist/promise/delay.mjs +5 -5
  139. package/dist/promise/helpers.d.mts +7 -8
  140. package/dist/promise/helpers.mjs +4 -3
  141. package/dist/promise/index.d.mts +13 -14
  142. package/dist/promise/index.mjs +1 -2
  143. package/dist/promise/misc.d.mts +7 -7
  144. package/dist/promise/models.d.mts +17 -18
  145. package/dist/promise/timed.d.mts +4 -5
  146. package/dist/promise/timed.mjs +6 -6
  147. package/dist/query.d.mts +3 -4
  148. package/dist/queue.d.mts +14 -15
  149. package/dist/queue.mjs +198 -136
  150. package/dist/random.d.mts +8 -8
  151. package/dist/result/index.d.mts +8 -9
  152. package/dist/result/index.mjs +0 -1
  153. package/dist/result/match.d.mts +6 -7
  154. package/dist/result/match.mjs +0 -1
  155. package/dist/result/misc.d.mts +3 -3
  156. package/dist/result/work/flow.d.mts +28 -29
  157. package/dist/result/work/flow.mjs +0 -1
  158. package/dist/result/work/pipe.d.mts +24 -25
  159. package/dist/result/work/pipe.mjs +0 -1
  160. package/dist/sized/set.d.mts +2 -3
  161. package/dist/string/fuzzy.d.mts +21 -12
  162. package/dist/string/fuzzy.mjs +77 -52
  163. package/dist/string/index.d.mts +8 -8
  164. package/dist/string/match.d.mts +4 -5
  165. package/dist/string/normalize.d.mts +8 -9
  166. package/dist/string/normalize.mjs +9 -5
  167. package/dist/string/template.d.mts +9 -9
  168. package/dist/string/template.mjs +11 -5
  169. package/dist/value/clone.d.mts +21 -13
  170. package/dist/value/clone.mjs +19 -25
  171. package/dist/value/collection.d.mts +4 -5
  172. package/dist/value/diff.d.mts +5 -6
  173. package/dist/value/freeze.d.mts +18 -19
  174. package/dist/value/freeze.mjs +1 -5
  175. package/dist/value/merge.d.mts +13 -14
  176. package/dist/value/merge.mjs +21 -7
  177. package/dist/value/omit.d.mts +2 -3
  178. package/dist/value/pick.d.mts +2 -3
  179. package/dist/value/shake.d.mts +3 -4
  180. package/dist/value/smush.d.mts +3 -4
  181. package/dist/value/transform.d.mts +15 -10
  182. package/dist/value/transform.mjs +12 -8
  183. package/dist/value/unsmush.d.mts +3 -4
  184. package/package.json +2 -2
  185. package/dist/internal/abort.d.mts +0 -10
  186. package/dist/internal/function/timer.d.mts +0 -10
  187. package/dist/internal/function/timer.mjs +0 -87
@@ -6,14 +6,14 @@ import { ArrayOrPlainObject, Constructor, Key, PlainObject, Primitive, TypedArra
6
6
  * @param value Value to check
7
7
  * @returns `true` if the value is an array or a plain object, otherwise `false`
8
8
  */
9
- declare function isArrayOrPlainObject(value: unknown): value is ArrayOrPlainObject;
9
+ export declare function isArrayOrPlainObject(value: unknown): value is ArrayOrPlainObject;
10
10
  /**
11
11
  * Is the value a constructor function?
12
12
  *
13
13
  * @param value Value to check
14
14
  * @returns `true` if the value is a constructor function, otherwise `false`
15
15
  */
16
- declare function isConstructor(value: unknown): value is Constructor;
16
+ export declare function isConstructor(value: unknown): value is Constructor;
17
17
  /**
18
18
  * Is the value an instance of the constructor?
19
19
  *
@@ -21,28 +21,28 @@ declare function isConstructor(value: unknown): value is Constructor;
21
21
  * @param value Value to check
22
22
  * @returns `true` if the value is an instance of the constructor, otherwise `false`
23
23
  */
24
- declare function isInstanceOf<Instance>(constructor: Constructor<Instance>, value: unknown): value is Instance;
24
+ export declare function isInstanceOf<Instance>(constructor: Constructor<Instance>, value: unknown): value is Instance;
25
25
  /**
26
26
  * Is the value a _Key_?
27
27
  *
28
28
  * @param value Value to check
29
29
  * @returns `true` if the value is a _Key_ _(`number` or `string`)_, otherwise `false`
30
30
  */
31
- declare function isKey(value: unknown): value is Key;
31
+ export declare function isKey(value: unknown): value is Key;
32
32
  /**
33
33
  * Is the value not an array or a plain object?
34
34
  *
35
35
  * @param value Value to check
36
36
  * @returns `true` if the value is not an array or a plain object, otherwise `false`
37
37
  */
38
- declare function isNonArrayOrPlainObject<Value>(value: Value): value is Exclude<Value, ArrayOrPlainObject>;
38
+ export declare function isNonArrayOrPlainObject<Value>(value: Value): value is Exclude<Value, ArrayOrPlainObject>;
39
39
  /**
40
40
  * Is the value not a constructor function?
41
41
  *
42
42
  * @param value Value to check
43
43
  * @returns `true` if the value is not a constructor function, otherwise `false`
44
44
  */
45
- declare function isNonConstructor<Value>(value: Value): value is Exclude<Value, Constructor>;
45
+ export declare function isNonConstructor<Value>(value: Value): value is Exclude<Value, Constructor>;
46
46
  /**
47
47
  * Is the value not an instance of the constructor?
48
48
  *
@@ -50,83 +50,82 @@ declare function isNonConstructor<Value>(value: Value): value is Exclude<Value,
50
50
  * @param value Value to check
51
51
  * @returns `true` if the value is not an instance of the constructor, otherwise `false`
52
52
  */
53
- declare function isNonInstanceOf<Instance, Value>(constructor: Constructor<Instance>, value: Value): value is Exclude<Value, Instance>;
53
+ export declare function isNonInstanceOf<Instance, Value>(constructor: Constructor<Instance>, value: Value): value is Exclude<Value, Instance>;
54
54
  /**
55
55
  * Is the value not a _Key_?
56
56
  *
57
57
  * @param value Value to check
58
58
  * @returns `true` if the value is not a _Key_ _(`number` or `string`)_, otherwise `false`
59
59
  */
60
- declare function isNonKey<Value>(value: Value): value is Exclude<Value, Key>;
60
+ export declare function isNonKey<Value>(value: Value): value is Exclude<Value, Key>;
61
61
  /**
62
62
  * Is the value not a number?
63
63
  *
64
64
  * @param value Value to check
65
65
  * @returns `true` if the value is not a `number`, otherwise `false`
66
66
  */
67
- declare function isNonNumber<Value>(value: Value): value is Exclude<Value, number>;
67
+ export declare function isNonNumber<Value>(value: Value): value is Exclude<Value, number>;
68
68
  /**
69
69
  * Is the value not a plain object?
70
70
  *
71
71
  * @param value Value to check
72
72
  * @returns `true` if the value is not a plain object, otherwise `false`
73
73
  */
74
- declare function isNonPlainObject<Value>(value: Value): value is Exclude<Value, PlainObject>;
74
+ export declare function isNonPlainObject<Value>(value: Value): value is Exclude<Value, PlainObject>;
75
75
  /**
76
76
  * Is the value not a primitive value?
77
77
  *
78
78
  * @param value Value to check
79
79
  * @returns `true` if the value is not a primitive value, otherwise `false`
80
80
  */
81
- declare function isNonPrimitive<Value>(value: Value): value is Exclude<Value, Primitive>;
81
+ export declare function isNonPrimitive<Value>(value: Value): value is Exclude<Value, Primitive>;
82
82
  /**
83
83
  * Is the value not a template strings array?
84
84
  *
85
85
  * @param value Value to check
86
86
  * @returns `true` if the value is not a `TemplateStringsArray`, otherwise `false`
87
87
  */
88
- declare function isNonTemplateStringsArray<Value>(value: Value): value is Exclude<Value, TemplateStringsArray>;
88
+ export declare function isNonTemplateStringsArray<Value>(value: Value): value is Exclude<Value, TemplateStringsArray>;
89
89
  /**
90
90
  * Is the value not a typed array?
91
91
  *
92
92
  * @param value Value to check
93
93
  * @returns `true` if the value is not a typed array, otherwise `false`
94
94
  */
95
- declare function isNonTypedArray<Value>(value: Value): value is Exclude<Value, TypedArray>;
95
+ export declare function isNonTypedArray<Value>(value: Value): value is Exclude<Value, TypedArray>;
96
96
  /**
97
97
  * Is the value a number?
98
98
  *
99
99
  * @param value Value to check
100
100
  * @returns `true` if the value is a `number`, otherwise `false`
101
101
  */
102
- declare function isNumber(value: unknown): value is number;
102
+ export declare function isNumber(value: unknown): value is number;
103
103
  /**
104
104
  * Is the value a plain object?
105
105
  *
106
106
  * @param value Value to check
107
107
  * @returns `true` if the value is a plain object, otherwise `false`
108
108
  */
109
- declare function isPlainObject(value: unknown): value is PlainObject;
109
+ export declare function isPlainObject(value: unknown): value is PlainObject;
110
110
  /**
111
111
  * Is the value a primitive value?
112
112
  *
113
113
  * @param value Value to check
114
114
  * @returns `true` if the value is a primitive value, otherwise `false`
115
115
  */
116
- declare function isPrimitive(value: unknown): value is Primitive;
116
+ export declare function isPrimitive(value: unknown): value is Primitive;
117
117
  /**
118
118
  * Is the value a template strings array?
119
119
  *
120
120
  * @param value Value to check
121
121
  * @returns `true` if the value is a `TemplateStringsArray`, otherwise `false`
122
122
  */
123
- declare function isTemplateStringsArray(value: unknown): value is TemplateStringsArray;
123
+ export declare function isTemplateStringsArray(value: unknown): value is TemplateStringsArray;
124
124
  /**
125
125
  * Is the value a typed array?
126
126
  *
127
127
  * @param value Value to check
128
128
  * @returns `true` if the value is a typed array, otherwise `false`
129
129
  */
130
- declare function isTypedArray(value: unknown): value is TypedArray;
131
- //#endregion
132
- export { isArrayOrPlainObject, isConstructor, isInstanceOf, isKey, isNonArrayOrPlainObject, isNonConstructor, isNonInstanceOf, isNonKey, isNonNumber, isNonPlainObject, isNonPrimitive, isNonTemplateStringsArray, isNonTypedArray, isNumber, isPlainObject, isPrimitive, isTemplateStringsArray, isTypedArray };
130
+ export declare function isTypedArray(value: unknown): value is TypedArray;
131
+ //#endregion
@@ -7,11 +7,11 @@ type Aggregation = {
7
7
  items?: Record<number, unknown[]>;
8
8
  value: number;
9
9
  };
10
- type AggregationType = 'average' | 'max' | 'min' | 'sum';
10
+ export type AggregationType = 'average' | 'max' | 'min' | 'sum';
11
11
  type NonAverageAggregationType = 'max' | 'min' | 'sum';
12
- declare function aggregate(type: AggregationType, array: unknown[], key: unknown, first?: unknown): Aggregation;
13
- declare function getAggregateCallback(key: unknown): Function | undefined;
14
- declare function getAggregated(type: NonAverageAggregationType, array: unknown[], key?: unknown, first?: unknown): unknown;
12
+ export declare function aggregate(type: AggregationType, array: unknown[], key: unknown, first?: unknown): Aggregation;
13
+ export declare function getAggregateCallback(key: unknown): Function | undefined;
14
+ export declare function getAggregated(type: NonAverageAggregationType, array: unknown[], key?: unknown, first?: unknown): unknown;
15
15
  /**
16
16
  * Get the maximum value from a list of items
17
17
  *
@@ -30,7 +30,7 @@ declare function getAggregated(type: NonAverageAggregationType, array: unknown[]
30
30
  * @param first Return only the first item with the maximum value
31
31
  * @returns Item with the maximum value, or `undefined` if no maximum can be found
32
32
  */
33
- declare function max<Item>(items: Item[], callback: (item: Item, index: number, array: Item[]) => number, first: true): Item | undefined;
33
+ export declare function max<Item>(items: Item[], callback: (item: Item, index: number, array: Item[]) => number, first: true): Item | undefined;
34
34
  /**
35
35
  * Get the maximum value from a list of items
36
36
  *
@@ -49,7 +49,7 @@ declare function max<Item>(items: Item[], callback: (item: Item, index: number,
49
49
  * @param first Return only the first item with the maximum value
50
50
  * @returns Item with the maximum value, or `undefined` if no maximum can be found
51
51
  */
52
- declare function max<Item extends PlainObject>(items: Item[], key: keyof NumericalValues<Item>, first: true): Item | undefined;
52
+ export declare function max<Item extends PlainObject>(items: Item[], key: keyof NumericalValues<Item>, first: true): Item | undefined;
53
53
  /**
54
54
  * Get the maximum value from a list of items
55
55
  *
@@ -67,7 +67,7 @@ declare function max<Item extends PlainObject>(items: Item[], key: keyof Numeric
67
67
  * @param callback Callback to get an item's value
68
68
  * @returns Items with the maximum value
69
69
  */
70
- declare function max<Item>(items: Item[], callback: (item: Item, index: number, array: Item[]) => number): Item[];
70
+ export declare function max<Item>(items: Item[], callback: (item: Item, index: number, array: Item[]) => number): Item[];
71
71
  /**
72
72
  * Get the maximum value from a list of items
73
73
  *
@@ -85,7 +85,7 @@ declare function max<Item>(items: Item[], callback: (item: Item, index: number,
85
85
  * @param key Key to use for value
86
86
  * @returns Items with the maximum value
87
87
  */
88
- declare function max<Item extends PlainObject>(items: Item[], key: keyof NumericalValues<Item>): Item[];
88
+ export declare function max<Item extends PlainObject>(items: Item[], key: keyof NumericalValues<Item>): Item[];
89
89
  /**
90
90
  * Get the maximum value from a list of numbers
91
91
  *
@@ -98,10 +98,9 @@ declare function max<Item extends PlainObject>(items: Item[], key: keyof Numeric
98
98
  * @param values List of numbers
99
99
  * @returns Maximum value, or `Number.NaN` if no maximum can be found
100
100
  */
101
- declare function max(values: number[]): number;
102
- declare const AGGREGATION_AVERAGE: AggregationType;
103
- declare const AGGREGATION_MAX = "max";
104
- declare const AGGREGATION_MIN = "min";
105
- declare const AGGREGATION_SUM = "sum";
106
- //#endregion
107
- export { AGGREGATION_AVERAGE, AGGREGATION_MAX, AGGREGATION_MIN, AGGREGATION_SUM, AggregationType, aggregate, getAggregateCallback, getAggregated, max };
101
+ export declare function max(values: number[]): number;
102
+ export declare const AGGREGATION_AVERAGE: AggregationType;
103
+ export declare const AGGREGATION_MAX = "max";
104
+ export declare const AGGREGATION_MIN = "min";
105
+ export declare const AGGREGATION_SUM = "sum";
106
+ //#endregion
@@ -6,7 +6,6 @@
6
6
  * @param decimals Number of decimal places to round to _(defaults to `0`)_
7
7
  * @returns Rounded number, or `Number.NaN` if the value if unable to be rounded
8
8
  */
9
- declare function round(value: number, decimals?: number): number;
10
- declare function roundNumber(callback: (value: number) => number, value: number, decimals?: number): number;
11
- //#endregion
12
- export { round, roundNumber };
9
+ export declare function round(value: number, decimals?: number): number;
10
+ export declare function roundNumber(callback: (value: number) => number, value: number, decimals?: number): number;
11
+ //#endregion
@@ -7,7 +7,7 @@
7
7
  * @param maximum Maximum value
8
8
  * @returns `true` if the value is between the minimum and maximum, otherwise `false`
9
9
  */
10
- declare function between(value: number, minimum: number, maximum: number): boolean;
10
+ export declare function between(value: number, minimum: number, maximum: number): boolean;
11
11
  /**
12
12
  * Clamp a number between a minimum and maximum value
13
13
  *
@@ -23,7 +23,7 @@ declare function between(value: number, minimum: number, maximum: number): boole
23
23
  * clamp(10, 0, 5, true); // => 0
24
24
  * ```
25
25
  */
26
- declare function clamp(value: number, minimum: number, maximum: number, loop?: boolean): number;
26
+ export declare function clamp(value: number, minimum: number, maximum: number, loop?: boolean): number;
27
27
  /**
28
28
  * Get the number value from an unknown value
29
29
  *
@@ -32,6 +32,5 @@ declare function clamp(value: number, minimum: number, maximum: number, loop?: b
32
32
  * @param value Original value
33
33
  * @returns Original value as a number, or `Number.NaN` if the value is unable to be parsed
34
34
  */
35
- declare function getNumber(value: unknown): number;
36
- //#endregion
37
- export { between, clamp, getNumber };
35
+ export declare function getNumber(value: unknown): number;
36
+ //#endregion
@@ -6,7 +6,7 @@
6
6
  * @param maximum Maximum value
7
7
  * @returns Random floating-point number
8
8
  */
9
- declare function getRandomFloatingNumber(minimum?: number, maximum?: number): number;
9
+ export declare function getRandomFloatingNumber(minimum?: number, maximum?: number): number;
10
10
  /**
11
11
  * Get a random integer
12
12
  *
@@ -14,6 +14,5 @@ declare function getRandomFloatingNumber(minimum?: number, maximum?: number): nu
14
14
  * @param maximum Maximum value
15
15
  * @returns Random integer
16
16
  */
17
- declare function getRandomInteger(minimum?: number, maximum?: number): number;
18
- //#endregion
19
- export { getRandomFloatingNumber, getRandomInteger };
17
+ export declare function getRandomInteger(minimum?: number, maximum?: number): number;
18
+ //#endregion
@@ -7,64 +7,80 @@ import { Err, ExtendedErr, Ok, Result } from "./models.mjs";
7
7
  * @param original Original error
8
8
  * @returns Error result
9
9
  */
10
- declare function error<E>(value: E, original: Error): ExtendedErr<E>;
10
+ export declare function error<E>(value: E, original: Error): ExtendedErr<E>;
11
11
  /**
12
12
  * Creates an error result
13
13
  *
14
14
  * @param value Error value
15
15
  * @returns Error result
16
16
  */
17
- declare function error<E>(value: E): Err<E>;
18
- declare function getError<E>(value: E, original?: Error): Err<E> | ExtendedErr<E>;
17
+ export declare function error<E>(value: E): Err<E>;
18
+ export declare namespace error {
19
+ var is: typeof isError;
20
+ }
21
+ export declare function getError<E>(value: E, original?: Error): Err<E> | ExtendedErr<E>;
19
22
  /**
20
23
  * Is the _Result_ an extended error?
21
24
  *
25
+ * _Available as `isError` and `error.is`_
26
+ *
22
27
  * @param result _Result_ to check
23
28
  * @returns `true` if the _Result_ is an extended error, otherwise `false`
24
29
  */
25
- declare function isError<Value, E = Error>(result: ExtendedErr<E> | Result<Value, E>, extended: true): result is ExtendedErr<E>;
30
+ export declare function isError<Value, E = Error>(result: ExtendedErr<E> | Result<Value, E>, extended: true): result is ExtendedErr<E>;
26
31
  /**
27
32
  * Is the _Result_ an error?
28
33
  *
34
+ * _Available as `isError` and `error.is`_
35
+ *
29
36
  * @param result _Result_ to check
30
37
  * @returns `true` if the _Result_ is an error, otherwise `false`
31
38
  */
32
- declare function isError<Value, E = Error>(result: Result<Value, E>): result is Err<E>;
39
+ export declare function isError<Value, E = Error>(result: Result<Value, E>): result is Err<E>;
33
40
  /**
34
41
  * Is the value an error?
35
42
  *
43
+ * _Available as `isError` and `error.is`_
44
+ *
36
45
  * @param value Value to check
37
46
  * @returns `true` if the value is an error, otherwise `false`
38
47
  */
39
- declare function isError(value: unknown): value is Err<unknown> | ExtendedErr<unknown>;
48
+ export declare function isError(value: unknown): value is Err<unknown> | ExtendedErr<unknown>;
40
49
  /**
41
50
  * Is the _Result_ ok?
42
51
  *
52
+ * _Available as `isOk` and `ok.is`_
53
+ *
43
54
  * @param value _Result_ to check
44
55
  * @returns `true` if the _Result_ is ok, otherwise `false`
45
56
  */
46
- declare function isOk<Value, E = Error>(value: Result<Value, E>): value is Ok<Value>;
57
+ export declare function isOk<Value, E = Error>(value: Result<Value, E>): value is Ok<Value>;
47
58
  /**
48
59
  * Is the value ok?
49
60
  *
61
+ * _Available as `isOk` and `ok.is`_
62
+ *
50
63
  * @param value Value to check
51
64
  * @returns `true` if the value is ok, otherwise `false`
52
65
  */
53
- declare function isOk(value: unknown): value is Ok<unknown>;
66
+ export declare function isOk(value: unknown): value is Ok<unknown>;
54
67
  /**
55
68
  * Is the value a _Result_?
56
69
  *
57
70
  * @param value Value to check
58
71
  * @returns `true` if the value is a _Result_, otherwise `false`
59
72
  */
60
- declare function isResult(value: unknown): value is ExtendedErr<unknown> | Result<unknown, unknown>;
73
+ export declare function isResult(value: unknown): value is ExtendedErr<unknown> | Result<unknown, unknown>;
61
74
  /**
62
75
  * Creates an ok result
63
76
  *
64
77
  * @param value Value
65
78
  * @returns Ok result
66
79
  */
67
- declare function ok<Value>(value: Value): Ok<Value>;
80
+ export declare function ok<Value>(value: Value): Ok<Value>;
81
+ export declare namespace ok {
82
+ var is: typeof isOk;
83
+ }
68
84
  /**
69
85
  * Gets the value of an ok result _(or a default value)_
70
86
  *
@@ -72,7 +88,7 @@ declare function ok<Value>(value: Value): Ok<Value>;
72
88
  * @param defaultValue Default value
73
89
  * @returns Value of the _Result_ _(or the default value)_
74
90
  */
75
- declare function unwrap<Value, E = Error>(value: Result<Value, E>, defaultValue: Value): Value;
91
+ export declare function unwrap<Value, E = Error>(value: Result<Value, E>, defaultValue: Value): Value;
76
92
  /**
77
93
  * Gets the value of an ok result _(or a default value)_
78
94
  *
@@ -80,6 +96,5 @@ declare function unwrap<Value, E = Error>(value: Result<Value, E>, defaultValue:
80
96
  * @param defaultValue Default value
81
97
  * @returns Value of the _Result_ _(or the default value)_
82
98
  */
83
- declare function unwrap(value: unknown, defaultValue: unknown): unknown;
84
- //#endregion
85
- export { error, getError, isError, isOk, isResult, ok, unwrap };
99
+ export declare function unwrap(value: unknown, defaultValue: unknown): unknown;
100
+ //#endregion
@@ -1,4 +1,4 @@
1
- import { isNonPlainObject } from "../is.mjs";
1
+ import { isPlainObject } from "../is.mjs";
2
2
  //#region src/internal/result/misc.ts
3
3
  function error(value, original) {
4
4
  return getError(value, original);
@@ -27,8 +27,7 @@ function isResult(value) {
27
27
  return isResultValue(value, true) || isResultValue(value, false);
28
28
  }
29
29
  function isResultValue(value, okValue) {
30
- if (isNonPlainObject(value)) return false;
31
- return value.ok === okValue && (okValue ? RESULT_PROPERTY_VALUE : RESULT_PROPERTY_ERROR) in value;
30
+ return isPlainObject(value) && value.ok === okValue && (okValue ? RESULT_PROPERTY_VALUE : RESULT_PROPERTY_ERROR) in value;
32
31
  }
33
32
  /**
34
33
  * Creates an ok result
@@ -47,5 +46,7 @@ function unwrap(value, defaultValue) {
47
46
  }
48
47
  const RESULT_PROPERTY_ERROR = "error";
49
48
  const RESULT_PROPERTY_VALUE = "value";
49
+ error.is = isError;
50
+ ok.is = isOk;
50
51
  //#endregion
51
52
  export { error, getError, isError, isOk, isResult, ok, unwrap };
@@ -3,39 +3,39 @@ import { GenericCallback } from "../../models.mjs";
3
3
  /**
4
4
  * An unknown result
5
5
  */
6
- type AnyResult<Value, E> = Err<E> | ExtendedErr<E> | Ok<Value>;
6
+ export type AnyResult<Value, E> = Err<E> | ExtendedErr<E> | Ok<Value>;
7
7
  /**
8
8
  * An error result
9
9
  */
10
- type Err<Error> = {
10
+ export type Err<Error> = {
11
11
  ok: false;
12
12
  error: Error;
13
13
  };
14
14
  /**
15
15
  * An extended error result
16
16
  */
17
- type ExtendedErr<E> = Err<E> & {
17
+ export type ExtendedErr<E> = Err<E> & {
18
18
  original: Error;
19
19
  };
20
20
  /**
21
21
  * An extended, unknown result
22
22
  */
23
- type ExtendedResult<Value, E> = ExtendedErr<E> | Ok<Value>;
23
+ export type ExtendedResult<Value, E> = ExtendedErr<E> | Ok<Value>;
24
24
  /**
25
25
  * A successful result
26
26
  */
27
- type Ok<Value> = {
27
+ export type Ok<Value> = {
28
28
  ok: true;
29
29
  value: Value;
30
30
  };
31
31
  /**
32
32
  * An unknown result
33
33
  */
34
- type Result<Value, E = Error> = Err<E> | Ok<Value>;
34
+ export type Result<Value, E = Error> = Err<E> | Ok<Value>;
35
35
  /**
36
36
  * Match callbacks for a result
37
37
  */
38
- type ResultMatch<Value, Returned, E = Error> = {
38
+ export type ResultMatch<Value, Returned, E = Error> = {
39
39
  /**
40
40
  * Callback for error result
41
41
  *
@@ -59,6 +59,5 @@ type UnwrapResult<Original extends Result<unknown, unknown>> = Original extends
59
59
  /**
60
60
  * Unwrap any value
61
61
  */
62
- type UnwrapValue<Original> = Original extends GenericCallback ? ReturnType<Original> extends Result<unknown, unknown> ? UnwrapResult<ReturnType<Original>> : ReturnType<Original> : Original extends Result<unknown, unknown> ? UnwrapResult<Original> : Original extends Promise<infer Value> ? Awaited<Value> : Original;
63
- //#endregion
64
- export { AnyResult, Err, ExtendedErr, ExtendedResult, Ok, Result, ResultMatch, UnwrapValue };
62
+ export type UnwrapValue<Original> = Original extends GenericCallback ? ReturnType<Original> extends Result<unknown, unknown> ? UnwrapResult<ReturnType<Original>> : ReturnType<Original> : Original extends Result<unknown, unknown> ? UnwrapResult<Original> : Original extends Promise<infer Value> ? Awaited<Value> : Original;
63
+ //#endregion
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * Behavior is similar to a _LRU_ cache, where the least recently used entries are removed
6
6
  */
7
- declare class SizedMap<SizedKey = unknown, SizedValue = unknown> extends Map<SizedKey, SizedValue> {
7
+ export declare class SizedMap<SizedKey = unknown, SizedValue = unknown> extends Map<SizedKey, SizedValue> {
8
8
  #private;
9
9
  /**
10
10
  * Is the _Map_ full?
@@ -45,5 +45,4 @@ declare class SizedMap<SizedKey = unknown, SizedValue = unknown> extends Map<Siz
45
45
  */
46
46
  set(key: SizedKey, value: SizedValue): this;
47
47
  }
48
- //#endregion
49
- export { SizedMap };
48
+ //#endregion
@@ -1,4 +1,3 @@
1
1
  //#region src/internal/sized/misc.d.ts
2
- declare function getSizedMaximum(first?: unknown, second?: unknown): number;
3
- //#endregion
4
- export { getSizedMaximum };
2
+ export declare function getSizedMaximum(first?: unknown, second?: unknown): number;
3
+ //#endregion
@@ -5,55 +5,54 @@
5
5
  * @param value String to convert
6
6
  * @returns Camel-cased string
7
7
  */
8
- declare function camelCase(value: string): string;
8
+ export declare function camelCase(value: string): string;
9
9
  /**
10
10
  * Capitalize the first letter of a string _(and lowercase the rest)_
11
11
  *
12
12
  * @param value String to capitalize
13
13
  * @returns Capitalized string
14
14
  */
15
- declare function capitalize(value: string): string;
15
+ export declare function capitalize(value: string): string;
16
16
  /**
17
17
  * Convert a string to kebab case _(this-is-kebab-case)_
18
18
  *
19
19
  * @param value String to convert
20
20
  * @returns Kebab-cased string
21
21
  */
22
- declare function kebabCase(value: string): string;
22
+ export declare function kebabCase(value: string): string;
23
23
  /**
24
24
  * Convert a string to lower case
25
25
  *
26
26
  * @param value String to convert
27
27
  * @returns Lower-cased string
28
28
  */
29
- declare function lowerCase(value: string): string;
29
+ export declare function lowerCase(value: string): string;
30
30
  /**
31
31
  * Convert a string to pascal case _(ThisIsPascalCase)_
32
32
  *
33
33
  * @param value String to convert
34
34
  * @returns Pascal-cased string
35
35
  */
36
- declare function pascalCase(value: string): string;
36
+ export declare function pascalCase(value: string): string;
37
37
  /**
38
38
  * Convert a string to snake case _(this_is_snake_case)_
39
39
  *
40
40
  * @param value String to convert
41
41
  * @returns Snake-cased string
42
42
  */
43
- declare function snakeCase(value: string): string;
43
+ export declare function snakeCase(value: string): string;
44
44
  /**
45
45
  * Convert a string to title case _(Capitalizing Every Word)_
46
46
  *
47
47
  * @param value String to convert
48
48
  * @returns Title-cased string
49
49
  */
50
- declare function titleCase(value: string): string;
50
+ export declare function titleCase(value: string): string;
51
51
  /**
52
52
  * Convert a string to upper case
53
53
  *
54
54
  * @param value String to convert
55
55
  * @returns Upper-cased string
56
56
  */
57
- declare function upperCase(value: string): string;
58
- //#endregion
59
- export { camelCase, capitalize, kebabCase, lowerCase, pascalCase, snakeCase, titleCase, upperCase };
57
+ export declare function upperCase(value: string): string;
58
+ //#endregion
@@ -16,9 +16,9 @@
16
16
  * getString(() => 123) // => '123'
17
17
  * ```
18
18
  */
19
- declare function getString(value: unknown): string;
20
- declare function ignoreKey(key: string): boolean;
21
- declare function interpolate(strings: TemplateStringsArray, values: unknown[]): string;
19
+ export declare function getString(value: unknown): string;
20
+ export declare function ignoreKey(key: string): boolean;
21
+ export declare function interpolate(strings: TemplateStringsArray, values: unknown[]): string;
22
22
  /**
23
23
  * Join an array of values into a string _(while ignoring empty values)_
24
24
  *
@@ -28,15 +28,14 @@ declare function interpolate(strings: TemplateStringsArray, values: unknown[]):
28
28
  * @param delimiter Delimiter to use between values
29
29
  * @returns Joined string
30
30
  */
31
- declare function join(array: unknown[], delimiter?: string): string;
32
- declare function tryDecode(value: string): string;
33
- declare function tryEncode(value: boolean | number | string): unknown;
31
+ export declare function join(array: unknown[], delimiter?: string): string;
32
+ export declare function tryDecode(value: string): string;
33
+ export declare function tryEncode(value: boolean | number | string): unknown;
34
34
  /**
35
35
  * Split a string into words _(and other readable parts)_
36
36
  *
37
37
  * @param value Original string
38
38
  * @returns Array of words found in the string
39
39
  */
40
- declare function words(value: string): string[];
41
- //#endregion
42
- export { getString, ignoreKey, interpolate, join, tryDecode, tryEncode, words };
40
+ export declare function words(value: string): string[];
41
+ //#endregion
@@ -1,6 +1,7 @@
1
1
  import { Key } from "../models.mjs";
2
2
  //#region src/internal/subscription.d.ts
3
- type Subscription = {
3
+ export declare const SUBSCRIPTION_NAME = "subscription";
4
+ export type Subscription = {
4
5
  /**
5
6
  * Is the subscription active?
6
7
  */
@@ -13,7 +14,7 @@ type Subscription = {
13
14
  /**
14
15
  * Parameters for creating a subscription
15
16
  */
16
- type SubscriptionParameters = {
17
+ export type SubscriptionParameters = {
17
18
  /**
18
19
  * Is the owner of the subscription alive? _(defaults to `true`)_
19
20
  */
@@ -34,7 +35,7 @@ type SubscriptionParameters = {
34
35
  /**
35
36
  * Property information for subscription identification
36
37
  */
37
- type SubscriptionProperty = {
38
+ export type SubscriptionProperty = {
38
39
  /**
39
40
  * Name of the property used to identify a subscription
40
41
  */
@@ -44,7 +45,7 @@ type SubscriptionProperty = {
44
45
  */
45
46
  value: unknown;
46
47
  };
47
- type Subscriptions<Value = unknown> = {
48
+ export type Subscriptions<Value = unknown> = {
48
49
  /**
49
50
  * Items of the subscriptions store
50
51
  *
@@ -76,7 +77,7 @@ type Subscriptions<Value = unknown> = {
76
77
  /**
77
78
  * Parameters for creating a subscription store
78
79
  */
79
- type SubscriptionsParameters = {
80
+ export type SubscriptionsParameters = {
80
81
  /**
81
82
  * Allow any or specific keys for subscriptions? _(defaults to `false`, which prevents keyed subscriptions)_
82
83
  */
@@ -104,21 +105,19 @@ type SubscriptionsValuesItem<MapKey, MapValue> = {
104
105
  * @param value Value to check
105
106
  * @returns `true` if the value is a subscription, otherwise `false`
106
107
  */
107
- declare function isSubscription(value: unknown): value is Subscription;
108
+ export declare function isSubscription(value: unknown): value is Subscription;
108
109
  /**
109
110
  * Is the value a subscriptions store?
110
111
  *
111
112
  * @param value Value to check
112
113
  * @returns `true` if the value is a subscriptions store, otherwise `false`
113
114
  */
114
- declare function isSubscriptions(value: unknown): value is Subscriptions;
115
+ export declare function isSubscriptions(value: unknown): value is Subscriptions;
115
116
  /**
116
117
  * Create a subscription store
117
118
  *
118
119
  * @param parameters Store parameters
119
120
  * @returns Subscription store
120
121
  */
121
- declare function subscriptions<Value = unknown>(parameters?: SubscriptionsParameters): Subscriptions<Value>;
122
- declare const SUBSCRIPTION_NAME = "subscription";
123
- //#endregion
124
- export { SUBSCRIPTION_NAME, Subscription, SubscriptionParameters, SubscriptionProperty, Subscriptions, SubscriptionsParameters, isSubscription, isSubscriptions, subscriptions };
122
+ export declare function subscriptions<Value = unknown>(parameters?: SubscriptionsParameters): Subscriptions<Value>;
123
+ //#endregion