@eslint-react/eff 2.12.5-next.0 → 2.12.5-next.2
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.
- package/dist/index.d.ts +75 -44
- package/dist/index.js +43 -21
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,10 @@ type unit = undefined;
|
|
|
7
7
|
* alias for `undefined`.
|
|
8
8
|
*/
|
|
9
9
|
declare const unit: undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Simplifies a complex type intersection into a flat object type for better readability
|
|
12
|
+
* in IDE tooltips and error messages.
|
|
13
|
+
*/
|
|
10
14
|
type Pretty<T> = { [P in keyof T]: T[P] } & {};
|
|
11
15
|
/**
|
|
12
16
|
* An extension of Extract for type predicates which falls back to the base
|
|
@@ -19,17 +23,17 @@ type NarrowedTo<T, Base> = Extract<T, Base> extends never ? Base : 0 extends 1 &
|
|
|
19
23
|
/**
|
|
20
24
|
* A function that takes a guard function as predicate and returns a guard that negates it.
|
|
21
25
|
*
|
|
22
|
-
* @param predicate The guard function to negate.
|
|
23
|
-
* @returns
|
|
26
|
+
* @param predicate - The guard function to negate.
|
|
27
|
+
* @returns A guard function that negates the given predicate.
|
|
24
28
|
*/
|
|
25
29
|
declare function not<T, S extends T>(predicate: (data: T) => data is S): (data: T) => data is Exclude<T, S>;
|
|
26
30
|
declare function not<T>(predicate: (data: T) => boolean): (data: T) => boolean;
|
|
27
31
|
/**
|
|
28
32
|
* A function that takes two guard functions as predicates and returns a guard that checks if either of them is true.
|
|
29
33
|
*
|
|
30
|
-
* @param a The first guard function.
|
|
31
|
-
* @param b The second guard function.
|
|
32
|
-
* @returns
|
|
34
|
+
* @param a - The first guard function.
|
|
35
|
+
* @param b - The second guard function.
|
|
36
|
+
* @returns A guard function that checks if either predicate is true.
|
|
33
37
|
*/
|
|
34
38
|
declare function or<T, S extends T, U extends T>(a: (data: T) => data is S, b: (data: T) => data is U): (data: T) => data is S | U;
|
|
35
39
|
declare function or<T, S extends T>(a: (data: T) => data is S, b: (data: T) => boolean): (data: T) => data is S;
|
|
@@ -38,28 +42,29 @@ declare function or<T>(a: (data: T) => boolean, b: (data: T) => boolean): (data:
|
|
|
38
42
|
/**
|
|
39
43
|
* A function that checks if the passed parameter is an Array and narrows its type accordingly.
|
|
40
44
|
*
|
|
41
|
-
* @param data The variable to check.
|
|
42
|
-
* @returns True if the passed input is an Array, false otherwise.
|
|
45
|
+
* @param data - The variable to check.
|
|
46
|
+
* @returns True if the passed input is an Array, false otherwise.
|
|
43
47
|
*/
|
|
44
48
|
declare function isArray<T>(data: ArrayLike<unknown> | T): data is NarrowedTo<T, ReadonlyArray<unknown>>;
|
|
45
49
|
/**
|
|
46
|
-
*
|
|
50
|
+
* Checks if the given parameter is of type `"object"` via `typeof`, excluding `null`.
|
|
47
51
|
*
|
|
48
|
-
* @param data The variable to be checked for being an object type.
|
|
52
|
+
* @param data - The variable to be checked for being an object type.
|
|
49
53
|
* @returns The input type, narrowed to only objects.
|
|
50
54
|
*/
|
|
51
55
|
declare function isObject<T>(data: T | object): data is NarrowedTo<T, object>;
|
|
52
56
|
/**
|
|
53
57
|
* A function that checks if the passed parameter is truthy and narrows its type accordingly.
|
|
54
58
|
*
|
|
55
|
-
* @param data The variable to check.
|
|
59
|
+
* @param data - The variable to check.
|
|
56
60
|
* @returns True if the passed input is truthy, false otherwise.
|
|
57
61
|
*/
|
|
58
62
|
declare function isTruthy<T>(data: T): data is Exclude<T, "" | 0 | false | null | undefined>;
|
|
59
63
|
/**
|
|
60
64
|
* Tests if a value is a `function`.
|
|
61
65
|
*
|
|
62
|
-
* @param input The value to test.
|
|
66
|
+
* @param input - The value to test.
|
|
67
|
+
* @returns `true` if the input is a function, `false` otherwise.
|
|
63
68
|
* @example
|
|
64
69
|
* ```ts
|
|
65
70
|
* import * as assert from "node:assert"
|
|
@@ -74,7 +79,9 @@ declare function isTruthy<T>(data: T): data is Exclude<T, "" | 0 | false | null
|
|
|
74
79
|
declare const isFunction: (input: unknown) => input is Function;
|
|
75
80
|
/**
|
|
76
81
|
* Returns its argument.
|
|
77
|
-
*
|
|
82
|
+
*
|
|
83
|
+
* @param x - The value to return.
|
|
84
|
+
* @returns The input value unchanged.
|
|
78
85
|
*/
|
|
79
86
|
declare function identity<T>(x: T): T;
|
|
80
87
|
/**
|
|
@@ -139,8 +146,8 @@ declare function identity<T>(x: T): T;
|
|
|
139
146
|
* console.log(pipe(2, sum(3))) // 5
|
|
140
147
|
* ```
|
|
141
148
|
*
|
|
142
|
-
* @param arity The arity of the uncurried function or a predicate that determines if the function is being used in a data-first or data-last style.
|
|
143
|
-
* @param body The function to be curried.
|
|
149
|
+
* @param arity - The arity of the uncurried function or a predicate that determines if the function is being used in a data-first or data-last style.
|
|
150
|
+
* @param body - The function to be curried.
|
|
144
151
|
* @since 1.0.0
|
|
145
152
|
*/
|
|
146
153
|
declare const dual: {
|
|
@@ -150,7 +157,8 @@ declare const dual: {
|
|
|
150
157
|
/**
|
|
151
158
|
* Apply a function to a given value.
|
|
152
159
|
*
|
|
153
|
-
* @param a The value to apply.
|
|
160
|
+
* @param a - The value to apply.
|
|
161
|
+
* @returns A function that takes a function and applies it to the given value.
|
|
154
162
|
* @example
|
|
155
163
|
* ```ts
|
|
156
164
|
* import * as assert from "node:assert"
|
|
@@ -165,7 +173,9 @@ declare const dual: {
|
|
|
165
173
|
declare const apply: <A>(a: A) => <B>(self: (a: A) => B) => B;
|
|
166
174
|
/**
|
|
167
175
|
* Returns a function that always returns the same value.
|
|
168
|
-
*
|
|
176
|
+
*
|
|
177
|
+
* @param x - The value to return.
|
|
178
|
+
* @returns A function that always returns the given value.
|
|
169
179
|
*/
|
|
170
180
|
declare function constant<T>(x: T): () => T;
|
|
171
181
|
/**
|
|
@@ -174,20 +184,27 @@ declare function constant<T>(x: T): () => T;
|
|
|
174
184
|
declare function constVoid(): void;
|
|
175
185
|
/**
|
|
176
186
|
* Do nothing and return `null`.
|
|
187
|
+
*
|
|
188
|
+
* @returns null
|
|
177
189
|
*/
|
|
178
190
|
declare function constNull(): null;
|
|
179
191
|
/**
|
|
180
192
|
* Do nothing and return `true`.
|
|
193
|
+
*
|
|
194
|
+
* @returns true
|
|
181
195
|
*/
|
|
182
196
|
declare function constTrue(): true;
|
|
183
197
|
/**
|
|
184
198
|
* Do nothing and return `false`.
|
|
199
|
+
*
|
|
200
|
+
* @returns false
|
|
185
201
|
*/
|
|
186
202
|
declare function constFalse(): false;
|
|
187
203
|
/**
|
|
188
204
|
* Reverses the order of arguments for a curried function.
|
|
189
205
|
*
|
|
190
|
-
* @param f The function to flip.
|
|
206
|
+
* @param f - The function to flip.
|
|
207
|
+
* @returns A new function with the argument order reversed.
|
|
191
208
|
* @example
|
|
192
209
|
* ```ts
|
|
193
210
|
* import * as assert from "node:assert"
|
|
@@ -205,6 +222,9 @@ declare const flip: <A extends Array<unknown>, B extends Array<unknown>, C>(f: (
|
|
|
205
222
|
* Composes two functions, `ab` and `bc` into a single function that takes in an argument `a` of type `A` and returns a result of type `C`.
|
|
206
223
|
* The result is obtained by first applying the `ab` function to `a` and then applying the `bc` function to the result of `ab`.
|
|
207
224
|
*
|
|
225
|
+
* @param self - The first function to apply (or the composed function in data-last style).
|
|
226
|
+
* @param bc - The second function to apply.
|
|
227
|
+
* @returns A composed function that applies both functions in sequence.
|
|
208
228
|
* @example
|
|
209
229
|
* ```ts
|
|
210
230
|
* import * as assert from "node:assert"
|
|
@@ -228,14 +248,15 @@ declare const compose: {
|
|
|
228
248
|
*
|
|
229
249
|
* This function is particularly useful when it's necessary to specify that certain cases are impossible.
|
|
230
250
|
*
|
|
231
|
-
* @param _ The value of type `never` that is passed to the function.
|
|
251
|
+
* @param _ - The value of type `never` that is passed to the function.
|
|
232
252
|
* @since 1.0.0
|
|
233
253
|
*/
|
|
234
254
|
declare const absurd: <A>(_: never) => A;
|
|
235
255
|
/**
|
|
236
|
-
* Creates a
|
|
256
|
+
* Creates a tupled version of this function: instead of `n` arguments, it accepts a single tuple argument.
|
|
237
257
|
*
|
|
238
|
-
* @param f The function to be converted.
|
|
258
|
+
* @param f - The function to be converted.
|
|
259
|
+
* @returns A new function that accepts a single tuple argument.
|
|
239
260
|
* @example
|
|
240
261
|
* ```ts
|
|
241
262
|
* import * as assert from "node:assert"
|
|
@@ -252,7 +273,8 @@ declare const tupled: <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => B) =
|
|
|
252
273
|
/**
|
|
253
274
|
* Inverse function of `tupled`.
|
|
254
275
|
*
|
|
255
|
-
* @param f The function to be converted.
|
|
276
|
+
* @param f - The function to be converted.
|
|
277
|
+
* @returns A new function that accepts spread arguments instead of a tuple.
|
|
256
278
|
* @example
|
|
257
279
|
* ```ts
|
|
258
280
|
* import * as assert from "node:assert"
|
|
@@ -267,8 +289,12 @@ declare const tupled: <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => B) =
|
|
|
267
289
|
*/
|
|
268
290
|
declare const untupled: <A extends ReadonlyArray<unknown>, B>(f: (a: A) => B) => (...a: A) => B;
|
|
269
291
|
/**
|
|
270
|
-
*
|
|
271
|
-
*
|
|
292
|
+
* Applies a pipeline of functions to a value, passing the result of each function
|
|
293
|
+
* to the next one in sequence.
|
|
294
|
+
*
|
|
295
|
+
* @param self - The value to pipe.
|
|
296
|
+
* @param args - The functions to apply.
|
|
297
|
+
* @returns The result of applying all functions in sequence.
|
|
272
298
|
* @since 1.0.0
|
|
273
299
|
*/
|
|
274
300
|
declare const pipeArguments: <A>(self: A, args: IArguments) => unknown;
|
|
@@ -338,8 +364,9 @@ declare const pipeArguments: <A>(self: A, args: IArguments) => unknown;
|
|
|
338
364
|
* // Output: 2
|
|
339
365
|
* ```
|
|
340
366
|
*
|
|
341
|
-
* @param a The value to pipe.
|
|
342
|
-
* @param args
|
|
367
|
+
* @param a - The value to pipe.
|
|
368
|
+
* @param args - The functions to apply in sequence.
|
|
369
|
+
* @returns The result of applying all functions in sequence to the initial value.
|
|
343
370
|
* @since 1.0.0
|
|
344
371
|
*/
|
|
345
372
|
declare function pipe<A>(a: A): A;
|
|
@@ -367,15 +394,16 @@ declare function pipe<A, B = never, C = never, D = never, E = never, F = never,
|
|
|
367
394
|
*
|
|
368
395
|
* See also [`pipe`](#pipe).
|
|
369
396
|
*
|
|
370
|
-
* @param ab The first function to apply.
|
|
371
|
-
* @param bc
|
|
372
|
-
* @param cd
|
|
373
|
-
* @param de
|
|
374
|
-
* @param ef
|
|
375
|
-
* @param fg
|
|
376
|
-
* @param gh
|
|
377
|
-
* @param hi
|
|
378
|
-
* @param ij
|
|
397
|
+
* @param ab - The first function to apply.
|
|
398
|
+
* @param bc - The second function to apply.
|
|
399
|
+
* @param cd - The third function to apply.
|
|
400
|
+
* @param de - The fourth function to apply.
|
|
401
|
+
* @param ef - The fifth function to apply.
|
|
402
|
+
* @param fg - The sixth function to apply.
|
|
403
|
+
* @param gh - The seventh function to apply.
|
|
404
|
+
* @param hi - The eighth function to apply.
|
|
405
|
+
* @param ij - The ninth function to apply.
|
|
406
|
+
* @returns A composed function that applies all given functions in sequence.
|
|
379
407
|
* @example
|
|
380
408
|
* ```ts
|
|
381
409
|
* import * as assert from "node:assert"
|
|
@@ -402,27 +430,30 @@ declare function flow<A extends ReadonlyArray<unknown>, B = never, C = never, D
|
|
|
402
430
|
declare function flow<A extends ReadonlyArray<unknown>, B = never, C = never, D = never, E = never, F = never, G = never, H = never, I = never, J = never>(ab: (...a: A) => B, bc: (b: B) => C, cd: (c: C) => D, de: (d: D) => E, ef: (e: E) => F, fg: (f: F) => G, gh: (g: G) => H, hi: (h: H) => I, ij: (i: I) => J): (...a: A) => J;
|
|
403
431
|
/**
|
|
404
432
|
* Retrieves a value from a Map or WeakMap if the key exists, or computes a new value if it doesn't.
|
|
405
|
-
*
|
|
406
|
-
* @param
|
|
407
|
-
* @param
|
|
433
|
+
*
|
|
434
|
+
* @param map - The Map or WeakMap to get from.
|
|
435
|
+
* @param key - The key to look up in the Map or WeakMap.
|
|
436
|
+
* @param callback - The function to call to generate a new value if the key doesn't exist.
|
|
437
|
+
* @returns The existing value for the key, or the computed fallback value.
|
|
408
438
|
*/
|
|
409
439
|
declare function getOrElse<K extends WeakKey, V>(map: WeakMap<K, V>, key: K, callback: () => V): V;
|
|
410
440
|
declare function getOrElse<K, V>(map: Map<K, V>, key: K, callback: () => V): V;
|
|
411
441
|
/**
|
|
412
442
|
* Retrieves a value from a Map or WeakMap if the key exists, or computes and stores a new value if it doesn't.
|
|
413
|
-
*
|
|
414
|
-
* @param
|
|
415
|
-
* @param
|
|
416
|
-
* @
|
|
443
|
+
*
|
|
444
|
+
* @param map - The Map or WeakMap to get from or update.
|
|
445
|
+
* @param key - The key to look up in the Map or WeakMap.
|
|
446
|
+
* @param callback - The function to call to generate a new value if the key doesn't exist.
|
|
447
|
+
* @returns The existing value for the key, or the newly computed value.
|
|
417
448
|
*/
|
|
418
449
|
declare function getOrElseUpdate<K extends WeakKey, V>(map: WeakMap<K, V>, key: K, callback: () => V): V;
|
|
419
450
|
declare function getOrElseUpdate<K, V>(map: Map<K, V>, key: K, callback: () => V): V;
|
|
420
451
|
/**
|
|
421
452
|
* Attempts to add a value to a Set, but only if it doesn't already exist.
|
|
422
453
|
*
|
|
423
|
-
* @param set The Set to potentially add to
|
|
424
|
-
* @param value The value to add if it doesn't already exist in the Set
|
|
425
|
-
* @returns true if the value was added, false if it already existed
|
|
454
|
+
* @param set - The Set to potentially add to.
|
|
455
|
+
* @param value - The value to add if it doesn't already exist in the Set.
|
|
456
|
+
* @returns `true` if the value was added, `false` if it already existed.
|
|
426
457
|
*/
|
|
427
458
|
declare function tryAddToSet<T>(set: Set<T>, value: T): boolean;
|
|
428
459
|
//#endregion
|
package/dist/index.js
CHANGED
|
@@ -12,16 +12,16 @@ function or(a, b) {
|
|
|
12
12
|
/**
|
|
13
13
|
* A function that checks if the passed parameter is an Array and narrows its type accordingly.
|
|
14
14
|
*
|
|
15
|
-
* @param data The variable to check.
|
|
16
|
-
* @returns True if the passed input is an Array, false otherwise.
|
|
15
|
+
* @param data - The variable to check.
|
|
16
|
+
* @returns True if the passed input is an Array, false otherwise.
|
|
17
17
|
*/
|
|
18
18
|
function isArray(data) {
|
|
19
19
|
return Array.isArray(data);
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Checks if the given parameter is of type `"object"` via `typeof`, excluding `null`.
|
|
23
23
|
*
|
|
24
|
-
* @param data The variable to be checked for being an object type.
|
|
24
|
+
* @param data - The variable to be checked for being an object type.
|
|
25
25
|
* @returns The input type, narrowed to only objects.
|
|
26
26
|
*/
|
|
27
27
|
function isObject(data) {
|
|
@@ -30,7 +30,7 @@ function isObject(data) {
|
|
|
30
30
|
/**
|
|
31
31
|
* A function that checks if the passed parameter is truthy and narrows its type accordingly.
|
|
32
32
|
*
|
|
33
|
-
* @param data The variable to check.
|
|
33
|
+
* @param data - The variable to check.
|
|
34
34
|
* @returns True if the passed input is truthy, false otherwise.
|
|
35
35
|
*/
|
|
36
36
|
function isTruthy(data) {
|
|
@@ -39,7 +39,8 @@ function isTruthy(data) {
|
|
|
39
39
|
/**
|
|
40
40
|
* Tests if a value is a `function`.
|
|
41
41
|
*
|
|
42
|
-
* @param input The value to test.
|
|
42
|
+
* @param input - The value to test.
|
|
43
|
+
* @returns `true` if the input is a function, `false` otherwise.
|
|
43
44
|
* @example
|
|
44
45
|
* ```ts
|
|
45
46
|
* import * as assert from "node:assert"
|
|
@@ -54,7 +55,9 @@ function isTruthy(data) {
|
|
|
54
55
|
const isFunction = (input) => typeof input === "function";
|
|
55
56
|
/**
|
|
56
57
|
* Returns its argument.
|
|
57
|
-
*
|
|
58
|
+
*
|
|
59
|
+
* @param x - The value to return.
|
|
60
|
+
* @returns The input value unchanged.
|
|
58
61
|
*/
|
|
59
62
|
function identity(x) {
|
|
60
63
|
return x;
|
|
@@ -121,8 +124,8 @@ function identity(x) {
|
|
|
121
124
|
* console.log(pipe(2, sum(3))) // 5
|
|
122
125
|
* ```
|
|
123
126
|
*
|
|
124
|
-
* @param arity The arity of the uncurried function or a predicate that determines if the function is being used in a data-first or data-last style.
|
|
125
|
-
* @param body The function to be curried.
|
|
127
|
+
* @param arity - The arity of the uncurried function or a predicate that determines if the function is being used in a data-first or data-last style.
|
|
128
|
+
* @param body - The function to be curried.
|
|
126
129
|
* @since 1.0.0
|
|
127
130
|
*/
|
|
128
131
|
const dual = function(arity, body) {
|
|
@@ -156,7 +159,8 @@ const dual = function(arity, body) {
|
|
|
156
159
|
/**
|
|
157
160
|
* Apply a function to a given value.
|
|
158
161
|
*
|
|
159
|
-
* @param a The value to apply.
|
|
162
|
+
* @param a - The value to apply.
|
|
163
|
+
* @returns A function that takes a function and applies it to the given value.
|
|
160
164
|
* @example
|
|
161
165
|
* ```ts
|
|
162
166
|
* import * as assert from "node:assert"
|
|
@@ -171,7 +175,9 @@ const dual = function(arity, body) {
|
|
|
171
175
|
const apply = (a) => (self) => self(a);
|
|
172
176
|
/**
|
|
173
177
|
* Returns a function that always returns the same value.
|
|
174
|
-
*
|
|
178
|
+
*
|
|
179
|
+
* @param x - The value to return.
|
|
180
|
+
* @returns A function that always returns the given value.
|
|
175
181
|
*/
|
|
176
182
|
function constant(x) {
|
|
177
183
|
return () => x;
|
|
@@ -182,18 +188,24 @@ function constant(x) {
|
|
|
182
188
|
function constVoid() {}
|
|
183
189
|
/**
|
|
184
190
|
* Do nothing and return `null`.
|
|
191
|
+
*
|
|
192
|
+
* @returns null
|
|
185
193
|
*/
|
|
186
194
|
function constNull() {
|
|
187
195
|
return null;
|
|
188
196
|
}
|
|
189
197
|
/**
|
|
190
198
|
* Do nothing and return `true`.
|
|
199
|
+
*
|
|
200
|
+
* @returns true
|
|
191
201
|
*/
|
|
192
202
|
function constTrue() {
|
|
193
203
|
return true;
|
|
194
204
|
}
|
|
195
205
|
/**
|
|
196
206
|
* Do nothing and return `false`.
|
|
207
|
+
*
|
|
208
|
+
* @returns false
|
|
197
209
|
*/
|
|
198
210
|
function constFalse() {
|
|
199
211
|
return false;
|
|
@@ -201,7 +213,8 @@ function constFalse() {
|
|
|
201
213
|
/**
|
|
202
214
|
* Reverses the order of arguments for a curried function.
|
|
203
215
|
*
|
|
204
|
-
* @param f The function to flip.
|
|
216
|
+
* @param f - The function to flip.
|
|
217
|
+
* @returns A new function with the argument order reversed.
|
|
205
218
|
* @example
|
|
206
219
|
* ```ts
|
|
207
220
|
* import * as assert from "node:assert"
|
|
@@ -219,6 +232,9 @@ const flip = (f) => (...b) => (...a) => f(...a)(...b);
|
|
|
219
232
|
* Composes two functions, `ab` and `bc` into a single function that takes in an argument `a` of type `A` and returns a result of type `C`.
|
|
220
233
|
* The result is obtained by first applying the `ab` function to `a` and then applying the `bc` function to the result of `ab`.
|
|
221
234
|
*
|
|
235
|
+
* @param self - The first function to apply (or the composed function in data-last style).
|
|
236
|
+
* @param bc - The second function to apply.
|
|
237
|
+
* @returns A composed function that applies both functions in sequence.
|
|
222
238
|
* @example
|
|
223
239
|
* ```ts
|
|
224
240
|
* import * as assert from "node:assert"
|
|
@@ -239,16 +255,17 @@ const compose = dual(2, (ab, bc) => (a) => bc(ab(a)));
|
|
|
239
255
|
*
|
|
240
256
|
* This function is particularly useful when it's necessary to specify that certain cases are impossible.
|
|
241
257
|
*
|
|
242
|
-
* @param _ The value of type `never` that is passed to the function.
|
|
258
|
+
* @param _ - The value of type `never` that is passed to the function.
|
|
243
259
|
* @since 1.0.0
|
|
244
260
|
*/
|
|
245
261
|
const absurd = (_) => {
|
|
246
262
|
throw new Error("Called `absurd` function which should be uncallable");
|
|
247
263
|
};
|
|
248
264
|
/**
|
|
249
|
-
* Creates a
|
|
265
|
+
* Creates a tupled version of this function: instead of `n` arguments, it accepts a single tuple argument.
|
|
250
266
|
*
|
|
251
|
-
* @param f The function to be converted.
|
|
267
|
+
* @param f - The function to be converted.
|
|
268
|
+
* @returns A new function that accepts a single tuple argument.
|
|
252
269
|
* @example
|
|
253
270
|
* ```ts
|
|
254
271
|
* import * as assert from "node:assert"
|
|
@@ -265,7 +282,8 @@ const tupled = (f) => (a) => f(...a);
|
|
|
265
282
|
/**
|
|
266
283
|
* Inverse function of `tupled`.
|
|
267
284
|
*
|
|
268
|
-
* @param f The function to be converted.
|
|
285
|
+
* @param f - The function to be converted.
|
|
286
|
+
* @returns A new function that accepts spread arguments instead of a tuple.
|
|
269
287
|
* @example
|
|
270
288
|
* ```ts
|
|
271
289
|
* import * as assert from "node:assert"
|
|
@@ -280,8 +298,12 @@ const tupled = (f) => (a) => f(...a);
|
|
|
280
298
|
*/
|
|
281
299
|
const untupled = (f) => (...a) => f(a);
|
|
282
300
|
/**
|
|
283
|
-
*
|
|
284
|
-
*
|
|
301
|
+
* Applies a pipeline of functions to a value, passing the result of each function
|
|
302
|
+
* to the next one in sequence.
|
|
303
|
+
*
|
|
304
|
+
* @param self - The value to pipe.
|
|
305
|
+
* @param args - The functions to apply.
|
|
306
|
+
* @returns The result of applying all functions in sequence.
|
|
285
307
|
* @since 1.0.0
|
|
286
308
|
*/
|
|
287
309
|
const pipeArguments = (self, args) => {
|
|
@@ -348,9 +370,9 @@ function getOrElseUpdate(map, key, callback) {
|
|
|
348
370
|
/**
|
|
349
371
|
* Attempts to add a value to a Set, but only if it doesn't already exist.
|
|
350
372
|
*
|
|
351
|
-
* @param set The Set to potentially add to
|
|
352
|
-
* @param value The value to add if it doesn't already exist in the Set
|
|
353
|
-
* @returns true if the value was added, false if it already existed
|
|
373
|
+
* @param set - The Set to potentially add to.
|
|
374
|
+
* @param value - The value to add if it doesn't already exist in the Set.
|
|
375
|
+
* @returns `true` if the value was added, `false` if it already existed.
|
|
354
376
|
*/
|
|
355
377
|
function tryAddToSet(set, value) {
|
|
356
378
|
if (!set.has(value)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/eff",
|
|
3
|
-
"version": "2.12.5-next.
|
|
3
|
+
"version": "2.12.5-next.2",
|
|
4
4
|
"description": "JavaScript and TypeScript utilities (previously some re-exports of the effect library).",
|
|
5
5
|
"homepage": "https://github.com/Rel1cx/eslint-react",
|
|
6
6
|
"bugs": {
|