@oscarpalmer/atoms 0.184.2 → 0.186.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 (156) hide show
  1. package/dist/array/difference.d.mts +29 -0
  2. package/dist/array/exists.d.mts +35 -0
  3. package/dist/array/filter.d.mts +72 -2
  4. package/dist/array/find.d.mts +70 -0
  5. package/dist/array/first.d.mts +77 -2
  6. package/dist/array/flatten.d.mts +6 -0
  7. package/dist/array/flatten.mjs +6 -0
  8. package/dist/array/from.d.mts +36 -0
  9. package/dist/array/get.d.mts +21 -13
  10. package/dist/array/group-by.d.mts +142 -0
  11. package/dist/array/index.d.mts +2 -2
  12. package/dist/array/index.mjs +2 -2
  13. package/dist/array/insert.d.mts +16 -0
  14. package/dist/array/intersection.d.mts +29 -0
  15. package/dist/array/last.d.mts +75 -2
  16. package/dist/array/{position.d.mts → match.d.mts} +168 -36
  17. package/dist/array/{position.mjs → match.mjs} +16 -16
  18. package/dist/array/move.d.mts +78 -8
  19. package/dist/array/move.mjs +11 -1
  20. package/dist/array/partition.d.mts +35 -0
  21. package/dist/array/push.d.mts +8 -0
  22. package/dist/array/push.mjs +8 -0
  23. package/dist/array/reverse.d.mts +1 -0
  24. package/dist/array/reverse.mjs +1 -0
  25. package/dist/array/select.d.mts +94 -8
  26. package/dist/array/single.d.mts +29 -0
  27. package/dist/array/slice.d.mts +106 -16
  28. package/dist/array/sort.d.mts +30 -4
  29. package/dist/array/sort.mjs +1 -1
  30. package/dist/array/splice.d.mts +48 -0
  31. package/dist/array/splice.mjs +2 -1
  32. package/dist/array/swap.d.mts +113 -8
  33. package/dist/array/swap.mjs +2 -1
  34. package/dist/array/to-map.d.mts +124 -0
  35. package/dist/array/to-record.d.mts +124 -0
  36. package/dist/array/to-set.d.mts +24 -0
  37. package/dist/array/toggle.d.mts +38 -3
  38. package/dist/array/union.d.mts +29 -0
  39. package/dist/array/unique.d.mts +24 -0
  40. package/dist/array/update.d.mts +38 -3
  41. package/dist/beacon.d.mts +12 -0
  42. package/dist/beacon.mjs +9 -0
  43. package/dist/color/instance.d.mts +8 -0
  44. package/dist/color/instance.mjs +3 -0
  45. package/dist/color/models.d.mts +30 -0
  46. package/dist/function/assert.d.mts +29 -8
  47. package/dist/function/assert.mjs +29 -8
  48. package/dist/function/memoize.d.mts +3 -0
  49. package/dist/function/memoize.mjs +3 -0
  50. package/dist/function/retry.d.mts +3 -0
  51. package/dist/function/retry.mjs +3 -0
  52. package/dist/function/work.mjs +1 -1
  53. package/dist/index.d.mts +2158 -288
  54. package/dist/index.mjs +294 -181
  55. package/dist/internal/array/chunk.d.mts +6 -0
  56. package/dist/internal/array/chunk.mjs +6 -0
  57. package/dist/internal/array/compact.d.mts +12 -0
  58. package/dist/internal/array/index-of.d.mts +70 -0
  59. package/dist/internal/math/aggregate.d.mts +29 -0
  60. package/dist/internal/value/compare.d.mts +2 -1
  61. package/dist/internal/value/equal.d.mts +5 -0
  62. package/dist/internal/value/get.d.mts +27 -5
  63. package/dist/internal/value/has.d.mts +7 -7
  64. package/dist/internal/value/has.mjs +1 -1
  65. package/dist/internal/value/misc.d.mts +2 -2
  66. package/dist/internal/value/misc.mjs +10 -4
  67. package/dist/logger.d.mts +11 -0
  68. package/dist/logger.mjs +11 -0
  69. package/dist/models.d.mts +14 -1
  70. package/dist/promise/helpers.mjs +1 -1
  71. package/dist/promise/index.d.mts +0 -6
  72. package/dist/promise/models.d.mts +36 -0
  73. package/dist/promise/models.mjs +6 -0
  74. package/dist/queue.d.mts +13 -1
  75. package/dist/queue.mjs +9 -0
  76. package/dist/result/index.d.mts +0 -8
  77. package/dist/result/index.mjs +0 -8
  78. package/dist/result/match.d.mts +4 -4
  79. package/dist/result/work/flow.d.mts +12 -36
  80. package/dist/result/work/pipe.d.mts +11 -33
  81. package/dist/sized/set.d.mts +3 -2
  82. package/dist/sized/set.mjs +3 -2
  83. package/dist/value/collection.d.mts +1 -1
  84. package/dist/value/handle.mjs +1 -1
  85. package/dist/value/merge.d.mts +28 -25
  86. package/dist/value/merge.mjs +29 -18
  87. package/dist/value/shake.d.mts +3 -0
  88. package/dist/value/smush.d.mts +3 -0
  89. package/dist/value/transform.d.mts +10 -1
  90. package/dist/value/unsmush.d.mts +2 -3
  91. package/package.json +5 -5
  92. package/src/array/difference.ts +33 -0
  93. package/src/array/exists.ts +35 -0
  94. package/src/array/filter.ts +72 -2
  95. package/src/array/find.ts +70 -0
  96. package/src/array/first.ts +77 -3
  97. package/src/array/flatten.ts +6 -0
  98. package/src/array/from.ts +40 -0
  99. package/src/array/get.ts +21 -15
  100. package/src/array/group-by.ts +142 -0
  101. package/src/array/index.ts +1 -1
  102. package/src/array/insert.ts +16 -2
  103. package/src/array/intersection.ts +33 -0
  104. package/src/array/last.ts +75 -2
  105. package/src/array/{position.ts → match.ts} +197 -65
  106. package/src/array/move.ts +87 -13
  107. package/src/array/partition.ts +35 -0
  108. package/src/array/push.ts +8 -2
  109. package/src/array/reverse.ts +5 -0
  110. package/src/array/select.ts +96 -13
  111. package/src/array/single.ts +29 -0
  112. package/src/array/slice.ts +114 -24
  113. package/src/array/sort.ts +30 -4
  114. package/src/array/splice.ts +52 -4
  115. package/src/array/swap.ts +122 -13
  116. package/src/array/to-map.ts +124 -0
  117. package/src/array/to-record.ts +124 -0
  118. package/src/array/to-set.ts +24 -0
  119. package/src/array/toggle.ts +42 -3
  120. package/src/array/union.ts +33 -0
  121. package/src/array/unique.ts +24 -0
  122. package/src/array/update.ts +38 -3
  123. package/src/beacon.ts +12 -0
  124. package/src/color/index.ts +0 -3
  125. package/src/color/instance.ts +9 -1
  126. package/src/color/models.ts +30 -0
  127. package/src/function/assert.ts +66 -7
  128. package/src/function/memoize.ts +3 -0
  129. package/src/function/once.ts +5 -1
  130. package/src/function/retry.ts +3 -0
  131. package/src/internal/array/chunk.ts +6 -0
  132. package/src/internal/array/compact.ts +12 -0
  133. package/src/internal/array/index-of.ts +70 -0
  134. package/src/internal/math/aggregate.ts +29 -0
  135. package/src/internal/string.ts +0 -2
  136. package/src/internal/value/compare.ts +2 -1
  137. package/src/internal/value/equal.ts +5 -0
  138. package/src/internal/value/get.ts +27 -5
  139. package/src/internal/value/has.ts +10 -10
  140. package/src/internal/value/misc.ts +24 -13
  141. package/src/logger.ts +11 -0
  142. package/src/models.ts +18 -0
  143. package/src/promise/index.ts +0 -6
  144. package/src/promise/models.ts +36 -0
  145. package/src/queue.ts +13 -1
  146. package/src/result/index.ts +0 -8
  147. package/src/result/match.ts +4 -4
  148. package/src/result/work/flow.ts +12 -36
  149. package/src/result/work/pipe.ts +11 -33
  150. package/src/sized/set.ts +4 -3
  151. package/src/value/collection.ts +1 -1
  152. package/src/value/merge.ts +88 -66
  153. package/src/value/shake.ts +3 -0
  154. package/src/value/smush.ts +3 -0
  155. package/src/value/transform.ts +10 -1
  156. package/src/value/unsmush.ts +2 -8
package/dist/queue.d.mts CHANGED
@@ -1,6 +1,9 @@
1
1
  import { GenericAsyncCallback, GenericCallback } from "./models.mjs";
2
2
 
3
3
  //#region src/queue.d.ts
4
+ /**
5
+ * A queue that can be used to manage (a)synchronous tasks with a specific key
6
+ */
4
7
  declare class KeyedQueue<CallbackParameters extends Parameters<GenericAsyncCallback>, CallbackResult> {
5
8
  #private;
6
9
  /**
@@ -91,6 +94,9 @@ declare class KeyedQueue<CallbackParameters extends Parameters<GenericAsyncCallb
91
94
  */
92
95
  resume(key?: string): void;
93
96
  }
97
+ /**
98
+ * A queue that can be used to manage (a)synchronous tasks
99
+ */
94
100
  declare class Queue<CallbackParameters extends Parameters<GenericAsyncCallback>, CallbackResult> {
95
101
  #private;
96
102
  /**
@@ -154,6 +160,9 @@ declare class Queue<CallbackParameters extends Parameters<GenericAsyncCallback>,
154
160
  */
155
161
  resume(): void;
156
162
  }
163
+ /**
164
+ * An error thrown by the Queue when an operation fails
165
+ */
157
166
  declare class QueueError extends Error {
158
167
  constructor(message: string);
159
168
  }
@@ -171,9 +180,12 @@ type QueueOptions = {
171
180
  */
172
181
  maximum?: number;
173
182
  };
183
+ /**
184
+ * A queued item
185
+ */
174
186
  type Queued<Value> = {
175
187
  /**
176
- * ID of the queued promise _(can be used to remove it from the queue)_
188
+ * ID of the queued item _(can be used to remove it from the queue)_
177
189
  */
178
190
  readonly id: number;
179
191
  /**
package/dist/queue.mjs CHANGED
@@ -1,5 +1,8 @@
1
1
  import { getNumberOrDefault } from "./internal/number.mjs";
2
2
  //#region src/queue.ts
3
+ /**
4
+ * A queue that can be used to manage (a)synchronous tasks with a specific key
5
+ */
3
6
  var KeyedQueue = class {
4
7
  #callback;
5
8
  #options;
@@ -149,6 +152,9 @@ var KeyedQueue = class {
149
152
  for (const queue of queues) queue[type]();
150
153
  }
151
154
  };
155
+ /**
156
+ * A queue that can be used to manage (a)synchronous tasks
157
+ */
152
158
  var Queue = class {
153
159
  #callback;
154
160
  #handled = [];
@@ -326,6 +332,9 @@ var Queue = class {
326
332
  this.#runners -= 1;
327
333
  }
328
334
  };
335
+ /**
336
+ * An error thrown by the Queue when an operation fails
337
+ */
329
338
  var QueueError = class extends Error {
330
339
  constructor(message) {
331
340
  super(message);
@@ -1,8 +1,4 @@
1
1
  import { ExtendedResult, Result } from "./models.mjs";
2
- import { attemptPromise } from "../promise/index.mjs";
3
- import { matchResult } from "./match.mjs";
4
- import { attemptFlow } from "./work/flow.mjs";
5
- import { attemptPipe } from "./work/pipe.mjs";
6
2
 
7
3
  //#region src/result/index.d.ts
8
4
  /**
@@ -54,10 +50,6 @@ declare function attempt<Value, E>(callback: () => Value, error: E): ExtendedRes
54
50
  declare function attempt<Value>(callback: () => Value): Result<Value, Error>;
55
51
  declare namespace attempt {
56
52
  var async: typeof asyncAttempt;
57
- var flow: typeof attemptFlow;
58
- var match: typeof matchResult;
59
- var pipe: typeof attemptPipe;
60
- var promise: typeof attemptPromise;
61
53
  }
62
54
  //#endregion
63
55
  export { asyncAttempt, attempt };
@@ -1,8 +1,4 @@
1
1
  import { getError, ok } from "./misc.mjs";
2
- import { attemptPromise } from "../promise/index.mjs";
3
- import { matchResult } from "./match.mjs";
4
- import { attemptFlow } from "./work/flow.mjs";
5
- import { attemptPipe } from "./work/pipe.mjs";
6
2
  //#region src/result/index.ts
7
3
  async function asyncAttempt(value, err) {
8
4
  try {
@@ -21,9 +17,5 @@ function attempt(callback, err) {
21
17
  }
22
18
  }
23
19
  attempt.async = asyncAttempt;
24
- attempt.flow = attemptFlow;
25
- attempt.match = matchResult;
26
- attempt.pipe = attemptPipe;
27
- attempt.promise = attemptPromise;
28
20
  //#endregion
29
21
  export { asyncAttempt, attempt };
@@ -3,12 +3,16 @@ import { AnyResult, ResultMatch } from "./models.mjs";
3
3
  //#region src/result/match.d.ts
4
4
  /**
5
5
  * Handles a result with match callbacks
6
+ *
7
+ * Available as `asyncMatchResult` and `matchResult.async`
6
8
  * @param result Result to handle
7
9
  * @param handler Match callbacks
8
10
  */
9
11
  declare function asyncMatchResult<Value, Returned, E = Error>(result: AnyResult<Value, E> | Promise<AnyResult<Value, E>> | (() => Promise<AnyResult<Value, E>>), handler: ResultMatch<Value, Returned, E>): Promise<Returned>;
10
12
  /**
11
13
  * Handles a result with match callbacks
14
+ *
15
+ * Available as `asyncMatchResult` and `matchResult.async`
12
16
  * @param result Result to handle
13
17
  * @param ok Ok callback
14
18
  * @param error Error callback
@@ -16,16 +20,12 @@ declare function asyncMatchResult<Value, Returned, E = Error>(result: AnyResult<
16
20
  declare function asyncMatchResult<Value, Returned, E = Error>(result: AnyResult<Value, E> | Promise<AnyResult<Value, E>> | (() => Promise<AnyResult<Value, E>>), ok: ResultMatch<Value, Returned, E>['ok'], error: ResultMatch<Value, Returned, E>['error']): Promise<Returned>;
17
21
  /**
18
22
  * Handles a result with match callbacks
19
- *
20
- * Available as `matchResult` and `attempt.match`
21
23
  * @param result Result to handle
22
24
  * @param handler Match callbacks
23
25
  */
24
26
  declare function matchResult<Value, Returned, E = Error>(result: AnyResult<Value, E> | (() => AnyResult<Value, E>), handler: ResultMatch<Value, Returned, E>): Returned;
25
27
  /**
26
28
  * Handles a result with match callbacks
27
- *
28
- * Available as `matchResult` and `attempt.match`
29
29
  * @param result Result to handle
30
30
  * @param ok Ok callback
31
31
  * @param error Error callback
@@ -13,168 +13,144 @@ type AttemptFlowPromise<Callback extends GenericCallback, Value> = (...args: Par
13
13
  /**
14
14
  * Create an asynchronous Flow, a function that attempts to pipe a value through a series of functions
15
15
  *
16
- * Available as `attemptAsyncFlow` and `attempt.flow.async`
16
+ * Available as `attemptAsyncFlow` and `attemptFlow.async`
17
17
  * @returns Flow function
18
18
  */
19
19
  declare function attemptAsyncFlow<Fn extends GenericCallback>(fn: Fn): AttemptFlowPromise<Fn, ReturnType<Fn>>;
20
20
  /**
21
21
  * Create an asynchronous Flow, a function that pipes values through a series of functions
22
22
  *
23
- * Available as `attemptAsyncFlow` and `attempt.flow.async`
23
+ * Available as `attemptAsyncFlow` and `attemptFlow.async`
24
24
  * @returns Flow function
25
25
  */
26
26
  declare function attemptAsyncFlow<First extends GenericCallback, Second>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second): AttemptFlowPromise<First, Second>;
27
27
  /**
28
28
  * Create an asynchronous Flow, a function that pipes values through a series of functions
29
29
  *
30
- * Available as `attemptAsyncFlow` and `attempt.flow.async`
30
+ * Available as `attemptAsyncFlow` and `attemptFlow.async`
31
31
  * @returns Flow function
32
32
  */
33
33
  declare function attemptAsyncFlow<First extends GenericCallback, Second, Third>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third): AttemptFlowPromise<First, Third>;
34
34
  /**
35
35
  * Create an asynchronous Flow, a function that pipes values through a series of functions
36
36
  *
37
- * Available as `attemptAsyncFlow` and `attempt.flow.async`
37
+ * Available as `attemptAsyncFlow` and `attemptFlow.async`
38
38
  * @returns Flow function
39
39
  */
40
40
  declare function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third, fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth): AttemptFlowPromise<First, Fourth>;
41
41
  /**
42
42
  * Create an asynchronous Flow, a function that pipes values through a series of functions
43
43
  *
44
- * Available as `attemptAsyncFlow` and `attempt.flow.async`
44
+ * Available as `attemptAsyncFlow` and `attemptFlow.async`
45
45
  * @returns Flow function
46
46
  */
47
47
  declare function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third, fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth, fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth): AttemptFlowPromise<First, Fifth>;
48
48
  /**
49
49
  * Create an asynchronous Flow, a function that pipes values through a series of functions
50
50
  *
51
- * Available as `attemptAsyncFlow` and `attempt.flow.async`
51
+ * Available as `attemptAsyncFlow` and `attemptFlow.async`
52
52
  * @returns Flow function
53
53
  */
54
54
  declare function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third, fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth, fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth, sixth: (value: Awaited<UnwrapValue<Fifth>>) => Sixth): AttemptFlowPromise<First, Sixth>;
55
55
  /**
56
56
  * Create an asynchronous Flow, a function that pipes values through a series of functions
57
57
  *
58
- * Available as `attemptAsyncFlow` and `attempt.flow.async`
58
+ * Available as `attemptAsyncFlow` and `attemptFlow.async`
59
59
  * @returns Flow function
60
60
  */
61
61
  declare function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third, fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth, fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth, sixth: (value: Awaited<UnwrapValue<Fifth>>) => Sixth, seventh: (value: Awaited<UnwrapValue<Sixth>>) => Seventh): AttemptFlowPromise<First, Seventh>;
62
62
  /**
63
63
  * Create an asynchronous Flow, a function that pipes values through a series of functions
64
64
  *
65
- * Available as `attemptAsyncFlow` and `attempt.flow.async`
65
+ * Available as `attemptAsyncFlow` and `attemptFlow.async`
66
66
  * @returns Flow function
67
67
  */
68
68
  declare function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third, fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth, fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth, sixth: (value: Awaited<UnwrapValue<Fifth>>) => Sixth, seventh: (value: Awaited<UnwrapValue<Sixth>>) => Seventh, eighth: (value: Awaited<UnwrapValue<Seventh>>) => Eighth): AttemptFlowPromise<First, Eighth>;
69
69
  /**
70
70
  * Create an asynchronous Flow, a function that pipes values through a series of functions
71
71
  *
72
- * Available as `attemptAsyncFlow` and `attempt.flow.async`
72
+ * Available as `attemptAsyncFlow` and `attemptFlow.async`
73
73
  * @returns Flow function
74
74
  */
75
75
  declare function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third, fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth, fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth, sixth: (value: Awaited<UnwrapValue<Fifth>>) => Sixth, seventh: (value: Awaited<UnwrapValue<Sixth>>) => Seventh, eighth: (value: Awaited<UnwrapValue<Seventh>>) => Eighth, ninth: (value: Awaited<UnwrapValue<Eighth>>) => Ninth): AttemptFlowPromise<First, Ninth>;
76
76
  /**
77
77
  * Create an asynchronous Flow, a function that pipes values through a series of functions
78
78
  *
79
- * Available as `attemptAsyncFlow` and `attempt.flow.async`
79
+ * Available as `attemptAsyncFlow` and `attemptFlow.async`
80
80
  * @returns Flow function
81
81
  */
82
82
  declare function attemptAsyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth>(first: First, second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second, third: (value: Awaited<UnwrapValue<Second>>) => Third, fourth: (value: Awaited<UnwrapValue<Third>>) => Fourth, fifth: (value: Awaited<UnwrapValue<Fourth>>) => Fifth, sixth: (value: Awaited<UnwrapValue<Fifth>>) => Sixth, seventh: (value: Awaited<UnwrapValue<Sixth>>) => Seventh, eighth: (value: Awaited<UnwrapValue<Seventh>>) => Eighth, ninth: (value: Awaited<UnwrapValue<Eighth>>) => Ninth, tenth: (value: Awaited<UnwrapValue<Ninth>>) => Tenth): AttemptFlowPromise<First, Tenth>;
83
83
  /**
84
84
  * Create an asynchronous Flow, a function that pipes values through a series of functions
85
85
  *
86
- * Available as `attemptAsyncFlow` and `attempt.flow.async`
86
+ * Available as `attemptAsyncFlow` and `attemptFlow.async`
87
87
  * @returns Flow function
88
88
  */
89
89
  declare function attemptAsyncFlow<Fn extends GenericCallback>(fn: Fn, ...fns: Array<(value: Awaited<UnwrapValue<ReturnType<Fn>>>) => unknown>): AttemptFlowPromise<Fn, ReturnType<Fn>>;
90
90
  /**
91
91
  * Create an asynchronous Flow, a function that pipes values through a series of functions
92
92
  *
93
- * Available as `attemptAsyncFlow` and `attempt.flow.async`
93
+ * Available as `attemptAsyncFlow` and `attemptFlow.async`
94
94
  * @returns Flow function
95
95
  */
96
96
  declare function attemptAsyncFlow(...fns: GenericCallback[]): (...args: unknown[]) => Promise<Result<unknown>>;
97
97
  /**
98
98
  * Create a Flow, a function that attempts to pipe values through a function
99
- *
100
- * Available as `attemptFlow` and `attempt.flow`
101
99
  * @returns Flow function
102
100
  */
103
101
  declare function attemptFlow<Fn extends GenericCallback>(fn: Fn): AttemptFlow<Fn, ReturnType<Fn>>;
104
102
  /**
105
103
  * Create a Flow, a function that attempts to pipe values through a series of functions
106
- *
107
- * Available as `attemptFlow` and `attempt.flow`
108
104
  * @returns Flow function
109
105
  */
110
106
  declare function attemptFlow<First extends GenericCallback, Second>(first: First, second: (value: UnwrapValue<ReturnType<First>>) => Second): AttemptFlow<First, Second>;
111
107
  /**
112
108
  * Create a Flow, a function that attempts to pipe values through a series of functions
113
- *
114
- * Available as `attemptFlow` and `attempt.flow`
115
109
  * @returns Flow function
116
110
  */
117
111
  declare function attemptFlow<First extends GenericCallback, Second, Third>(first: First, second: (value: UnwrapValue<ReturnType<First>>) => Second, third: (value: UnwrapValue<Second>) => Third): AttemptFlow<First, Third>;
118
112
  /**
119
113
  * Create a Flow, a function that attempts to pipe values through a series of functions
120
- *
121
- * Available as `attemptFlow` and `attempt.flow`
122
114
  * @returns Flow function
123
115
  */
124
116
  declare function attemptFlow<First extends GenericCallback, Second, Third, Fourth>(first: First, second: (value: UnwrapValue<ReturnType<First>>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth): AttemptFlow<First, Fourth>;
125
117
  /**
126
118
  * Create a Flow, a function that attempts to pipe values through a series of functions
127
- *
128
- * Available as `attemptFlow` and `attempt.flow`
129
119
  * @returns Flow function
130
120
  */
131
121
  declare function attemptFlow<First extends GenericCallback, Second, Third, Fourth, Fifth>(first: First, second: (value: UnwrapValue<ReturnType<First>>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth): AttemptFlow<First, Fifth>;
132
122
  /**
133
123
  * Create a Flow, a function that attempts to pipe values through a series of functions
134
- *
135
- * Available as `attemptFlow` and `attempt.flow`
136
124
  * @returns Flow function
137
125
  */
138
126
  declare function attemptFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth>(first: First, second: (value: UnwrapValue<ReturnType<First>>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth): AttemptFlow<First, Sixth>;
139
127
  /**
140
128
  * Create a Flow, a function that attempts to pipe values through a series of functions
141
- *
142
- * Available as `attemptFlow` and `attempt.flow`
143
129
  * @returns Flow function
144
130
  */
145
131
  declare function attemptFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh>(first: First, second: (value: UnwrapValue<ReturnType<First>>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh): AttemptFlow<First, Seventh>;
146
132
  /**
147
133
  * Create a Flow, a function that attempts to pipe values through a series of functions
148
- *
149
- * Available as `attemptFlow` and `attempt.flow`
150
134
  * @returns Flow function
151
135
  */
152
136
  declare function attemptFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth>(first: First, second: (value: UnwrapValue<ReturnType<First>>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth): AttemptFlow<First, Eighth>;
153
137
  /**
154
138
  * Create a Flow, a function that attempts to pipe values through a series of functions
155
- *
156
- * Available as `attemptFlow` and `attempt.flow`
157
139
  * @returns Flow function
158
140
  */
159
141
  declare function attemptFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth>(first: First, second: (value: UnwrapValue<ReturnType<First>>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth, ninth: (value: UnwrapValue<Eighth>) => Ninth): AttemptFlow<First, Ninth>;
160
142
  /**
161
143
  * Create a Flow, a function that attempts to pipe values through a series of functions
162
- *
163
- * Available as `attemptFlow` and `attempt.flow`
164
144
  * @returns Flow function
165
145
  */
166
146
  declare function attemptFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth>(first: First, second: (value: UnwrapValue<ReturnType<First>>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth, ninth: (value: UnwrapValue<Eighth>) => Ninth, tenth: (value: UnwrapValue<Ninth>) => Tenth): AttemptFlow<First, Tenth>;
167
147
  /**
168
148
  * Create a Flow, a function that attempts to pipe values through a series of functions
169
- *
170
- * Available as `attemptFlow` and `attempt.flow`
171
149
  * @returns Flow function
172
150
  */
173
151
  declare function attemptFlow<First extends GenericCallback>(first: First, ...fns: Array<(value: UnwrapValue<ReturnType<First>>) => unknown>): AttemptFlow<First, ReturnType<First>>;
174
152
  /**
175
153
  * Create a Flow, a function that attempts to pipe values through a series of functions
176
- *
177
- * Available as `attemptFlow` and `attempt.flow`
178
154
  * @returns Flow function
179
155
  */
180
156
  declare function attemptFlow(...fns: GenericCallback[]): (...args: unknown[]) => Result<unknown>;
@@ -6,7 +6,7 @@ type WrapValue<Value> = Result<UnwrapValue<Value>>;
6
6
  /**
7
7
  * Attempt to pipe a value through a function
8
8
  *
9
- * Available as `attemptAsyncPipe` and `attempt.pipe.async`
9
+ * Available as `attemptAsyncPipe` and `attemptPipe.async`
10
10
  * @param initial Initial value
11
11
  * @returns Piped result
12
12
  */
@@ -14,7 +14,7 @@ declare function attemptAsyncPipe<Initial, Piped>(initial: GenericCallback | Ini
14
14
  /**
15
15
  * Attempt to pipe a value through a series of functions
16
16
  *
17
- * Available as `attemptAsyncPipe` and `attempt.pipe.async`
17
+ * Available as `attemptAsyncPipe` and `attemptPipe.async`
18
18
  * @param initial Initial value
19
19
  * @returns Piped result
20
20
  */
@@ -22,7 +22,7 @@ declare function attemptAsyncPipe<Initial, First, Second>(initial: GenericCallba
22
22
  /**
23
23
  * Attempt to pipe a value through a series of functions
24
24
  *
25
- * Available as `attemptAsyncPipe` and `attempt.pipe.async`
25
+ * Available as `attemptAsyncPipe` and `attemptPipe.async`
26
26
  * @param initial Initial value
27
27
  * @returns Piped result
28
28
  */
@@ -30,7 +30,7 @@ declare function attemptAsyncPipe<Initial, First, Second, Third>(initial: Generi
30
30
  /**
31
31
  * Attempt to pipe a value through a series of functions
32
32
  *
33
- * Available as `attemptAsyncPipe` and `attempt.pipe.async`
33
+ * Available as `attemptAsyncPipe` and `attemptPipe.async`
34
34
  * @param initial Initial value
35
35
  * @returns Piped result
36
36
  */
@@ -38,7 +38,7 @@ declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth>(initial
38
38
  /**
39
39
  * Attempt to pipe a value through a series of functions
40
40
  *
41
- * Available as `attemptAsyncPipe` and `attempt.pipe.async`
41
+ * Available as `attemptAsyncPipe` and `attemptPipe.async`
42
42
  * @param initial Initial value
43
43
  * @returns Piped result
44
44
  */
@@ -46,7 +46,7 @@ declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth>(
46
46
  /**
47
47
  * Attempt to pipe a value through a series of functions
48
48
  *
49
- * Available as `attemptAsyncPipe` and `attempt.pipe.async`
49
+ * Available as `attemptAsyncPipe` and `attemptPipe.async`
50
50
  * @param initial Initial value
51
51
  * @returns Piped result
52
52
  */
@@ -54,7 +54,7 @@ declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth,
54
54
  /**
55
55
  * Attempt to pipe a value through a series of functions
56
56
  *
57
- * Available as `attemptAsyncPipe` and `attempt.pipe.async`
57
+ * Available as `attemptAsyncPipe` and `attemptPipe.async`
58
58
  * @param initial Initial value
59
59
  * @returns Piped result
60
60
  */
@@ -62,7 +62,7 @@ declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth,
62
62
  /**
63
63
  * Attempt to pipe a value through a series of functions
64
64
  *
65
- * Available as `attemptAsyncPipe` and `attempt.pipe.async`
65
+ * Available as `attemptAsyncPipe` and `attemptPipe.async`
66
66
  * @param initial Initial value
67
67
  * @returns Piped result
68
68
  */
@@ -70,7 +70,7 @@ declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth,
70
70
  /**
71
71
  * Attempt to pipe a value through a series of functions
72
72
  *
73
- * Available as `attemptAsyncPipe` and `attempt.pipe.async`
73
+ * Available as `attemptAsyncPipe` and `attemptPipe.async`
74
74
  * @param initial Initial value
75
75
  * @returns Piped result
76
76
  */
@@ -78,7 +78,7 @@ declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth,
78
78
  /**
79
79
  * Attempt to pipe a value through a series of functions
80
80
  *
81
- * Available as `attemptAsyncPipe` and `attempt.pipe.async`
81
+ * Available as `attemptAsyncPipe` and `attemptPipe.async`
82
82
  * @param initial Initial value
83
83
  * @returns Piped result
84
84
  */
@@ -86,95 +86,73 @@ declare function attemptAsyncPipe<Initial, First, Second, Third, Fourth, Fifth,
86
86
  /**
87
87
  * Attempt to pipe a result through a series of functions
88
88
  *
89
- * Available as `attemptAsyncPipe` and `attempt.pipe.async`
89
+ * Available as `attemptAsyncPipe` and `attemptPipe.async`
90
90
  * @param initial Initial result
91
91
  * @returns Piped result
92
92
  */
93
93
  declare function attemptAsyncPipe<Initial>(initial: GenericCallback | Initial | Promise<Initial> | Result<Initial>, first?: (value: UnwrapValue<Initial>) => unknown, ...seconds: Array<(value: unknown) => unknown>): Promise<WrapValue<Initial>>;
94
94
  /**
95
95
  * Attempt to pipe a value through a function
96
- *
97
- * Available as `attemptPipe` and `attempt.pipe`
98
96
  * @param initial Initial value
99
97
  * @returns Piped result
100
98
  */
101
99
  declare function attemptPipe<Initial, Pipe>(initial: GenericCallback | Initial | Result<Initial>, pipe: (value: UnwrapValue<Initial>) => Pipe): WrapValue<Pipe>;
102
100
  /**
103
101
  * Attempt to pipe a value through a series of functions
104
- *
105
- * Available as `attemptPipe` and `attempt.pipe`
106
102
  * @param initial Initial value
107
103
  * @returns Piped result
108
104
  */
109
105
  declare function attemptPipe<Initial, First, Second>(initial: GenericCallback | Initial | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second): WrapValue<Second>;
110
106
  /**
111
107
  * Attempt to pipe a value through a series of functions
112
- *
113
- * Available as `attemptPipe` and `attempt.pipe`
114
108
  * @param initial Initial value
115
109
  * @returns Piped result
116
110
  */
117
111
  declare function attemptPipe<Initial, First, Second, Third>(initial: GenericCallback | Initial | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third): WrapValue<Third>;
118
112
  /**
119
113
  * Attempt to pipe a value through a series of functions
120
- *
121
- * Available as `attemptPipe` and `attempt.pipe`
122
114
  * @param initial Initial value
123
115
  * @returns Piped result
124
116
  */
125
117
  declare function attemptPipe<Initial, First, Second, Third, Fourth>(initial: GenericCallback | Initial | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth): WrapValue<Fourth>;
126
118
  /**
127
119
  * Attempt to pipe a value through a series of functions
128
- *
129
- * Available as `attemptPipe` and `attempt.pipe`
130
120
  * @param initial Initial value
131
121
  * @returns Piped result
132
122
  */
133
123
  declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth>(initial: GenericCallback | Initial | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth): WrapValue<Fifth>;
134
124
  /**
135
125
  * Attempt to pipe a value through a series of functions
136
- *
137
- * Available as `attemptPipe` and `attempt.pipe`
138
126
  * @param initial Initial value
139
127
  * @returns Piped result
140
128
  */
141
129
  declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth>(initial: GenericCallback | Initial | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth): WrapValue<Sixth>;
142
130
  /**
143
131
  * Attempt to pipe a value through a series of functions
144
- *
145
- * Available as `attemptPipe` and `attempt.pipe`
146
132
  * @param initial Initial value
147
133
  * @returns Piped result
148
134
  */
149
135
  declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh>(initial: GenericCallback | Initial | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh): WrapValue<Seventh>;
150
136
  /**
151
137
  * Attempt to pipe a value through a series of functions
152
- *
153
- * Available as `attemptPipe` and `attempt.pipe`
154
138
  * @param initial Initial value
155
139
  * @returns Piped result
156
140
  */
157
141
  declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth>(initial: GenericCallback | Initial | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth): WrapValue<Eighth>;
158
142
  /**
159
143
  * Attempt to pipe a value through a series of functions
160
- *
161
- * Available as `attemptPipe` and `attempt.pipe`
162
144
  * @param initial Initial value
163
145
  * @returns Piped result
164
146
  */
165
147
  declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth>(initial: GenericCallback | Initial | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth, ninth: (value: UnwrapValue<Eighth>) => Ninth): WrapValue<Ninth>;
166
148
  /**
167
149
  * Attempt to pipe a value through a series of functions
168
- *
169
- * Available as `attemptPipe` and `attempt.pipe`
170
150
  * @param initial Initial value
171
151
  * @returns Piped result
172
152
  */
173
153
  declare function attemptPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth, Ninth, Tenth>(initial: GenericCallback | Initial | Result<Initial>, first: (value: UnwrapValue<Initial>) => First, second: (value: UnwrapValue<First>) => Second, third: (value: UnwrapValue<Second>) => Third, fourth: (value: UnwrapValue<Third>) => Fourth, fifth: (value: UnwrapValue<Fourth>) => Fifth, sixth: (value: UnwrapValue<Fifth>) => Sixth, seventh: (value: UnwrapValue<Sixth>) => Seventh, eighth: (value: UnwrapValue<Seventh>) => Eighth, ninth: (value: UnwrapValue<Eighth>) => Ninth, tenth: (value: UnwrapValue<Ninth>) => Tenth): WrapValue<Tenth>;
174
154
  /**
175
155
  * Attempt to pipe a result through a series of functions
176
- *
177
- * Available as `attemptPipe` and `attempt.pipe`
178
156
  * @param initial Initial result
179
157
  * @returns Piped result
180
158
  */
@@ -1,7 +1,8 @@
1
1
  //#region src/sized/set.d.ts
2
2
  /**
3
- * - A Set with a maximum size
4
- * - Behavior is similar to a _LRU_-cache, where the oldest values are removed
3
+ * A Set with a maximum size
4
+ *
5
+ * Behavior is similar to a _LRU_-cache, where the oldest values are removed
5
6
  */
6
7
  declare class SizedSet<Value = unknown> extends Set<Value> {
7
8
  #private;
@@ -1,8 +1,9 @@
1
1
  import { getSizedMaximum } from "../internal/sized.mjs";
2
2
  //#region src/sized/set.ts
3
3
  /**
4
- * - A Set with a maximum size
5
- * - Behavior is similar to a _LRU_-cache, where the oldest values are removed
4
+ * A Set with a maximum size
5
+ *
6
+ * Behavior is similar to a _LRU_-cache, where the oldest values are removed
6
7
  */
7
8
  var SizedSet = class extends Set {
8
9
  /**
@@ -11,7 +11,7 @@ declare function inMap<Value>(map: Map<unknown, Value>, value: Value): boolean;
11
11
  * @param map Map to check in
12
12
  * @param value Value to check for
13
13
  * @param key To return the key for the value
14
- * @return The key for the value if it exists, otherwise `undefined`
14
+ * @returns The key for the value if it exists, otherwise `undefined`
15
15
  */
16
16
  declare function inMap<Key, Value>(map: Map<Key, Value>, value: Value, key: true): Key;
17
17
  /**
@@ -1,4 +1,4 @@
1
- import { getValue } from "../internal/value/get.mjs";
2
1
  import { hasValue } from "../internal/value/has.mjs";
2
+ import { getValue } from "../internal/value/get.mjs";
3
3
  import { setValue } from "../internal/value/set.mjs";
4
4
  export { getValue, hasValue, setValue };