@eslint-react/eff 2.3.13-beta.2 → 2.3.13-next.1
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 +28 -28
- package/dist/index.js +17 -17
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ type NarrowedTo<T, Base> = Extract<T, Base> extends never ? Base : 0 extends 1 &
|
|
|
19
19
|
/**
|
|
20
20
|
* A function that takes a guard function as predicate and returns a guard that negates it.
|
|
21
21
|
*
|
|
22
|
-
* @param predicate The guard function to negate.
|
|
22
|
+
* @param predicate - The guard function to negate.
|
|
23
23
|
* @returns Function A guard function.
|
|
24
24
|
*/
|
|
25
25
|
declare function not<T, S extends T>(predicate: (data: T) => data is S): (data: T) => data is Exclude<T, S>;
|
|
@@ -27,8 +27,8 @@ declare function not<T>(predicate: (data: T) => boolean): (data: T) => boolean;
|
|
|
27
27
|
/**
|
|
28
28
|
* A function that takes two guard functions as predicates and returns a guard that checks if either of them is true.
|
|
29
29
|
*
|
|
30
|
-
* @param a The first guard function.
|
|
31
|
-
* @param b The second guard function.
|
|
30
|
+
* @param a - The first guard function.
|
|
31
|
+
* @param b - The second guard function.
|
|
32
32
|
* @returns Function A guard function.
|
|
33
33
|
*/
|
|
34
34
|
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;
|
|
@@ -38,28 +38,28 @@ declare function or<T>(a: (data: T) => boolean, b: (data: T) => boolean): (data:
|
|
|
38
38
|
/**
|
|
39
39
|
* A function that checks if the passed parameter is an Array and narrows its type accordingly.
|
|
40
40
|
*
|
|
41
|
-
* @param data The variable to check.
|
|
41
|
+
* @param data - The variable to check.
|
|
42
42
|
* @returns True if the passed input is an Array, false otherwise. s
|
|
43
43
|
*/
|
|
44
44
|
declare function isArray<T>(data: ArrayLike<unknown> | T): data is NarrowedTo<T, ReadonlyArray<unknown>>;
|
|
45
45
|
/**
|
|
46
46
|
* Checks if the given parameter is of type `"object"` via `typeof`, excluding `null`.
|
|
47
47
|
*
|
|
48
|
-
* @param data The variable to be checked for being an object type.
|
|
48
|
+
* @param data - The variable to be checked for being an object type.
|
|
49
49
|
* @returns The input type, narrowed to only objects.
|
|
50
50
|
*/
|
|
51
51
|
declare function isObject<T>(data: T | object): data is NarrowedTo<T, object>;
|
|
52
52
|
/**
|
|
53
53
|
* A function that checks if the passed parameter is truthy and narrows its type accordingly.
|
|
54
54
|
*
|
|
55
|
-
* @param data The variable to check.
|
|
55
|
+
* @param data - The variable to check.
|
|
56
56
|
* @returns True if the passed input is truthy, false otherwise.
|
|
57
57
|
*/
|
|
58
58
|
declare function isTruthy<T>(data: T): data is Exclude<T, "" | 0 | false | null | undefined>;
|
|
59
59
|
/**
|
|
60
60
|
* Tests if a value is a `function`.
|
|
61
61
|
*
|
|
62
|
-
* @param input The value to test.
|
|
62
|
+
* @param input - The value to test.
|
|
63
63
|
* @example
|
|
64
64
|
* ```ts
|
|
65
65
|
* import * as assert from "node:assert"
|
|
@@ -74,7 +74,7 @@ declare function isTruthy<T>(data: T): data is Exclude<T, "" | 0 | false | null
|
|
|
74
74
|
declare const isFunction: (input: unknown) => input is Function;
|
|
75
75
|
/**
|
|
76
76
|
* Returns its argument.
|
|
77
|
-
* @param x The value to return.
|
|
77
|
+
* @param x - The value to return.
|
|
78
78
|
*/
|
|
79
79
|
declare function identity<T>(x: T): T;
|
|
80
80
|
/**
|
|
@@ -139,8 +139,8 @@ declare function identity<T>(x: T): T;
|
|
|
139
139
|
* console.log(pipe(2, sum(3))) // 5
|
|
140
140
|
* ```
|
|
141
141
|
*
|
|
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.
|
|
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.
|
|
144
144
|
* @since 1.0.0
|
|
145
145
|
*/
|
|
146
146
|
declare const dual: {
|
|
@@ -150,7 +150,7 @@ declare const dual: {
|
|
|
150
150
|
/**
|
|
151
151
|
* Apply a function to a given value.
|
|
152
152
|
*
|
|
153
|
-
* @param a The value to apply.
|
|
153
|
+
* @param a - The value to apply.
|
|
154
154
|
* @example
|
|
155
155
|
* ```ts
|
|
156
156
|
* import * as assert from "node:assert"
|
|
@@ -165,7 +165,7 @@ declare const dual: {
|
|
|
165
165
|
declare const apply: <A>(a: A) => <B>(self: (a: A) => B) => B;
|
|
166
166
|
/**
|
|
167
167
|
* Returns a function that always returns the same value.
|
|
168
|
-
* @param x The value to return.
|
|
168
|
+
* @param x - The value to return.
|
|
169
169
|
*/
|
|
170
170
|
declare function constant<T>(x: T): () => T;
|
|
171
171
|
/**
|
|
@@ -187,7 +187,7 @@ declare function constFalse(): false;
|
|
|
187
187
|
/**
|
|
188
188
|
* Reverses the order of arguments for a curried function.
|
|
189
189
|
*
|
|
190
|
-
* @param f The function to flip.
|
|
190
|
+
* @param f - The function to flip.
|
|
191
191
|
* @example
|
|
192
192
|
* ```ts
|
|
193
193
|
* import * as assert from "node:assert"
|
|
@@ -228,14 +228,14 @@ declare const compose: {
|
|
|
228
228
|
*
|
|
229
229
|
* This function is particularly useful when it's necessary to specify that certain cases are impossible.
|
|
230
230
|
*
|
|
231
|
-
* @param _ The value of type `never` that is passed to the function.
|
|
231
|
+
* @param _ - The value of type `never` that is passed to the function.
|
|
232
232
|
* @since 1.0.0
|
|
233
233
|
*/
|
|
234
234
|
declare const absurd: <A>(_: never) => A;
|
|
235
235
|
/**
|
|
236
236
|
* Creates a version of this function: instead of `n` arguments, it accepts a single tuple argument.
|
|
237
237
|
*
|
|
238
|
-
* @param f The function to be converted.
|
|
238
|
+
* @param f - The function to be converted.
|
|
239
239
|
* @example
|
|
240
240
|
* ```ts
|
|
241
241
|
* import * as assert from "node:assert"
|
|
@@ -252,7 +252,7 @@ declare const tupled: <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => B) =
|
|
|
252
252
|
/**
|
|
253
253
|
* Inverse function of `tupled`.
|
|
254
254
|
*
|
|
255
|
-
* @param f The function to be converted.
|
|
255
|
+
* @param f - The function to be converted.
|
|
256
256
|
* @example
|
|
257
257
|
* ```ts
|
|
258
258
|
* import * as assert from "node:assert"
|
|
@@ -267,8 +267,8 @@ declare const tupled: <A extends ReadonlyArray<unknown>, B>(f: (...a: A) => B) =
|
|
|
267
267
|
*/
|
|
268
268
|
declare const untupled: <A extends ReadonlyArray<unknown>, B>(f: (a: A) => B) => (...a: A) => B;
|
|
269
269
|
/**
|
|
270
|
-
* @param self The value to pipe.
|
|
271
|
-
* @param args The functions to apply.
|
|
270
|
+
* @param self - The value to pipe.
|
|
271
|
+
* @param args - The functions to apply.
|
|
272
272
|
* @since 1.0.0
|
|
273
273
|
*/
|
|
274
274
|
declare const pipeArguments: <A>(self: A, args: IArguments) => unknown;
|
|
@@ -338,7 +338,7 @@ declare const pipeArguments: <A>(self: A, args: IArguments) => unknown;
|
|
|
338
338
|
* // Output: 2
|
|
339
339
|
* ```
|
|
340
340
|
*
|
|
341
|
-
* @param a The value to pipe.
|
|
341
|
+
* @param a - The value to pipe.
|
|
342
342
|
* @param args
|
|
343
343
|
* @since 1.0.0
|
|
344
344
|
*/
|
|
@@ -367,7 +367,7 @@ declare function pipe<A, B = never, C = never, D = never, E = never, F = never,
|
|
|
367
367
|
*
|
|
368
368
|
* See also [`pipe`](#pipe).
|
|
369
369
|
*
|
|
370
|
-
* @param ab The first function to apply.
|
|
370
|
+
* @param ab - The first function to apply.
|
|
371
371
|
* @param bc
|
|
372
372
|
* @param cd
|
|
373
373
|
* @param de
|
|
@@ -402,17 +402,17 @@ declare function flow<A extends ReadonlyArray<unknown>, B = never, C = never, D
|
|
|
402
402
|
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
403
|
/**
|
|
404
404
|
* Retrieves a value from a Map or WeakMap if the key exists, or computes a new value if it doesn't.
|
|
405
|
-
* @param map The Map or WeakMap to get from
|
|
406
|
-
* @param key The key to look up in the Map or WeakMap
|
|
407
|
-
* @param callback The function to call to generate a new value if the key doesn't exist
|
|
405
|
+
* @param map - The Map or WeakMap to get from
|
|
406
|
+
* @param key - The key to look up in the Map or WeakMap
|
|
407
|
+
* @param callback - The function to call to generate a new value if the key doesn't exist
|
|
408
408
|
*/
|
|
409
409
|
declare function getOrElse<K extends WeakKey, V>(map: WeakMap<K, V>, key: K, callback: () => V): V;
|
|
410
410
|
declare function getOrElse<K, V>(map: Map<K, V>, key: K, callback: () => V): V;
|
|
411
411
|
/**
|
|
412
412
|
* Retrieves a value from a Map or WeakMap if the key exists, or computes and stores a new value if it doesn't.
|
|
413
|
-
* @param map The Map or WeakMap to get from or update
|
|
414
|
-
* @param key The key to look up in the Map or WeakMap
|
|
415
|
-
* @param callback The function to call to generate a new value if the key doesn't exist
|
|
413
|
+
* @param map - The Map or WeakMap to get from or update
|
|
414
|
+
* @param key - The key to look up in the Map or WeakMap
|
|
415
|
+
* @param callback - The function to call to generate a new value if the key doesn't exist
|
|
416
416
|
* @returns The existing value for the key, or the newly computed value
|
|
417
417
|
*/
|
|
418
418
|
declare function getOrElseUpdate<K extends WeakKey, V>(map: WeakMap<K, V>, key: K, callback: () => V): V;
|
|
@@ -420,8 +420,8 @@ declare function getOrElseUpdate<K, V>(map: Map<K, V>, key: K, callback: () => V
|
|
|
420
420
|
/**
|
|
421
421
|
* Attempts to add a value to a Set, but only if it doesn't already exist.
|
|
422
422
|
*
|
|
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
|
|
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
425
|
* @returns true if the value was added, false if it already existed
|
|
426
426
|
*/
|
|
427
427
|
declare function tryAddToSet<T>(set: Set<T>, value: T): boolean;
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ 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.
|
|
15
|
+
* @param data - The variable to check.
|
|
16
16
|
* @returns True if the passed input is an Array, false otherwise. s
|
|
17
17
|
*/
|
|
18
18
|
function isArray(data) {
|
|
@@ -21,7 +21,7 @@ function isArray(data) {
|
|
|
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,7 @@ 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
43
|
* @example
|
|
44
44
|
* ```ts
|
|
45
45
|
* import * as assert from "node:assert"
|
|
@@ -54,7 +54,7 @@ function isTruthy(data) {
|
|
|
54
54
|
const isFunction = (input) => typeof input === "function";
|
|
55
55
|
/**
|
|
56
56
|
* Returns its argument.
|
|
57
|
-
* @param x The value to return.
|
|
57
|
+
* @param x - The value to return.
|
|
58
58
|
*/
|
|
59
59
|
function identity(x) {
|
|
60
60
|
return x;
|
|
@@ -121,8 +121,8 @@ function identity(x) {
|
|
|
121
121
|
* console.log(pipe(2, sum(3))) // 5
|
|
122
122
|
* ```
|
|
123
123
|
*
|
|
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.
|
|
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.
|
|
126
126
|
* @since 1.0.0
|
|
127
127
|
*/
|
|
128
128
|
const dual = function(arity, body) {
|
|
@@ -156,7 +156,7 @@ const dual = function(arity, body) {
|
|
|
156
156
|
/**
|
|
157
157
|
* Apply a function to a given value.
|
|
158
158
|
*
|
|
159
|
-
* @param a The value to apply.
|
|
159
|
+
* @param a - The value to apply.
|
|
160
160
|
* @example
|
|
161
161
|
* ```ts
|
|
162
162
|
* import * as assert from "node:assert"
|
|
@@ -171,7 +171,7 @@ const dual = function(arity, body) {
|
|
|
171
171
|
const apply = (a) => (self) => self(a);
|
|
172
172
|
/**
|
|
173
173
|
* Returns a function that always returns the same value.
|
|
174
|
-
* @param x The value to return.
|
|
174
|
+
* @param x - The value to return.
|
|
175
175
|
*/
|
|
176
176
|
function constant(x) {
|
|
177
177
|
return () => x;
|
|
@@ -201,7 +201,7 @@ function constFalse() {
|
|
|
201
201
|
/**
|
|
202
202
|
* Reverses the order of arguments for a curried function.
|
|
203
203
|
*
|
|
204
|
-
* @param f The function to flip.
|
|
204
|
+
* @param f - The function to flip.
|
|
205
205
|
* @example
|
|
206
206
|
* ```ts
|
|
207
207
|
* import * as assert from "node:assert"
|
|
@@ -239,7 +239,7 @@ const compose = dual(2, (ab, bc) => (a) => bc(ab(a)));
|
|
|
239
239
|
*
|
|
240
240
|
* This function is particularly useful when it's necessary to specify that certain cases are impossible.
|
|
241
241
|
*
|
|
242
|
-
* @param _ The value of type `never` that is passed to the function.
|
|
242
|
+
* @param _ - The value of type `never` that is passed to the function.
|
|
243
243
|
* @since 1.0.0
|
|
244
244
|
*/
|
|
245
245
|
const absurd = (_) => {
|
|
@@ -248,7 +248,7 @@ const absurd = (_) => {
|
|
|
248
248
|
/**
|
|
249
249
|
* Creates a version of this function: instead of `n` arguments, it accepts a single tuple argument.
|
|
250
250
|
*
|
|
251
|
-
* @param f The function to be converted.
|
|
251
|
+
* @param f - The function to be converted.
|
|
252
252
|
* @example
|
|
253
253
|
* ```ts
|
|
254
254
|
* import * as assert from "node:assert"
|
|
@@ -265,7 +265,7 @@ const tupled = (f) => (a) => f(...a);
|
|
|
265
265
|
/**
|
|
266
266
|
* Inverse function of `tupled`.
|
|
267
267
|
*
|
|
268
|
-
* @param f The function to be converted.
|
|
268
|
+
* @param f - The function to be converted.
|
|
269
269
|
* @example
|
|
270
270
|
* ```ts
|
|
271
271
|
* import * as assert from "node:assert"
|
|
@@ -280,8 +280,8 @@ const tupled = (f) => (a) => f(...a);
|
|
|
280
280
|
*/
|
|
281
281
|
const untupled = (f) => (...a) => f(a);
|
|
282
282
|
/**
|
|
283
|
-
* @param self The value to pipe.
|
|
284
|
-
* @param args The functions to apply.
|
|
283
|
+
* @param self - The value to pipe.
|
|
284
|
+
* @param args - The functions to apply.
|
|
285
285
|
* @since 1.0.0
|
|
286
286
|
*/
|
|
287
287
|
const pipeArguments = (self, args) => {
|
|
@@ -348,8 +348,8 @@ function getOrElseUpdate(map, key, callback) {
|
|
|
348
348
|
/**
|
|
349
349
|
* Attempts to add a value to a Set, but only if it doesn't already exist.
|
|
350
350
|
*
|
|
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
|
|
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
353
|
* @returns true if the value was added, false if it already existed
|
|
354
354
|
*/
|
|
355
355
|
function tryAddToSet(set, value) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eslint-react/eff",
|
|
3
|
-
"version": "2.3.13-
|
|
3
|
+
"version": "2.3.13-next.1",
|
|
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": {
|