@oscarpalmer/atoms 0.184.2 → 0.185.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 (88) hide show
  1. package/dist/array/index.d.mts +2 -2
  2. package/dist/array/index.mjs +2 -2
  3. package/dist/array/{position.d.mts → match.d.mts} +9 -6
  4. package/dist/array/{position.mjs → match.mjs} +16 -16
  5. package/dist/array/move.mjs +1 -1
  6. package/dist/array/sort.d.mts +9 -4
  7. package/dist/array/sort.mjs +1 -1
  8. package/dist/array/swap.mjs +1 -1
  9. package/dist/beacon.d.mts +12 -0
  10. package/dist/beacon.mjs +9 -0
  11. package/dist/color/instance.d.mts +8 -0
  12. package/dist/color/instance.mjs +3 -0
  13. package/dist/color/models.d.mts +30 -0
  14. package/dist/function/assert.d.mts +29 -8
  15. package/dist/function/assert.mjs +29 -8
  16. package/dist/function/memoize.d.mts +3 -0
  17. package/dist/function/memoize.mjs +3 -0
  18. package/dist/function/retry.d.mts +3 -0
  19. package/dist/function/retry.mjs +3 -0
  20. package/dist/function/work.mjs +1 -1
  21. package/dist/index.d.mts +271 -158
  22. package/dist/index.mjs +230 -163
  23. package/dist/internal/value/compare.d.mts +2 -1
  24. package/dist/internal/value/equal.d.mts +5 -0
  25. package/dist/internal/value/get.d.mts +2 -2
  26. package/dist/internal/value/has.d.mts +3 -3
  27. package/dist/internal/value/has.mjs +1 -1
  28. package/dist/internal/value/misc.d.mts +2 -2
  29. package/dist/internal/value/misc.mjs +10 -4
  30. package/dist/logger.d.mts +11 -0
  31. package/dist/logger.mjs +11 -0
  32. package/dist/promise/helpers.mjs +1 -1
  33. package/dist/promise/index.d.mts +0 -6
  34. package/dist/promise/models.d.mts +36 -0
  35. package/dist/promise/models.mjs +6 -0
  36. package/dist/queue.d.mts +13 -1
  37. package/dist/queue.mjs +9 -0
  38. package/dist/result/index.d.mts +0 -8
  39. package/dist/result/index.mjs +0 -8
  40. package/dist/result/match.d.mts +4 -4
  41. package/dist/result/work/flow.d.mts +12 -36
  42. package/dist/result/work/pipe.d.mts +11 -33
  43. package/dist/sized/set.d.mts +3 -2
  44. package/dist/sized/set.mjs +3 -2
  45. package/dist/value/handle.mjs +1 -1
  46. package/dist/value/shake.d.mts +3 -0
  47. package/dist/value/smush.d.mts +3 -0
  48. package/dist/value/transform.d.mts +9 -0
  49. package/dist/value/unsmush.d.mts +3 -0
  50. package/package.json +2 -2
  51. package/src/array/difference.ts +4 -0
  52. package/src/array/from.ts +4 -0
  53. package/src/array/index.ts +1 -1
  54. package/src/array/intersection.ts +4 -0
  55. package/src/array/{position.ts → match.ts} +28 -25
  56. package/src/array/move.ts +5 -1
  57. package/src/array/reverse.ts +4 -0
  58. package/src/array/select.ts +2 -0
  59. package/src/array/sort.ts +9 -4
  60. package/src/array/swap.ts +5 -1
  61. package/src/array/toggle.ts +4 -0
  62. package/src/array/union.ts +4 -0
  63. package/src/beacon.ts +12 -0
  64. package/src/color/index.ts +0 -3
  65. package/src/color/instance.ts +9 -1
  66. package/src/color/models.ts +30 -0
  67. package/src/function/assert.ts +66 -7
  68. package/src/function/memoize.ts +3 -0
  69. package/src/function/once.ts +5 -1
  70. package/src/function/retry.ts +3 -0
  71. package/src/internal/value/compare.ts +2 -1
  72. package/src/internal/value/equal.ts +5 -0
  73. package/src/internal/value/get.ts +2 -2
  74. package/src/internal/value/has.ts +6 -6
  75. package/src/internal/value/misc.ts +24 -13
  76. package/src/logger.ts +11 -0
  77. package/src/promise/index.ts +0 -6
  78. package/src/promise/models.ts +36 -0
  79. package/src/queue.ts +13 -1
  80. package/src/result/index.ts +0 -8
  81. package/src/result/match.ts +4 -4
  82. package/src/result/work/flow.ts +12 -36
  83. package/src/result/work/pipe.ts +11 -33
  84. package/src/sized/set.ts +4 -3
  85. package/src/value/shake.ts +3 -0
  86. package/src/value/smush.ts +3 -0
  87. package/src/value/transform.ts +9 -0
  88. package/src/value/unsmush.ts +3 -0
@@ -2,9 +2,9 @@ import { Result } from "../../result/models.mjs";
2
2
 
3
3
  //#region src/internal/value/misc.d.ts
4
4
  declare function findKey(needle: string, haystack: object): string;
5
- declare function getNestedValue(data: object, path: string, ignoreCase: boolean): Result<unknown, undefined>;
5
+ declare function getNestedValue(data: object, path: string, ignoreCase: boolean): Result<unknown, string>;
6
6
  declare function getPaths(path: string, lowercase: boolean): string | string[];
7
- declare function handleValue(data: object, path: string, value: unknown, get: true, ignoreCase: boolean): Result<unknown, undefined>;
7
+ declare function handleValue(data: object, path: string, value: unknown, get: true, ignoreCase: boolean): Result<unknown, string>;
8
8
  declare function handleValue(data: object, path: string, value: unknown, get: false, ignoreCase: boolean): void;
9
9
  //#endregion
10
10
  export { findKey, getNestedValue, getPaths, handleValue };
@@ -7,7 +7,8 @@ function findKey(needle, haystack) {
7
7
  return index > -1 ? keys[index] : needle;
8
8
  }
9
9
  function getNestedValue(data, path, ignoreCase) {
10
- if (typeof data !== "object" || data === null || typeof path !== "string" || path.trim().length === 0) return error(void 0);
10
+ if (typeof data !== "object" || data === null) return error(NESTED_MESSAGE_INPUT);
11
+ if (typeof path !== "string" || path.trim().length === 0) return error(NESTED_MESSAGE_PATH);
11
12
  const shouldIgnoreCase = ignoreCase === true;
12
13
  const paths = getPaths(path, shouldIgnoreCase);
13
14
  if (typeof paths === "string") return handleValue(data, paths, null, true, shouldIgnoreCase);
@@ -27,15 +28,20 @@ function getPaths(path, lowercase) {
27
28
  return normalized.replace(EXPRESSION_BRACKET, ".$1").replace(EXPRESSION_DOTS, "").split(".");
28
29
  }
29
30
  function handleValue(data, path, value, get, ignoreCase) {
30
- if (typeof data === "object" && data !== null && !ignoreKey(path)) {
31
+ if (typeof data === "object" && data !== null) {
32
+ if (ignoreKey(path)) return error(NESTED_MESSAGE_UNSAFE);
31
33
  const key = ignoreCase ? findKey(path, data) : path;
32
- if (get) return key in data ? ok(data[key]) : error(void 0);
34
+ if (get) return key in data ? ok(data[key]) : error(NESTED_MESSAGE_MISSING);
33
35
  data[key] = typeof value === "function" ? value(data[key]) : value;
34
36
  }
35
- if (get) return error(void 0);
37
+ if (get) return error(NESTED_MESSAGE_MISSING);
36
38
  }
37
39
  const EXPRESSION_BRACKET = /\[(\w+)\]/g;
38
40
  const EXPRESSION_DOTS = /^\.|\.$/g;
39
41
  const EXPRESSION_NESTED = /\.|\[\w+\]/;
42
+ const NESTED_MESSAGE_INPUT = "Expected data to be an object";
43
+ const NESTED_MESSAGE_MISSING = "Expected property to exist in object";
44
+ const NESTED_MESSAGE_PATH = "Expected path to be a string";
45
+ const NESTED_MESSAGE_UNSAFE = "Access to this property is not allowed";
40
46
  //#endregion
41
47
  export { findKey, getNestedValue, getPaths, handleValue };
package/dist/logger.d.mts CHANGED
@@ -1,4 +1,9 @@
1
1
  //#region src/logger.d.ts
2
+ /**
3
+ * A logger that can be used to log messages to the console
4
+ *
5
+ * _(Logging can be enabled or disabled by setting the `enabled` property)_
6
+ */
2
7
  declare class Logger {
3
8
  /**
4
9
  * Log any number of values at the "debug" log level
@@ -47,8 +52,14 @@ declare class Logger {
47
52
  */
48
53
  time(label: string): Time;
49
54
  }
55
+ /**
56
+ * A named timer that can be used to log durations to the console
57
+ */
50
58
  declare class Time {
51
59
  #private;
60
+ /**
61
+ * Is the timer active? _(i.e. has it been started and not stopped, and is logging enabled?)_
62
+ */
52
63
  get active(): boolean;
53
64
  /**
54
65
  * Log the current duration of the timer _(ignored if logging is disabled)_
package/dist/logger.mjs CHANGED
@@ -1,5 +1,10 @@
1
1
  import { noop } from "./internal/function/misc.mjs";
2
2
  //#region src/logger.ts
3
+ /**
4
+ * A logger that can be used to log messages to the console
5
+ *
6
+ * _(Logging can be enabled or disabled by setting the `enabled` property)_
7
+ */
3
8
  var Logger = class {
4
9
  /**
5
10
  * Log any number of values at the "debug" log level
@@ -70,10 +75,16 @@ var Logger = class {
70
75
  return new Time(label);
71
76
  }
72
77
  };
78
+ /**
79
+ * A named timer that can be used to log durations to the console
80
+ */
73
81
  var Time = class {
74
82
  #logger;
75
83
  #stopper;
76
84
  #state;
85
+ /**
86
+ * Is the timer active? _(i.e. has it been started and not stopped, and is logging enabled?)_
87
+ */
77
88
  get active() {
78
89
  return this.#state.started && !this.#state.stopped && enabled;
79
90
  }
@@ -1,5 +1,5 @@
1
- import { getNumberOrDefault } from "../internal/number.mjs";
2
1
  import { error, ok } from "../result/misc.mjs";
2
+ import { getNumberOrDefault } from "../internal/number.mjs";
3
3
  import { PROMISE_STRATEGY_ALL, PROMISE_STRATEGY_DEFAULT, PROMISE_TYPE_FULFILLED, PROMISE_TYPE_REJECTED } from "./models.mjs";
4
4
  //#region src/promise/helpers.ts
5
5
  function getPromiseOptions(input) {
@@ -4,8 +4,6 @@ import { PromiseOptions, PromisesItems, PromisesOptions, PromisesResult, Promise
4
4
  //#region src/promise/index.d.ts
5
5
  /**
6
6
  * Wrap a promise with safety handlers, with optional abort capabilities and timeout
7
- *
8
- * Available as `attemptPromise` and `attempt.promise`
9
7
  * @param promise Promise to wrap
10
8
  * @param options Options for the promise
11
9
  * @returns Wrapped promise
@@ -13,8 +11,6 @@ import { PromiseOptions, PromisesItems, PromisesOptions, PromisesResult, Promise
13
11
  declare function attemptPromise<Value>(promise: Promise<Value>, options?: PromiseOptions | AbortSignal | number): Promise<Value>;
14
12
  /**
15
13
  * Wrap a promise-returning callback with safety handlers, with optional abort capabilities and timeout
16
- *
17
- * Available as `attemptPromise` and `attempt.promise`
18
14
  * @param callback Callback to wrap
19
15
  * @param options Options for the promise
20
16
  * @returns Promise-wrapped callback
@@ -22,8 +18,6 @@ declare function attemptPromise<Value>(promise: Promise<Value>, options?: Promis
22
18
  declare function attemptPromise<Value>(callback: () => Promise<Value>, options?: PromiseOptions | AbortSignal | number): Promise<Value>;
23
19
  /**
24
20
  * Wrap a callback with a promise and safety handlers, with optional abort capabilities and timeout
25
- *
26
- * Available as `attemptPromise` and `attempt.promise`
27
21
  * @param callback Callback to wrap
28
22
  * @param options Options for the promise
29
23
  * @returns Promise-wrapped callback
@@ -2,6 +2,9 @@ import { GenericCallback } from "../models.mjs";
2
2
  import { Result } from "../result/models.mjs";
3
3
 
4
4
  //#region src/promise/models.d.ts
5
+ /**
6
+ * A promise that can be canceled
7
+ */
5
8
  declare class CancelablePromise<Value = void> extends Promise<Value> {
6
9
  #private;
7
10
  constructor(executor: (resolve: (value: Value) => void, reject: (reason: unknown) => void) => void);
@@ -11,8 +14,17 @@ declare class CancelablePromise<Value = void> extends Promise<Value> {
11
14
  */
12
15
  cancel(reason?: unknown): void;
13
16
  }
17
+ /**
18
+ * A promise that was fulfilled
19
+ */
14
20
  type FulfilledPromise<Value> = {
21
+ /**
22
+ * Status of the promise
23
+ */
15
24
  status: typeof PROMISE_TYPE_FULFILLED;
25
+ /**
26
+ * Value of the promise
27
+ */
16
28
  value: Awaited<Value>;
17
29
  };
18
30
  type PromiseData = {
@@ -23,6 +35,9 @@ type PromiseHandlers = {
23
35
  resolve: (value: unknown[]) => void;
24
36
  reject: (reason: unknown) => void;
25
37
  };
38
+ /**
39
+ * Options for a promise-handling function
40
+ */
26
41
  type PromiseOptions = {
27
42
  /**
28
43
  * AbortSignal for aborting the promise; when aborted, the promise will reject with the reason of the signal
@@ -51,20 +66,41 @@ type PromiseParameters = {
51
66
  * - Returns an array of values
52
67
  */
53
68
  type PromiseStrategy = 'complete' | 'first';
69
+ /**
70
+ * An error thrown when a promise times out
71
+ */
54
72
  declare class PromiseTimeoutError extends Error {
55
73
  constructor();
56
74
  }
57
75
  type PromisesItems<Items extends unknown[]> = { [ItemsKey in keyof Items]: Items[ItemsKey] extends GenericCallback ? ReturnType<Items[ItemsKey]> extends Promise<infer Value> ? Promise<Value> : never : Items[ItemsKey] extends Promise<infer Value> ? Promise<Value> : Promise<Items[ItemsKey]> };
76
+ /**
77
+ * Options for handling multiple promises
78
+ */
58
79
  type PromisesOptions = {
80
+ /**
81
+ * AbortSignal for aborting the promises; when aborted, the promises will reject with the reason of the signal
82
+ */
59
83
  signal?: AbortSignal;
84
+ /**
85
+ * Strategy for handling the promises; defaults to `complete`
86
+ */
60
87
  strategy?: PromiseStrategy;
61
88
  };
62
89
  type PromisesResult<Items extends unknown[]> = { [ItemsKey in keyof Items]: Items[ItemsKey] extends Promise<infer Value> ? Result<Awaited<Value>> : never };
63
90
  type PromisesUnwrapped<Items extends unknown[]> = { [ItemsKey in keyof Items]: Items[ItemsKey] extends GenericCallback ? ReturnType<Items[ItemsKey]> extends Promise<infer Value> ? Awaited<Value> : never : Items[ItemsKey] extends Promise<infer Value> ? Awaited<Value> : never };
64
91
  type PromisesValue<Value> = FulfilledPromise<Value> | RejectedPromise;
65
92
  type PromisesValues<Items extends unknown[]> = { [ItemsKey in keyof Items]: Items[ItemsKey] extends GenericCallback ? ReturnType<Items[ItemsKey]> extends Promise<infer Value> ? PromisesValue<Awaited<Value>> : never : Items[ItemsKey] extends Promise<infer Value> ? PromisesValue<Awaited<Value>> : never };
93
+ /**
94
+ * A promise that was rejected
95
+ */
66
96
  type RejectedPromise = {
97
+ /**
98
+ * Status of the promise
99
+ */
67
100
  status: typeof PROMISE_TYPE_REJECTED;
101
+ /**
102
+ * Reason for the rejection
103
+ */
68
104
  reason: unknown;
69
105
  };
70
106
  declare const PROMISE_ABORT_EVENT = "abort";
@@ -1,4 +1,7 @@
1
1
  //#region src/promise/models.ts
2
+ /**
3
+ * A promise that can be canceled
4
+ */
2
5
  var CancelablePromise = class extends Promise {
3
6
  #rejector;
4
7
  constructor(executor) {
@@ -17,6 +20,9 @@ var CancelablePromise = class extends Promise {
17
20
  this.#rejector(reason);
18
21
  }
19
22
  };
23
+ /**
24
+ * An error thrown when a promise times out
25
+ */
20
26
  var PromiseTimeoutError = class extends Error {
21
27
  constructor() {
22
28
  super(PROMISE_MESSAGE_TIMEOUT);
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>;