@oscarpalmer/atoms 0.179.0 → 0.180.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 (100) hide show
  1. package/dist/array/filter.d.mts +36 -28
  2. package/dist/array/filter.mjs +5 -5
  3. package/dist/array/first.d.mts +13 -5
  4. package/dist/array/first.mjs +1 -1
  5. package/dist/array/group-by.d.mts +13 -1
  6. package/dist/array/group-by.mjs +1 -1
  7. package/dist/array/last.d.mts +9 -1
  8. package/dist/array/last.mjs +1 -1
  9. package/dist/array/move.d.mts +9 -1
  10. package/dist/array/move.mjs +3 -1
  11. package/dist/array/reverse.d.mts +5 -0
  12. package/dist/array/reverse.mjs +5 -0
  13. package/dist/array/select.d.mts +2 -2
  14. package/dist/array/sort.d.mts +23 -9
  15. package/dist/array/sort.mjs +22 -22
  16. package/dist/array/swap.d.mts +2 -0
  17. package/dist/array/swap.mjs +2 -0
  18. package/dist/array/to-map.d.mts +13 -1
  19. package/dist/array/to-map.mjs +1 -1
  20. package/dist/array/to-record.d.mts +13 -1
  21. package/dist/array/to-record.mjs +1 -1
  22. package/dist/function/assert.d.mts +9 -1
  23. package/dist/function/assert.mjs +9 -1
  24. package/dist/function/limit.d.mts +5 -1
  25. package/dist/function/limit.mjs +5 -1
  26. package/dist/function/once.d.mts +3 -1
  27. package/dist/function/once.mjs +3 -1
  28. package/dist/function/retry.d.mts +4 -0
  29. package/dist/function/retry.mjs +2 -0
  30. package/dist/function/work.d.mts +49 -1
  31. package/dist/function/work.mjs +1 -1
  32. package/dist/index.d.mts +415 -242
  33. package/dist/index.mjs +224 -167
  34. package/dist/internal/array/index-of.mjs +1 -1
  35. package/dist/internal/function/timer.mjs +3 -1
  36. package/dist/internal/value/compare.d.mts +13 -9
  37. package/dist/internal/value/compare.mjs +13 -9
  38. package/dist/internal/value/equal.d.mts +29 -15
  39. package/dist/internal/value/equal.mjs +41 -35
  40. package/dist/internal/value/handlers.d.mts +4 -4
  41. package/dist/internal/value/handlers.mjs +19 -11
  42. package/dist/internal/value/has.d.mts +9 -8
  43. package/dist/internal/value/has.mjs +3 -3
  44. package/dist/internal/value/misc.d.mts +4 -8
  45. package/dist/internal/value/misc.mjs +6 -17
  46. package/dist/promise/index.d.mts +11 -1
  47. package/dist/promise/index.mjs +1 -1
  48. package/dist/result/index.d.mts +9 -1
  49. package/dist/result/index.mjs +1 -1
  50. package/dist/result/match.d.mts +5 -1
  51. package/dist/result/match.mjs +1 -1
  52. package/dist/result/misc.d.mts +3 -3
  53. package/dist/result/work/flow.d.mts +49 -1
  54. package/dist/result/work/flow.mjs +1 -1
  55. package/dist/result/work/pipe.d.mts +67 -155
  56. package/dist/result/work/pipe.mjs +3 -3
  57. package/dist/string/fuzzy.d.mts +11 -1
  58. package/dist/string/fuzzy.mjs +22 -6
  59. package/dist/string/template.d.mts +3 -1
  60. package/dist/string/template.mjs +3 -1
  61. package/dist/value/clone.d.mts +13 -9
  62. package/dist/value/clone.mjs +21 -17
  63. package/dist/value/merge.d.mts +9 -7
  64. package/dist/value/merge.mjs +7 -5
  65. package/package.json +3 -3
  66. package/plugin/helpers.js +2 -2
  67. package/src/array/filter.ts +44 -36
  68. package/src/array/first.ts +18 -9
  69. package/src/array/group-by.ts +22 -10
  70. package/src/array/last.ts +17 -5
  71. package/src/array/move.ts +18 -5
  72. package/src/array/reverse.ts +5 -0
  73. package/src/array/select.ts +2 -2
  74. package/src/array/sort.ts +110 -86
  75. package/src/array/swap.ts +2 -0
  76. package/src/array/to-map.ts +22 -10
  77. package/src/array/to-record.ts +22 -10
  78. package/src/function/assert.ts +12 -4
  79. package/src/function/limit.ts +6 -2
  80. package/src/function/once.ts +3 -1
  81. package/src/function/retry.ts +8 -2
  82. package/src/function/work.ts +92 -26
  83. package/src/internal/array/index-of.ts +1 -1
  84. package/src/internal/function/timer.ts +4 -2
  85. package/src/internal/string.ts +2 -0
  86. package/src/internal/value/compare.ts +14 -11
  87. package/src/internal/value/equal.ts +79 -67
  88. package/src/internal/value/handlers.ts +19 -11
  89. package/src/internal/value/has.ts +16 -16
  90. package/src/internal/value/misc.ts +10 -8
  91. package/src/promise/index.ts +14 -4
  92. package/src/result/index.ts +15 -5
  93. package/src/result/match.ts +7 -3
  94. package/src/result/misc.ts +3 -3
  95. package/src/result/work/flow.ts +68 -13
  96. package/src/result/work/pipe.ts +97 -392
  97. package/src/string/fuzzy.ts +34 -8
  98. package/src/string/template.ts +3 -1
  99. package/src/value/clone.ts +25 -22
  100. package/src/value/merge.ts +14 -12
@@ -31,12 +31,14 @@ assert.is = assertIs;
31
31
 
32
32
  /**
33
33
  * Creates an asserter that asserts a condition is true, throwing an error if it is not
34
+ *
35
+ * Available as `assertCondition` and `assert.condition`
34
36
  * @param condition Condition to assert
35
37
  * @param message Error message
36
38
  * @param error Error constructor
37
39
  * @returns Asserter
38
40
  */
39
- function assertCondition<Value>(
41
+ export function assertCondition<Value>(
40
42
  condition: (value: unknown) => boolean,
41
43
  message: string,
42
44
  error?: ErrorConstructor,
@@ -48,10 +50,12 @@ function assertCondition<Value>(
48
50
 
49
51
  /**
50
52
  * Asserts that a value is defined throwing an error if it is not
53
+ *
54
+ * Available as `assertDefined` and `assert.defined`
51
55
  * @param value Value to assert
52
56
  * @param message Error message
53
57
  */
54
- function assertDefined<Value>(
58
+ export function assertDefined<Value>(
55
59
  value: unknown,
56
60
  message?: string,
57
61
  ): asserts value is Exclude<Value, null | undefined> {
@@ -60,12 +64,14 @@ function assertDefined<Value>(
60
64
 
61
65
  /**
62
66
  * Creates an asserter that asserts a value is an instance of a constructor, throwing an error if it is not
67
+ *
68
+ * Available as `assertInstanceOf` and `assert.instanceOf`
63
69
  * @param constructor Constructor to check against
64
70
  * @param message Error message
65
71
  * @param error Error constructor
66
72
  * @returns Asserter
67
73
  */
68
- function assertInstanceOf<Value>(
74
+ export function assertInstanceOf<Value>(
69
75
  constructor: Constructor<Value>,
70
76
  message: string,
71
77
  error?: ErrorConstructor,
@@ -77,12 +83,14 @@ function assertInstanceOf<Value>(
77
83
 
78
84
  /**
79
85
  * Creates an asserter that asserts a value is of a specific type, throwing an error if it is not
86
+ *
87
+ * Available as `assertIs` and `assert.is`
80
88
  * @param condition Type guard function to check the value
81
89
  * @param message Error message
82
90
  * @param error Error constructor
83
91
  * @returns Asserter
84
92
  */
85
- function assertIs<Value>(
93
+ export function assertIs<Value>(
86
94
  condition: (value: unknown) => value is Value,
87
95
  message: string,
88
96
  error?: ErrorConstructor,
@@ -14,11 +14,13 @@ import type {
14
14
  * When called, successful _(finished)_ results will resolve and errors will reject.
15
15
  *
16
16
  * On subsequent calls, existing calls will be canceled _(rejected)_, the timer reset, and will wait another `time` milliseconds before the new call is made _(and so on...)_
17
+ *
18
+ * Available as `asyncDebounce` and `debounce.async`
17
19
  * @param callback Callback to debounce
18
20
  * @param time Time in milliseconds to wait before calling the callback _(defaults to `0`; e.g., as soon as possible)_
19
21
  * @returns Debounced callback handler with a `cancel` method
20
22
  */
21
- function asyncDebounce<Callback extends GenericAsyncCallback | GenericCallback>(
23
+ export function asyncDebounce<Callback extends GenericAsyncCallback | GenericCallback>(
22
24
  callback: Callback,
23
25
  time?: number,
24
26
  ): AsyncCancelableCallback<Callback> {
@@ -31,11 +33,13 @@ function asyncDebounce<Callback extends GenericAsyncCallback | GenericCallback>(
31
33
  * When called, successful _(finished)_ results will resolve and errors will reject.
32
34
  *
33
35
  * On subsequent calls, existing calls will be canceled _(rejected)_ and will wait until the next valid time to call the callback again _(and so on...)_
36
+ *
37
+ * Available as `asyncThrottle` and `throttle.async`
34
38
  * @param callback Callback to throttle
35
39
  * @param time Time in milliseconds to wait before calling the callback again _(defaults to `0`; e.g., as soon as possible)_
36
40
  * @returns Throttled callback handler with a `cancel` method
37
41
  */
38
- function asyncThrottle<Callback extends GenericAsyncCallback | GenericCallback>(
42
+ export function asyncThrottle<Callback extends GenericAsyncCallback | GenericCallback>(
39
43
  callback: Callback,
40
44
  time?: number,
41
45
  ): AsyncCancelableCallback<Callback> {
@@ -31,10 +31,12 @@ type OnceState<Value> = {
31
31
 
32
32
  /**
33
33
  * Create an asynchronous function that can only be called once, rejecting or resolving the same result on subsequent calls
34
+ *
35
+ * Available as `asyncOnce` and `once.async`
34
36
  * @param callback Callback to use once
35
37
  * @returns Once callback
36
38
  */
37
- function asyncOnce<Callback extends GenericAsyncCallback>(
39
+ export function asyncOnce<Callback extends GenericAsyncCallback>(
38
40
  callback: Callback,
39
41
  ): OnceAsyncCallback<Callback> {
40
42
  assert(() => typeof callback === 'function', MESSAGE_EXPECTATION);
@@ -27,6 +27,8 @@ export type RetryOptions = {
27
27
 
28
28
  /**
29
29
  * Retry a callback a specified number of times, with a delay between attempts
30
+ *
31
+ * Available as `asyncRetry` and `retry.async`
30
32
  * @param callback Callback to retry
31
33
  * @param options Retry options
32
34
  * @returns Callback result
@@ -38,6 +40,8 @@ async function asyncRetry<Callback extends GenericAsyncCallback>(
38
40
 
39
41
  /**
40
42
  * Retry a callback a specified number of times, with a delay between attempts
43
+ *
44
+ * Available as `asyncRetry` and `retry.async`
41
45
  * @param callback Callback to retry
42
46
  * @param options Retry options
43
47
  * @returns Callback result
@@ -49,6 +53,8 @@ async function asyncRetry<Callback extends GenericCallback>(
49
53
 
50
54
  /**
51
55
  * Retry a callback a specified number of times, with a delay between attempts
56
+ *
57
+ * Available as `asyncRetry` and `retry.async`
52
58
  * @param callback Callback to retry
53
59
  * @param options Retry options
54
60
  * @returns Callback result
@@ -72,7 +78,7 @@ async function asyncRetry<Callback extends GenericCallback>(
72
78
  } else {
73
79
  attempts += 1;
74
80
 
75
- timer();
81
+ void timer();
76
82
  }
77
83
  }
78
84
  }
@@ -90,7 +96,7 @@ async function asyncRetry<Callback extends GenericCallback>(
90
96
  rejector = reject;
91
97
  resolver = resolve;
92
98
 
93
- handle();
99
+ void handle();
94
100
  });
95
101
  }
96
102
 
@@ -29,24 +29,30 @@ export type FlowPromise<Callback extends GenericCallback, Value> = (
29
29
 
30
30
  /**
31
31
  * Create an asynchronous Flow, a function that pipes values through a function
32
+ *
33
+ * Available as `asyncFlow` and `flow.async`
32
34
  * @returns Flow function
33
35
  */
34
- function asyncFlow<Fn extends GenericCallback>(fn: Fn): FlowPromise<Fn, ReturnType<Fn>>;
36
+ export function asyncFlow<Fn extends GenericCallback>(fn: Fn): FlowPromise<Fn, ReturnType<Fn>>;
35
37
 
36
38
  /**
37
39
  * Create an asynchronous Flow, a function that pipes values through a series of functions
40
+ *
41
+ * Available as `asyncFlow` and `flow.async`
38
42
  * @returns Flow function
39
43
  */
40
- function asyncFlow<First extends GenericCallback, Second>(
44
+ export function asyncFlow<First extends GenericCallback, Second>(
41
45
  first: First,
42
46
  second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second,
43
47
  ): FlowPromise<First, Second>;
44
48
 
45
49
  /**
46
50
  * Create an asynchronous Flow, a function that pipes values through a series of functions
51
+ *
52
+ * Available as `asyncFlow` and `flow.async`
47
53
  * @returns Flow function
48
54
  */
49
- function asyncFlow<First extends GenericCallback, Second, Third>(
55
+ export function asyncFlow<First extends GenericCallback, Second, Third>(
50
56
  first: First,
51
57
  second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second,
52
58
  third: (value: Awaited<UnwrapValue<Second>>) => Third,
@@ -54,9 +60,11 @@ function asyncFlow<First extends GenericCallback, Second, Third>(
54
60
 
55
61
  /**
56
62
  * Create an asynchronous Flow, a function that pipes values through a series of functions
63
+ *
64
+ * Available as `asyncFlow` and `flow.async`
57
65
  * @returns Flow function
58
66
  */
59
- function asyncFlow<First extends GenericCallback, Second, Third, Fourth>(
67
+ export function asyncFlow<First extends GenericCallback, Second, Third, Fourth>(
60
68
  first: First,
61
69
  second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second,
62
70
  third: (value: Awaited<UnwrapValue<Second>>) => Third,
@@ -65,9 +73,11 @@ function asyncFlow<First extends GenericCallback, Second, Third, Fourth>(
65
73
 
66
74
  /**
67
75
  * Create an asynchronous Flow, a function that pipes values through a series of functions
76
+ *
77
+ * Available as `asyncFlow` and `flow.async`
68
78
  * @returns Flow function
69
79
  */
70
- function asyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth>(
80
+ export function asyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth>(
71
81
  first: First,
72
82
  second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second,
73
83
  third: (value: Awaited<UnwrapValue<Second>>) => Third,
@@ -77,9 +87,11 @@ function asyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth>(
77
87
 
78
88
  /**
79
89
  * Create an asynchronous Flow, a function that pipes values through a series of functions
90
+ *
91
+ * Available as `asyncFlow` and `flow.async`
80
92
  * @returns Flow function
81
93
  */
82
- function asyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth>(
94
+ export function asyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth>(
83
95
  first: First,
84
96
  second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second,
85
97
  third: (value: Awaited<UnwrapValue<Second>>) => Third,
@@ -90,9 +102,19 @@ function asyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth,
90
102
 
91
103
  /**
92
104
  * Create an asynchronous Flow, a function that pipes values through a series of functions
105
+ *
106
+ * Available as `asyncFlow` and `flow.async`
93
107
  * @returns Flow function
94
108
  */
95
- function asyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth, Sixth, Seventh>(
109
+ export function asyncFlow<
110
+ First extends GenericCallback,
111
+ Second,
112
+ Third,
113
+ Fourth,
114
+ Fifth,
115
+ Sixth,
116
+ Seventh,
117
+ >(
96
118
  first: First,
97
119
  second: (value: Awaited<UnwrapValue<ReturnType<First>>>) => Second,
98
120
  third: (value: Awaited<UnwrapValue<Second>>) => Third,
@@ -104,9 +126,11 @@ function asyncFlow<First extends GenericCallback, Second, Third, Fourth, Fifth,
104
126
 
105
127
  /**
106
128
  * Create an asynchronous Flow, a function that pipes values through a series of functions
129
+ *
130
+ * Available as `asyncFlow` and `flow.async`
107
131
  * @returns Flow function
108
132
  */
109
- function asyncFlow<
133
+ export function asyncFlow<
110
134
  First extends GenericCallback,
111
135
  Second,
112
136
  Third,
@@ -128,9 +152,11 @@ function asyncFlow<
128
152
 
129
153
  /**
130
154
  * Create an asynchronous Flow, a function that pipes values through a series of functions
155
+ *
156
+ * Available as `asyncFlow` and `flow.async`
131
157
  * @returns Flow function
132
158
  */
133
- function asyncFlow<
159
+ export function asyncFlow<
134
160
  First extends GenericCallback,
135
161
  Second,
136
162
  Third,
@@ -154,9 +180,11 @@ function asyncFlow<
154
180
 
155
181
  /**
156
182
  * Create an asynchronous Flow, a function that pipes values through a series of functions
183
+ *
184
+ * Available as `asyncFlow` and `flow.async`
157
185
  * @returns Flow function
158
186
  */
159
- function asyncFlow<
187
+ export function asyncFlow<
160
188
  First extends GenericCallback,
161
189
  Second,
162
190
  Third,
@@ -182,20 +210,24 @@ function asyncFlow<
182
210
 
183
211
  /**
184
212
  * Create an asynchronous Flow, a function that pipes values through a series of functions
213
+ *
214
+ * Available as `asyncFlow` and `flow.async`
185
215
  * @returns Flow function
186
216
  */
187
- function asyncFlow<Fn extends GenericCallback>(
217
+ export function asyncFlow<Fn extends GenericCallback>(
188
218
  fn: Fn,
189
219
  ...fns: Array<(value: Awaited<UnwrapValue<ReturnType<Fn>>>) => unknown>
190
220
  ): FlowPromise<Fn, ReturnType<Fn>>;
191
221
 
192
222
  /**
193
223
  * Create an asynchronous Flow, a function that pipes values through a series of functions
224
+ *
225
+ * Available as `asyncFlow` and `flow.async`
194
226
  * @returns Flow function
195
227
  */
196
- function asyncFlow(...fns: GenericCallback[]): (...args: unknown[]) => Promise<unknown>;
228
+ export function asyncFlow(...fns: GenericCallback[]): (...args: unknown[]) => Promise<unknown>;
197
229
 
198
- function asyncFlow(...fns: GenericCallback[]): (...args: unknown[]) => Promise<unknown> {
230
+ export function asyncFlow(...fns: GenericCallback[]): (...args: unknown[]) => Promise<unknown> {
199
231
  assertFlowFunctions(fns);
200
232
 
201
233
  return (...args: unknown[]): Promise<unknown> =>
@@ -413,20 +445,24 @@ flow.async = asyncFlow;
413
445
 
414
446
  /**
415
447
  * Pipe a value through a function
448
+ *
449
+ * Available as `asyncPipe` and `pipe.async`
416
450
  * @param value Initial value
417
451
  * @returns Piped result
418
452
  */
419
- async function asyncPipe<Initial, Piped>(
453
+ export async function asyncPipe<Initial, Piped>(
420
454
  value: Initial,
421
455
  pipe: (value: UnwrapValue<Initial>) => Piped,
422
456
  ): Promise<UnwrapValue<Piped>>;
423
457
 
424
458
  /**
425
459
  * Pipe a value through a series of functions
460
+ *
461
+ * Available as `asyncPipe` and `pipe.async`
426
462
  * @param value Initial value
427
463
  * @returns Piped result
428
464
  */
429
- async function asyncPipe<Initial, First, Second>(
465
+ export async function asyncPipe<Initial, First, Second>(
430
466
  value: Initial,
431
467
  first: (value: UnwrapValue<Initial>) => First,
432
468
  second: (value: UnwrapValue<First>) => Second,
@@ -434,10 +470,12 @@ async function asyncPipe<Initial, First, Second>(
434
470
 
435
471
  /**
436
472
  * Pipe a value through a series of functions
473
+ *
474
+ * Available as `asyncPipe` and `pipe.async`
437
475
  * @param value Initial value
438
476
  * @returns Piped result
439
477
  */
440
- async function asyncPipe<Initial, First, Second, Third>(
478
+ export async function asyncPipe<Initial, First, Second, Third>(
441
479
  value: Initial,
442
480
  first: (value: UnwrapValue<Initial>) => First,
443
481
  second: (value: UnwrapValue<First>) => Second,
@@ -446,10 +484,12 @@ async function asyncPipe<Initial, First, Second, Third>(
446
484
 
447
485
  /**
448
486
  * Pipe a value through a series of functions
487
+ *
488
+ * Available as `asyncPipe` and `pipe.async`
449
489
  * @param value Initial value
450
490
  * @returns Piped result
451
491
  */
452
- async function asyncPipe<Initial, First, Second, Third, Fourth>(
492
+ export async function asyncPipe<Initial, First, Second, Third, Fourth>(
453
493
  value: Initial,
454
494
  first: (value: UnwrapValue<Initial>) => First,
455
495
  second: (value: UnwrapValue<First>) => Second,
@@ -459,10 +499,12 @@ async function asyncPipe<Initial, First, Second, Third, Fourth>(
459
499
 
460
500
  /**
461
501
  * Pipe a value through a series of functions
502
+ *
503
+ * Available as `asyncPipe` and `pipe.async`
462
504
  * @param value Initial value
463
505
  * @returns Piped result
464
506
  */
465
- async function asyncPipe<Initial, First, Second, Third, Fourth, Fifth>(
507
+ export async function asyncPipe<Initial, First, Second, Third, Fourth, Fifth>(
466
508
  value: Initial,
467
509
  first: (value: UnwrapValue<Initial>) => First,
468
510
  second: (value: UnwrapValue<First>) => Second,
@@ -473,10 +515,12 @@ async function asyncPipe<Initial, First, Second, Third, Fourth, Fifth>(
473
515
 
474
516
  /**
475
517
  * Pipe a value through a series of functions
518
+ *
519
+ * Available as `asyncPipe` and `pipe.async`
476
520
  * @param value Initial value
477
521
  * @returns Piped result
478
522
  */
479
- async function asyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth>(
523
+ export async function asyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth>(
480
524
  value: Initial,
481
525
  first: (value: UnwrapValue<Initial>) => First,
482
526
  second: (value: UnwrapValue<First>) => Second,
@@ -488,10 +532,12 @@ async function asyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth>(
488
532
 
489
533
  /**
490
534
  * Pipe a value through a series of functions
535
+ *
536
+ * Available as `asyncPipe` and `pipe.async`
491
537
  * @param value Initial value
492
538
  * @returns Piped result
493
539
  */
494
- async function asyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh>(
540
+ export async function asyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh>(
495
541
  value: Initial,
496
542
  first: (value: UnwrapValue<Initial>) => First,
497
543
  second: (value: UnwrapValue<First>) => Second,
@@ -504,10 +550,22 @@ async function asyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Se
504
550
 
505
551
  /**
506
552
  * Pipe a value through a series of functions
553
+ *
554
+ * Available as `asyncPipe` and `pipe.async`
507
555
  * @param value Initial value
508
556
  * @returns Piped result
509
557
  */
510
- async function asyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Seventh, Eighth>(
558
+ export async function asyncPipe<
559
+ Initial,
560
+ First,
561
+ Second,
562
+ Third,
563
+ Fourth,
564
+ Fifth,
565
+ Sixth,
566
+ Seventh,
567
+ Eighth,
568
+ >(
511
569
  value: Initial,
512
570
  first: (value: UnwrapValue<Initial>) => First,
513
571
  second: (value: UnwrapValue<First>) => Second,
@@ -521,10 +579,12 @@ async function asyncPipe<Initial, First, Second, Third, Fourth, Fifth, Sixth, Se
521
579
 
522
580
  /**
523
581
  * Pipe a value through a series of functions
582
+ *
583
+ * Available as `asyncPipe` and `pipe.async`
524
584
  * @param value Initial value
525
585
  * @returns Piped result
526
586
  */
527
- async function asyncPipe<
587
+ export async function asyncPipe<
528
588
  Initial,
529
589
  First,
530
590
  Second,
@@ -550,10 +610,12 @@ async function asyncPipe<
550
610
 
551
611
  /**
552
612
  * Pipe a value through a series of functions
613
+ *
614
+ * Available as `asyncPipe` and `pipe.async`
553
615
  * @param value Initial value
554
616
  * @returns Piped result
555
617
  */
556
- async function asyncPipe<
618
+ export async function asyncPipe<
557
619
  Initial,
558
620
  First,
559
621
  Second,
@@ -581,25 +643,29 @@ async function asyncPipe<
581
643
 
582
644
  /**
583
645
  * Pipe a value through a series of functions
646
+ *
647
+ * Available as `asyncPipe` and `pipe.async`
584
648
  * @param value Initial value
585
649
  * @returns Piped result
586
650
  */
587
- async function asyncPipe<Value>(
651
+ export async function asyncPipe<Value>(
588
652
  value: Value,
589
653
  ...pipes: Array<(value: Value) => Value>
590
654
  ): Promise<UnwrapValue<Value>>;
591
655
 
592
656
  /**
593
657
  * Pipe a value through a series of functions
658
+ *
659
+ * Available as `asyncPipe` and `pipe.async`
594
660
  * @param value Initial value
595
661
  * @returns Piped result
596
662
  */
597
- async function asyncPipe(
663
+ export async function asyncPipe(
598
664
  value: unknown,
599
665
  ...pipes: Array<(value: unknown) => unknown>
600
666
  ): Promise<unknown>;
601
667
 
602
- async function asyncPipe(
668
+ export async function asyncPipe(
603
669
  value: unknown,
604
670
  ...pipes: Array<(value: unknown) => unknown>
605
671
  ): Promise<unknown> {
@@ -48,7 +48,7 @@ export function indexOf<Item>(
48
48
  export function indexOf<Item>(array: Item[], item: Item): number;
49
49
 
50
50
  export function indexOf(array: unknown[], ...parameters: unknown[]): number {
51
- return findValue(FIND_VALUE_INDEX, array, parameters) as number;
51
+ return findValue(FIND_VALUE_INDEX, array, parameters, false) as number;
52
52
  }
53
53
 
54
54
  // #endregion
@@ -77,9 +77,11 @@ export function getAsyncTimer<Callback extends GenericAsyncCallback | GenericCal
77
77
  last = next;
78
78
 
79
79
  if (throttle) {
80
- run(next);
80
+ void run(next);
81
81
  } else {
82
- id = startTimer(() => run(next));
82
+ id = startTimer(() => {
83
+ void run(next);
84
+ });
83
85
  }
84
86
 
85
87
  return next.promise;
@@ -21,9 +21,11 @@ export function getString(value: unknown): string {
21
21
  }
22
22
 
23
23
  if (typeof value !== 'object') {
24
+ // oxlint-disable-next-line typescript/no-base-to-string: the whole point of this function is to get a string representation of any value, so calling `String` on it is fine
24
25
  return String(value);
25
26
  }
26
27
 
28
+ // oxlint-disable-next-line typescript/no-base-to-string: ditto
27
29
  const asString = String(value.valueOf?.() ?? value);
28
30
 
29
31
  return asString.startsWith('[object ') ? JSON.stringify(value) : asString;
@@ -76,10 +76,9 @@ compare.handlers = getCompareHandlers<number>(compare, {
76
76
  method: COMPARE_NAME,
77
77
  });
78
78
 
79
+ compare.deregister = deregisterComparator;
79
80
  compare.register = registerComparator;
80
81
 
81
- compare.unregister = unregisterComparator;
82
-
83
82
  function compareNumbers(first: bigint | number, second: bigint | number): number {
84
83
  if (Object.is(first, second)) {
85
84
  return 0;
@@ -121,6 +120,16 @@ function compareValue(
121
120
  return compare.handlers.handle(first, second, compareStrings);
122
121
  }
123
122
 
123
+ /**
124
+ * Deregister a custom comparison handler for a class
125
+ *
126
+ * Available as `deregisterComparator` and `compare.deregister`
127
+ * @param constructor Class constructor
128
+ */
129
+ export function deregisterComparator<Instance>(constructor: Constructor<Instance>): void {
130
+ compare.handlers.deregister(constructor);
131
+ }
132
+
124
133
  function getComparisonParts(value: unknown): unknown[] {
125
134
  if (Array.isArray(value)) {
126
135
  return value;
@@ -131,24 +140,18 @@ function getComparisonParts(value: unknown): unknown[] {
131
140
 
132
141
  /**
133
142
  * Register a custom comparison handler for a class
143
+ *
144
+ * Available as `registerComparator` and `compare.register`
134
145
  * @param constructor Class constructor
135
146
  * @param handler Method name or comparison function _(defaults to `compare`)_
136
147
  */
137
- function registerComparator<Instance>(
148
+ export function registerComparator<Instance>(
138
149
  constructor: Constructor<Instance>,
139
150
  handler?: string | ((first: Instance, second: Instance) => number),
140
151
  ): void {
141
152
  compare.handlers.register(constructor, handler);
142
153
  }
143
154
 
144
- /**
145
- * Unregister a custom comparison handler for a class
146
- * @param constructor Class constructor
147
- */
148
- function unregisterComparator<Instance>(constructor: Constructor<Instance>): void {
149
- compare.handlers.unregister(constructor);
150
- }
151
-
152
155
  // #endregion
153
156
 
154
157
  // #region Variables