ramda-adjunct 3.2.0 → 3.3.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.
- package/.nvmrc +1 -1
- package/CHANGELOG.md +9 -0
- package/README.md +1 -1
- package/dist/RA.node.js +2 -0
- package/dist/RA.web.js +2 -0
- package/dist/RA.web.standalone.js +2 -0
- package/es/isNotPrimitive.js +1 -0
- package/es/isPrimitive.js +1 -0
- package/lib/isNotPrimitive.js +1 -0
- package/lib/isPrimitive.js +1 -0
- package/package.json +18 -18
- package/src/isNotPrimitive.js +1 -0
- package/src/isPrimitive.js +1 -0
- package/types/index.d.ts +1771 -1549
package/types/index.d.ts
CHANGED
|
@@ -1,1553 +1,1775 @@
|
|
|
1
|
-
declare var RA: RamdaAdjunct.Static;
|
|
2
1
|
// TypeScript Version: 2.4
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
map<U>(fn: (t: T) => U): Functor<U>;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
interface Apply<T> extends Functor<T> {
|
|
10
|
-
ap<U>(fn: Apply<(t: T) => U>): Apply<U>;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface Foldable<T> {
|
|
14
|
-
reduce<Acc>(fn: (acc: Acc, val: T) => Acc, initAcc: Acc): Acc;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface Filterable<T> {
|
|
18
|
-
filter(fn: (t: T) => Boolean): Filterable<T>;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface Semigroup {
|
|
22
|
-
// https://www.typescriptlang.org/docs/handbook/advanced-types.html#polymorphic-this-types
|
|
23
|
-
concat(other: this): this;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
interface Catamorphism<T> {
|
|
27
|
-
cata<T1>(leftFn: (v: T1) => T, rightFn: (v: T1) => T): T;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
enum SettledPromiseStatus {
|
|
31
|
-
Fulfilled = "fulfilled",
|
|
32
|
-
Rejected = "rejected",
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
interface SettledPromise<T> {
|
|
36
|
-
status: SettledPromiseStatus;
|
|
37
|
-
value: T;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
type Variadic<T1, T2> = (...args: T1[]) => T2;
|
|
41
|
-
|
|
42
|
-
type Pred = (...a: any[]) => boolean;
|
|
43
|
-
|
|
44
|
-
interface Dictionary<T> { [key: string]: T; }
|
|
45
|
-
|
|
46
|
-
type DictPred<T> = (value: T, key: string) => boolean;
|
|
47
|
-
type Primitive = string | number | bigint | boolean | undefined | null | symbol;
|
|
48
|
-
|
|
49
|
-
interface Static {
|
|
50
|
-
/**
|
|
51
|
-
* Checks if input value is `Array`.
|
|
52
|
-
*/
|
|
53
|
-
isArray(val: any): val is any[];
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Checks whether the passed value is iterable.
|
|
57
|
-
*/
|
|
58
|
-
isIterable<T>(val: any): val is Iterable<T>;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Checks if input value is an empty `Array`.
|
|
62
|
-
*/
|
|
63
|
-
isEmptyArray(val: any): val is any[];
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Checks if input value is `Boolean`.
|
|
67
|
-
*/
|
|
68
|
-
isBoolean(val: any): val is boolean;
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Checks if value is a primitive data type. There are 6 primitive data types: `string`, `number`, `bigint`, `boolean`, `undefined`, `symbol` and a special case of `null`.
|
|
72
|
-
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Primitive_values
|
|
73
|
-
* for definition of what sub-types comprise a primitive.
|
|
74
|
-
*/
|
|
75
|
-
isPrimitive<T>(val: T | Primitive): val is Primitive;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Checks if value is not a primitive data type. There are 6 primitive data types: `string`, `number`, `bigint`, `boolean`, `undefined`, `symbol` and a special case of `null`.
|
|
79
|
-
*/
|
|
80
|
-
isNotPrimitive<T>(val: T | Primitive): val is T;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Checks if an object exists in another object's prototype chain.
|
|
84
|
-
*/
|
|
85
|
-
isPrototypeOf(type: object, object: object): boolean;
|
|
86
|
-
isPrototypeOf(type: object): (object: object) => boolean;
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* Returns `true` if the given value is its type's empty value, `null` or `undefined`.
|
|
90
|
-
*/
|
|
91
|
-
isNilOrEmpty(val: any): boolean;
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Returns `true` if the given value is not its type's empty value, nor `null` nor `undefined`.
|
|
95
|
-
*/
|
|
96
|
-
isNotNilOrEmpty(val: any): boolean;
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Checks if input value is complement of `Array`.
|
|
100
|
-
*/
|
|
101
|
-
isNotArray(val: any): boolean;
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Checks if input value is a non empty `Array`.
|
|
105
|
-
*/
|
|
106
|
-
isNonEmptyArray(val: any): val is any[];
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Checks if input value is complement of `Boolean`.
|
|
110
|
-
*/
|
|
111
|
-
isNotBoolean(val: any): boolean;
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Returns true if the given value is not its type's empty value; `false` otherwise.
|
|
115
|
-
*/
|
|
116
|
-
isNotEmpty(val: any): boolean;
|
|
117
|
-
|
|
118
|
-
/**
|
|
119
|
-
* Checks if input value is complement of `null` or `undefined`.
|
|
120
|
-
*/
|
|
121
|
-
/* tslint:disable-next-line:no-null-undefined-union null or undefined is the accurate type here */
|
|
122
|
-
isNotNil<T>(val: T | null | undefined): val is T;
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Checks if input value is complement of `null`.
|
|
126
|
-
*/
|
|
127
|
-
isNotNull(val: any): boolean;
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Checks if input value is complement of `String`.
|
|
131
|
-
*/
|
|
132
|
-
isNotString(val: any): boolean;
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Checks if input value is a non empty `String`.
|
|
136
|
-
*/
|
|
137
|
-
isNonEmptyString(val: any): boolean;
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Checks if input value is complement `undefined`.
|
|
141
|
-
*/
|
|
142
|
-
isNotUndefined(val: any): boolean;
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Checks if input value is `Symbol`.
|
|
146
|
-
*/
|
|
147
|
-
isSymbol(val: any): val is Symbol;
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Checks if input value is `null`.
|
|
151
|
-
*/
|
|
152
|
-
isNull(val: any): val is null;
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Checks if input value is `String`.
|
|
156
|
-
*/
|
|
157
|
-
isString(val: any): val is string;
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Checks if input value is an empty `String`.
|
|
161
|
-
*/
|
|
162
|
-
isEmptyString(val: any): val is string;
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Checks if input value is `undefined`.
|
|
166
|
-
*/
|
|
167
|
-
isUndefined(val: any): val is undefined;
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Tests whether or not an object is similar to an array.
|
|
171
|
-
*/
|
|
172
|
-
isArrayLike(val: any): boolean;
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Tests whether or not an object is similar to an array.
|
|
176
|
-
*/
|
|
177
|
-
isNotArrayLike(val: any): boolean;
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Checks if input value is `Generator Function`.
|
|
181
|
-
*/
|
|
182
|
-
isGeneratorFunction(val: any): val is Function;
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Checks if input value is complement of `Generator Function`.
|
|
186
|
-
*/
|
|
187
|
-
isNotGeneratorFunction(val: any): boolean;
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Checks if input value is `Async Function`.
|
|
191
|
-
*/
|
|
192
|
-
isAsyncFunction(val: any): val is Function;
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Checks if input value is complement of `Async Function`.
|
|
196
|
-
*/
|
|
197
|
-
isNotAsyncFunction(val: any): boolean;
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Checks if input value is `Function`.
|
|
201
|
-
*/
|
|
202
|
-
isFunction(val: any): val is Function;
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* Checks if input value is complement of `Function`.
|
|
206
|
-
*/
|
|
207
|
-
isNotFunction(val: any): boolean;
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Checks if input value is language type of `Object`.
|
|
211
|
-
*/
|
|
212
|
-
isObj(val: any): val is {} | Function;
|
|
213
|
-
isObject(val: any): val is {} | Function; // alias
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Checks if input value is complement of language type of `Object`.
|
|
217
|
-
*/
|
|
218
|
-
isNotObj(val: any): boolean;
|
|
219
|
-
isNotObject(val: any): boolean; // alias
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* Checks if value is object-like. A value is object-like if it's not null and has a typeof result of "object".
|
|
223
|
-
*/
|
|
224
|
-
isObjLike(val: any): val is object;
|
|
225
|
-
isObjectLike(val: any): val is object; // alias
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Checks if value is not object-like.
|
|
229
|
-
* A value is object-like if it's not null and has a typeof result of "object".
|
|
230
|
-
*/
|
|
231
|
-
isNotObjLike(val: any): boolean;
|
|
232
|
-
isNotObjectLike(val: any): boolean; // alias
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Check to see if an object is a plain object (created using `{}`, `new Object()` or `Object.create(null)`).
|
|
236
|
-
*/
|
|
237
|
-
isPlainObj(val: any): val is object;
|
|
238
|
-
isPlainObject(val: any): val is object; // alias
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Check to see if an object is not a plain object
|
|
242
|
-
* (created using `{}`, `new Object()` or `Object.create(null)`).
|
|
243
|
-
*/
|
|
244
|
-
isNotPlainObj(val: any): boolean;
|
|
245
|
-
isNotPlainObject(val: any): boolean; // alias
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Checks if value is `Date` object.
|
|
249
|
-
*/
|
|
250
|
-
isDate(val: any): val is Date;
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Checks if value is complement of `Date` object.
|
|
254
|
-
*/
|
|
255
|
-
isNotDate(val: any): boolean;
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Checks if value is valid `Date` object.
|
|
259
|
-
*/
|
|
260
|
-
isValidDate(val: any): val is Date;
|
|
261
|
-
|
|
262
|
-
/**
|
|
263
|
-
* Checks if value is complement of valid `Date` object.
|
|
264
|
-
*/
|
|
265
|
-
isNotValidDate(val: any): boolean;
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Checks if value is complement of valid `Date` object.
|
|
269
|
-
*/
|
|
270
|
-
isInvalidDate(val: any): boolean; // alias of isNotValidDate
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* Checks if value is `Map`.
|
|
274
|
-
*/
|
|
275
|
-
isMap(val: any): val is Map<any, any>;
|
|
276
|
-
|
|
277
|
-
/**
|
|
278
|
-
* Checks if value is complement of `Map` object.
|
|
279
|
-
*/
|
|
280
|
-
isNotMap(val: any): boolean;
|
|
281
|
-
|
|
282
|
-
/**
|
|
283
|
-
* Checks whether the passed value is `NaN` and its type is `Number`.
|
|
284
|
-
* It is a more robust version of the original, global isNaN().
|
|
285
|
-
*/
|
|
286
|
-
isNaN(val: any): val is typeof NaN;
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* Checks if value is a natural number.
|
|
290
|
-
* Natural numbers correspond to all non-negative integers and 0.
|
|
291
|
-
*/
|
|
292
|
-
isNaturalNumber(val: any): boolean;
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* Checks whether the passed value is complement of `NaN` and its type is not `Number`.
|
|
296
|
-
*/
|
|
297
|
-
isNotNaN(val: any): boolean;
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* Checks if value is a `Number` primitive or object.
|
|
301
|
-
*/
|
|
302
|
-
isNumber(val: any): val is number;
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Checks if value is a complement of `Number` primitive or object.
|
|
306
|
-
*/
|
|
307
|
-
isNotNumber(val: any): boolean;
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* Checks if value is a positive `Number` primitive or object. Zero is considered neither
|
|
311
|
-
* positive or negative.
|
|
312
|
-
*/
|
|
313
|
-
isPositive(val: any): val is number;
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* Checks if value is a negative `Number` primitive or object. Zero is considered neither
|
|
317
|
-
* positive or negative.
|
|
318
|
-
*/
|
|
319
|
-
isNegative(val: any): val is number;
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* Checks if value is a positive zero (+0).
|
|
323
|
-
*/
|
|
324
|
-
isPositiveZero(val: any): boolean;
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
* Checks if value is a negative zero (-0).
|
|
328
|
-
*/
|
|
329
|
-
isNegativeZero(val: any): boolean;
|
|
330
|
-
|
|
331
|
-
/**
|
|
332
|
-
* Checks if value is a non-positive `Number` primitive or object. This includes all
|
|
333
|
-
* negative numbers and zero.
|
|
334
|
-
*/
|
|
335
|
-
isNonPositive(val: any): val is number;
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* Checks if value is a non-negative `Number` primitive or object. This includes all
|
|
339
|
-
* positive numbers and zero.
|
|
340
|
-
*/
|
|
341
|
-
isNonNegative(val: any): val is number;
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
* Checks whether the passed value is a finite `Number`.
|
|
345
|
-
*/
|
|
346
|
-
isFinite(val: any): boolean;
|
|
347
|
-
|
|
348
|
-
/**
|
|
349
|
-
* Checks whether the passed value is complement of finite `Number`.
|
|
350
|
-
*/
|
|
351
|
-
isNotFinite(val: any): boolean;
|
|
352
|
-
|
|
353
|
-
/**
|
|
354
|
-
* Checks whether the passed value is an `integer`.
|
|
355
|
-
*/
|
|
356
|
-
isInteger(val: any): val is number;
|
|
357
|
-
|
|
358
|
-
/**
|
|
359
|
-
* Checks whether the passed value is a signed 32 bit `integer`.
|
|
360
|
-
*/
|
|
361
|
-
isInteger32(val: any): boolean;
|
|
362
|
-
|
|
363
|
-
/**
|
|
364
|
-
* Checks whether the passed value is an unsigned 32 bit integer number.
|
|
365
|
-
*/
|
|
366
|
-
isUinteger32(val: any): boolean;
|
|
367
|
-
isUint32(val: any): boolean; // alias
|
|
368
|
-
|
|
369
|
-
/**
|
|
370
|
-
* Checks whether the passed value is complement of `integer`.
|
|
371
|
-
*/
|
|
372
|
-
isNotInteger(val: any): boolean;
|
|
373
|
-
|
|
374
|
-
/**
|
|
375
|
-
* Checks if value is a BigInt.
|
|
376
|
-
*/
|
|
377
|
-
isBigInt(val: any): boolean;
|
|
378
|
-
|
|
379
|
-
/**
|
|
380
|
-
* Returns `true` if the given value is its type's empty value, `false`, `undefined`
|
|
381
|
-
* as well as strings containing only whitespace characters; `false` otherwise.
|
|
382
|
-
*/
|
|
383
|
-
isBlank(val: any): boolean;
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
* Checks whether the passed value is a `float`.
|
|
387
|
-
*/
|
|
388
|
-
isFloat(val: any): val is number;
|
|
389
|
-
|
|
390
|
-
/**
|
|
391
|
-
* Checks whether the passed value is a safe `integer`.
|
|
392
|
-
*/
|
|
393
|
-
isSafeInteger(val: any): boolean;
|
|
394
|
-
|
|
395
|
-
/**
|
|
396
|
-
* Checks whether the passed value is complement of a `float`.
|
|
397
|
-
*/
|
|
398
|
-
isNotFloat(val: any): boolean;
|
|
399
|
-
|
|
400
|
-
/**
|
|
401
|
-
* Checks if value is a valid `Number`. A valid `Number` is a number that is not `NaN`,
|
|
402
|
-
* `Infinity` or `-Infinity`.
|
|
403
|
-
*/
|
|
404
|
-
isValidNumber(val: any): boolean;
|
|
405
|
-
|
|
406
|
-
/**
|
|
407
|
-
* Checks if value is not a valid `Number`. A valid `Number` is a number that is not `NaN`,
|
|
408
|
-
* `Infinity` or `-Infinity`.
|
|
409
|
-
*/
|
|
410
|
-
isNotValidNumber(val: any): boolean;
|
|
411
|
-
|
|
412
|
-
/**
|
|
413
|
-
* Checks if value is odd integer number.
|
|
414
|
-
* An odd number is an integer which is not a multiple DIVISIBLE of two.
|
|
415
|
-
*/
|
|
416
|
-
isOdd(val: any): boolean;
|
|
417
|
-
|
|
418
|
-
/**
|
|
419
|
-
* Checks if value is even integer number.
|
|
420
|
-
* An even number is an integer which is "evenly divisible" by two.
|
|
421
|
-
* Zero is an even number because zero divided by two equals zero,
|
|
422
|
-
* which despite not being a natural number, is an integer.
|
|
423
|
-
* Even numbers are either positive or negative.
|
|
424
|
-
*/
|
|
425
|
-
isEven(val: any): boolean;
|
|
426
|
-
|
|
427
|
-
/**
|
|
428
|
-
* Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, `SyntaxError`, `TypeError` or `URIError` object.
|
|
429
|
-
*/
|
|
430
|
-
isError(val: any): val is Error;
|
|
431
|
-
|
|
432
|
-
/**
|
|
433
|
-
* Checks if input value is a pair.
|
|
434
|
-
*/
|
|
435
|
-
isPair(val: any): val is any[];
|
|
436
|
-
|
|
437
|
-
/**
|
|
438
|
-
* Checks if input value is complement of a pair.
|
|
439
|
-
*/
|
|
440
|
-
isNotPair(val: any): boolean;
|
|
441
|
-
|
|
442
|
-
/**
|
|
443
|
-
* Checks if value is `RegExp` object.
|
|
444
|
-
*/
|
|
445
|
-
isRegExp(val: any): boolean;
|
|
446
|
-
|
|
447
|
-
/**
|
|
448
|
-
* Checks if value is `Set`.
|
|
449
|
-
*/
|
|
450
|
-
isSet(val: any): val is Set<any>;
|
|
451
|
-
|
|
452
|
-
/**
|
|
453
|
-
* Checks if value is complement of `Set` object.
|
|
454
|
-
*/
|
|
455
|
-
isNotSet(val: any): boolean;
|
|
456
|
-
|
|
457
|
-
/**
|
|
458
|
-
* Checks if value is complement of `RegExp` object.
|
|
459
|
-
*/
|
|
460
|
-
isNotRegExp(val: any): boolean;
|
|
461
|
-
|
|
462
|
-
/**
|
|
463
|
-
* Checks if input value is a sparse Array.
|
|
464
|
-
* An array with at least one "empty slot" in it is often called a "sparse array."
|
|
465
|
-
* Empty slot doesn't mean that the slot contains `null` or `undefined` values,
|
|
466
|
-
* but rather that the slots don't exist.
|
|
467
|
-
*/
|
|
468
|
-
isSparseArray(val: any): boolean;
|
|
469
|
-
|
|
470
|
-
/**
|
|
471
|
-
* Checks whether the passed value is
|
|
472
|
-
* {@link https://github.com/getify/You-Dont-Know-JS/blob/9959fc904d584bbf0b02cf41c192f74ff4238581/types-grammar/ch4.md#the-curious-case-of-the-|a sentinel value}.
|
|
473
|
-
*/
|
|
474
|
-
isSentinelValue(val: any): boolean;
|
|
475
|
-
|
|
476
|
-
/**
|
|
477
|
-
* A function that returns `undefined`.
|
|
478
|
-
*/
|
|
479
|
-
stubUndefined(): undefined;
|
|
480
|
-
|
|
481
|
-
/**
|
|
482
|
-
* A function that returns `null`.
|
|
483
|
-
*/
|
|
484
|
-
stubNull(): null;
|
|
485
|
-
|
|
486
|
-
/**
|
|
487
|
-
* A function that returns new empty array on every call.
|
|
488
|
-
*/
|
|
489
|
-
stubArray(): any[];
|
|
490
|
-
|
|
491
|
-
/**
|
|
492
|
-
* This function returns a new empty object.
|
|
493
|
-
*/
|
|
494
|
-
stubObj(): {};
|
|
495
|
-
stubObject(): {}; // alias
|
|
496
|
-
|
|
497
|
-
/**
|
|
498
|
-
* A function that returns empty string.
|
|
499
|
-
*/
|
|
500
|
-
stubString(): "";
|
|
501
|
-
|
|
502
|
-
/**
|
|
503
|
-
* A function that performs no operations.
|
|
504
|
-
*/
|
|
505
|
-
noop(...args: any[]): undefined;
|
|
506
|
-
|
|
507
|
-
/**
|
|
508
|
-
* Picks values from list by indexes.
|
|
509
|
-
*/
|
|
510
|
-
pickIndexes<T>(indexes: number[], list: T[]): T[];
|
|
511
|
-
pickIndexes(indexes: number[]): <T>(list: T[]) => T[];
|
|
512
|
-
|
|
513
|
-
/**
|
|
514
|
-
* Creates a list from from arguments.
|
|
515
|
-
*/
|
|
516
|
-
list(...items: any[]): any[];
|
|
517
|
-
|
|
518
|
-
/**
|
|
519
|
-
* Returns a singleton array containing the value provided.
|
|
520
|
-
* If value is already an array, it is returned as is.
|
|
521
|
-
*/
|
|
522
|
-
ensureArray<T>(value: T | T[]): T[];
|
|
523
|
-
|
|
524
|
-
/**
|
|
525
|
-
* Returns the result of concatenating the given lists or strings.
|
|
526
|
-
* Note: RA.concatAll expects all elements to be of the same type.
|
|
527
|
-
* It will throw an error if you concat an Array with a non-Array value.
|
|
528
|
-
* Dispatches to the concat method of the preceding element, if present.
|
|
529
|
-
* Can also concatenate multiple elements of a [fantasy-land compatible semigroup](https://github.com/fantasyland/fantasy-land#semigroup).
|
|
530
|
-
* Returns undefined if empty array was passed.
|
|
531
|
-
*/
|
|
532
|
-
concatAll<S extends Semigroup>(foldable: Foldable<S>): S | undefined;
|
|
533
|
-
|
|
534
|
-
/**
|
|
535
|
-
* Returns the result of concatenating the given lists or strings.
|
|
536
|
-
*/
|
|
537
|
-
concatRight<T extends any[]>(firstList: T, secondList: T): T;
|
|
538
|
-
concatRight<T extends any[]>(firstList: T): (secondList: T) => T;
|
|
539
|
-
concatRight(firstList: string, secondList: string): string;
|
|
540
|
-
concatRight(firstList: string): (secondList: string) => string;
|
|
541
|
-
|
|
542
|
-
/**
|
|
543
|
-
* Acts as multiple path: arrays of paths in, array of values out. Preserves order.
|
|
544
|
-
*/
|
|
545
|
-
paths(ps: Array<Array<string | number>>, obj: object): any[];
|
|
546
|
-
paths(ps: Array<Array<string | number>>): (obj: object) => any[];
|
|
547
|
-
|
|
548
|
-
/**
|
|
549
|
-
* If the given, non-null object has a value at the given path, returns the value at that path.
|
|
550
|
-
* Otherwise returns the result of invoking the provided function with the object.
|
|
551
|
-
*/
|
|
552
|
-
pathOrLazy<T>(
|
|
553
|
-
defaultValueFn: () => T,
|
|
554
|
-
path: Array<number | string>,
|
|
555
|
-
obj: object
|
|
556
|
-
): T;
|
|
557
|
-
pathOrLazy<T>(
|
|
558
|
-
defaultValueFn: () => T,
|
|
559
|
-
path: Array<number | string>
|
|
560
|
-
): (obj: object) => T;
|
|
561
|
-
pathOrLazy<T>(
|
|
562
|
-
defaultValueFn: () => T
|
|
563
|
-
): {
|
|
564
|
-
(path: Array<number | string>, obj: object): T;
|
|
565
|
-
(path: Array<number | string>): (obj: object) => T;
|
|
566
|
-
};
|
|
567
|
-
|
|
568
|
-
/**
|
|
569
|
-
* "lifts" a function to be the specified arity, so that it may "map over" objects that satisfy
|
|
570
|
-
* the Apply spec of fantasy land.
|
|
571
|
-
*/
|
|
572
|
-
liftFN<T>(arity: number, fn: Variadic<Apply<T>, T>): Apply<T>;
|
|
573
|
-
liftFN(arity: number): <T>(fn: Variadic<Apply<T>, T>) => Apply<T>;
|
|
574
|
-
|
|
575
|
-
/**
|
|
576
|
-
* "lifts" a function of arity > 1 so that it may "map over" objects that satisfy
|
|
577
|
-
* the Apply spec of fantasy land.
|
|
578
|
-
*/
|
|
579
|
-
liftF<T>(fn: Variadic<Apply<T>, T>): Apply<T>;
|
|
580
|
-
|
|
581
|
-
/**
|
|
582
|
-
* The catamorphism for either. If the either is right than the right function will be executed with
|
|
583
|
-
* the right value and the value of the function returned. Otherwise the left function
|
|
584
|
-
* will be called with the left value.
|
|
585
|
-
*/
|
|
586
|
-
cata<V1, V2, T1, T2>(
|
|
587
|
-
leftFn: (leftValue: V1) => T1,
|
|
588
|
-
rightFn: (rightValue: V2) => T2,
|
|
589
|
-
either: Catamorphism<V1 | V2>,
|
|
590
|
-
): T1 | T2;
|
|
591
|
-
cata<V1, V2, T1, T2>(
|
|
592
|
-
leftFn: (leftValue: V1) => T1,
|
|
593
|
-
rightFn: (rightValue: V2) => T2):
|
|
594
|
-
(either: Catamorphism<V1 | V2>,
|
|
595
|
-
) => T1 | T2;
|
|
596
|
-
cata<V1, V2, T1, T2>(leftFn: (leftValue: V1) => T1): {
|
|
597
|
-
(rightFn: (rightValue: V2) => T2, either: Catamorphism<V1 | V2>): T1 | T2;
|
|
598
|
-
(rightFn: (rightValue: V2) => T2): (either: Catamorphism<V1 | V2>) => T1 | T2
|
|
599
|
-
};
|
|
600
|
-
|
|
601
|
-
/**
|
|
602
|
-
* Creates a new object with the own properties of the provided object, but the
|
|
603
|
-
* keys renamed according to the keysMap object as `{oldKey: newKey}`.
|
|
604
|
-
* When some key is not found in the keysMap, then it's passed as-is.
|
|
605
|
-
*/
|
|
606
|
-
renameKeys(keysMap: Dictionary<string>, obj: object): object;
|
|
607
|
-
renameKeys(keysMap: Dictionary<string>): (obj: object) => object;
|
|
608
|
-
|
|
609
|
-
/**
|
|
610
|
-
* Creates a new object with the own properties of the provided object, and the
|
|
611
|
-
* keys copied according to the keysMap object as `{oldKey: newKey}`.
|
|
612
|
-
* When no key from the keysMap is found, then a shallow clone of an object is returned.
|
|
613
|
-
*/
|
|
614
|
-
copyKeys(keysMap: Dictionary<string>, obj: object): object;
|
|
615
|
-
copyKeys(keysMap: Dictionary<string>): (obj: object) => object;
|
|
616
|
-
|
|
617
|
-
/**
|
|
618
|
-
* Creates a new object with the own properties of the provided object, but the
|
|
619
|
-
* keys renamed according to logic of renaming function.
|
|
620
|
-
*/
|
|
621
|
-
renameKeysWith(renameFn: (key: string) => string, obj: object): object;
|
|
622
|
-
renameKeysWith(renameFn: (key: string) => string): (obj: object) => object;
|
|
623
|
-
|
|
624
|
-
/**
|
|
625
|
-
* Creates a new object with the own properties of the provided object, but the
|
|
626
|
-
* key `key` renamed according to logic of renaming function.
|
|
627
|
-
*/
|
|
628
|
-
renameKeyWith(
|
|
629
|
-
renameFn: (key: string) => string,
|
|
630
|
-
key: string,
|
|
631
|
-
obj: object
|
|
632
|
-
): object;
|
|
633
|
-
renameKeyWith(
|
|
634
|
-
renameFn: (key: string) => string,
|
|
635
|
-
key: string
|
|
636
|
-
): (obj: object) => object;
|
|
637
|
-
renameKeyWith(
|
|
638
|
-
renameFn: (key: string) => string
|
|
639
|
-
): {
|
|
640
|
-
(key: string, obj: object): object;
|
|
641
|
-
(key: string): (obj: object) => object;
|
|
642
|
-
};
|
|
643
|
-
|
|
644
|
-
/**
|
|
645
|
-
* Functional equivalent of merging object properties with object spread.
|
|
646
|
-
*/
|
|
647
|
-
mergeProps(ps: string[], obj: object): object;
|
|
648
|
-
mergeProps(ps: string[]): (obj: object) => object;
|
|
649
|
-
|
|
650
|
-
/**
|
|
651
|
-
* Merge objects under corresponding paths.
|
|
652
|
-
*/
|
|
653
|
-
mergePaths(paths: Array<Array<string | number>>, obj: object): object;
|
|
654
|
-
mergePaths(paths: Array<Array<string | number>>): (obj: object) => object;
|
|
655
|
-
|
|
656
|
-
/**
|
|
657
|
-
* Create a new object with the own properties of the object under the `p`
|
|
658
|
-
* merged with the own properties of the provided `source`.
|
|
659
|
-
* If a key exists in both objects, the value from the `source` object will be used.
|
|
660
|
-
*/
|
|
661
|
-
mergeProp(p: string, source: object, obj: object): object;
|
|
662
|
-
mergeProp(p: string, source: object): (obj: object) => object;
|
|
663
|
-
mergeProp(p: string): {
|
|
664
|
-
(source: object, obj: object): object;
|
|
665
|
-
(source: object): (obj: object) => object;
|
|
666
|
-
};
|
|
667
|
-
|
|
668
|
-
/**
|
|
669
|
-
* Create a new object with the own properties of the object under the `path`
|
|
670
|
-
* merged with the own properties of the provided `source`.
|
|
671
|
-
* If a key exists in both objects, the value from the `source` object will be used.
|
|
672
|
-
*/
|
|
673
|
-
mergePath(path: Array<string | number>, source: object, obj: object): object;
|
|
674
|
-
mergePath(path: Array<string | number>, source: object): (obj: object) => object;
|
|
675
|
-
mergePath(path: Array<string | number>): {
|
|
676
|
-
(source: object, obj: object): object;
|
|
677
|
-
(source: object): (obj: object) => object;
|
|
678
|
-
};
|
|
679
|
-
|
|
680
|
-
/**
|
|
681
|
-
* Returns a partial copy of an object containing only the keys
|
|
682
|
-
* that don't satisfy the supplied predicate.
|
|
683
|
-
*/
|
|
684
|
-
omitBy<T, U extends Dictionary<T>>(pred: DictPred<T>, obj: U): U;
|
|
685
|
-
omitBy<T, U extends Dictionary<T>>(pred: DictPred<T>): (obj: U) => U;
|
|
686
|
-
|
|
687
|
-
/**
|
|
688
|
-
* Weave a configuration into function returning the runnable monad like `Reader` or `Free`.
|
|
689
|
-
*/
|
|
690
|
-
weave(fn: Function, config: any): Function;
|
|
691
|
-
weave(fn: Function): (config: any) => Function;
|
|
692
|
-
|
|
693
|
-
/**
|
|
694
|
-
* Weave a configuration into function returning the runnable monad like `Reader` or `Free`.
|
|
695
|
-
*/
|
|
696
|
-
weaveLazy(fn: Function, configAccessor: Function): Function;
|
|
697
|
-
weaveLazy(fn: Function): (configAccessor: Function) => Function;
|
|
698
|
-
|
|
699
|
-
/**
|
|
700
|
-
* Returns a curried equivalent of the provided function, with the specified arity.
|
|
701
|
-
* This function is like curryN, except that the provided arguments order is reversed.
|
|
702
|
-
*/
|
|
703
|
-
curryRightN(arity: number, fn: Function): Function;
|
|
704
|
-
curryRightN(arity: number): (fn: Function) => Function;
|
|
705
|
-
|
|
706
|
-
/**
|
|
707
|
-
* Returns a curried equivalent of the provided function.
|
|
708
|
-
* This function is like curry, except that the provided arguments order is reversed.
|
|
709
|
-
*/
|
|
710
|
-
curryRight(fn: Function): Function;
|
|
711
|
-
|
|
712
|
-
/**
|
|
713
|
-
* {@link http://ramdajs.com/docs/#map|R.map} function that more closely resembles Array.prototype.map.
|
|
714
|
-
* It takes two new parameters to its callback function: the current index, and the entire list.
|
|
715
|
-
*/
|
|
716
|
-
mapIndexed<T, U>(iterator: (elem: T, key: number, list: T[]) => U, list: ReadonlyArray<T>): U[];
|
|
717
|
-
mapIndexed<T, U>(iterator: (elem: T, key: number, list: T[]) => U): (list: ReadonlyArray<T>) => U[];
|
|
718
|
-
mapIndexed<T, U>(
|
|
719
|
-
iterator: (elem: T, key: number, list: Dictionary<T>) => U,
|
|
720
|
-
list: Dictionary<T>,
|
|
721
|
-
): Dictionary<U>;
|
|
722
|
-
mapIndexed<T, U>(
|
|
723
|
-
iterator: (elem: T, key: number, list: Dictionary<T>) => U,
|
|
724
|
-
): (list: Dictionary<T>) => Dictionary<U>;
|
|
725
|
-
mapIndexed<T, U>(iterator: (elem: T, key: number, list: Functor<T>) => U, list: Functor<T>): Functor<U>;
|
|
726
|
-
mapIndexed<T, U>(iterator: (elem: T, key: number, list: Functor<T>) => U): (list: Functor<T>) => Functor<U>;
|
|
727
|
-
mapIndexed(iterator: (char: string, key: number, str: string) => string, str: string): string[];
|
|
728
|
-
mapIndexed(iterator: (char: string, key: number, str: string) => string): (str: string) => string[];
|
|
729
|
-
|
|
730
|
-
/**
|
|
731
|
-
* {@link http://ramdajs.com/docs/#reduce|R.reduce} function that more closely resembles Array.prototype.reduce.
|
|
732
|
-
* It takes two new parameters to its callback function: the current index, and the entire list.
|
|
733
|
-
*/
|
|
734
|
-
reduceIndexed<T, TResult, R extends T[]>(
|
|
735
|
-
iterator: (acc: TResult, elem: T, key: number, list: R) => TResult,
|
|
736
|
-
acc: TResult,
|
|
737
|
-
list: R,
|
|
738
|
-
): TResult;
|
|
739
|
-
reduceIndexed<T, TResult, R extends T[]>(
|
|
740
|
-
iterator: (acc: TResult, elem: T, key: number, list: R) => TResult,
|
|
741
|
-
acc: TResult,
|
|
742
|
-
): (list: R) => TResult;
|
|
743
|
-
reduceIndexed<T, TResult, R extends T[]>(
|
|
744
|
-
iterator: (acc: TResult, elem: T, key: number, list: R) => TResult,
|
|
745
|
-
): {
|
|
746
|
-
(acc: TResult): (list: R) => TResult;
|
|
747
|
-
(acc: TResult, list: R): TResult
|
|
748
|
-
};
|
|
749
|
-
|
|
750
|
-
/**
|
|
751
|
-
* {@link http://ramdajs.com/docs/#filter|R.filter} function that more closely resembles `Array.prototype.filter`.
|
|
752
|
-
* It takes two new parameters to its callback function: the current index, and the entire list.
|
|
753
|
-
*
|
|
754
|
-
* `filterIndexed` implementation is simple: `
|
|
755
|
-
* const filterIndexed = R.addIndex(R.filter);
|
|
756
|
-
* `
|
|
757
|
-
*/
|
|
758
|
-
filterIndexed<T>(iterator: (elem: T, idx: number, list: T[]) => Boolean, list: ReadonlyArray<T>): T[];
|
|
759
|
-
filterIndexed<T>(iterator: (elem: T, idx: number, list: T[]) => Boolean): (list: ReadonlyArray<T>) => T[];
|
|
760
|
-
filterIndexed<T>(
|
|
761
|
-
iterator: (elem: T, idx: number, list: Dictionary<T>) => Boolean,
|
|
762
|
-
list: Dictionary<T>,
|
|
763
|
-
): Dictionary<T>;
|
|
764
|
-
filterIndexed<T>(
|
|
765
|
-
iterator: (elem: T, idx: number, list: Dictionary<T>) => Boolean,
|
|
766
|
-
): (list: Dictionary<T>) => Dictionary<T>;
|
|
767
|
-
filterIndexed<T>(iterator: (elem: T, idx: number, list: Filterable<T>) => Boolean, list: Filterable<T>): Filterable<T>;
|
|
768
|
-
filterIndexed<T>(iterator: (elem: T, idx: number, list: Filterable<T>) => Boolean): (list: Filterable<T>) => Filterable<Boolean>;
|
|
769
|
-
filterIndexed(iterator: (char: string, idx: number, str: string) => Boolean, str: string): string[];
|
|
770
|
-
filterIndexed(iterator: (char: string, idx: number, str: string) => Boolean): (str: string) => string[];
|
|
771
|
-
|
|
772
|
-
/**
|
|
773
|
-
* Given an `Iterable`(arrays are `Iterable`), or a promise of an `Iterable`,
|
|
774
|
-
* which produces promises (or a mix of promises and values),
|
|
775
|
-
* iterate over all the values in the `Iterable` into an array and
|
|
776
|
-
* reduce the array to a value using the given iterator function.
|
|
777
|
-
*/
|
|
778
|
-
reduceP<T, TResult, R extends T[]>(fn: (acc: TResult, elem: T) => TResult, acc: TResult, list: R): TResult;
|
|
779
|
-
reduceP<T, TResult, R extends T[]>(fn: (acc: TResult, elem: T) => TResult, acc: TResult): (list: R) => TResult;
|
|
780
|
-
reduceP<T, TResult, R extends T[]>(fn: (acc: TResult, elem: T) => TResult): {
|
|
781
|
-
(acc: TResult, list: R): TResult;
|
|
782
|
-
(acc: TResult): (list: R) => TResult
|
|
783
|
-
};
|
|
784
|
-
|
|
785
|
-
/**
|
|
786
|
-
* Given an `Iterable`(arrays are `Iterable`), or a promise of an `Iterable`,
|
|
787
|
-
* which produces promises (or a mix of promises and values),
|
|
788
|
-
* iterate over all the values in the `Iterable` into an array and
|
|
789
|
-
* reduce the array to a value using the given iterator function.
|
|
790
|
-
*
|
|
791
|
-
* Similar to {@link RA.reduceP|reduceP} except moves through the input list from the right to the left.
|
|
792
|
-
* The iterator function receives two values: (value, acc),
|
|
793
|
-
* while the arguments' order of reduceP's iterator function is (acc, value).
|
|
794
|
-
*/
|
|
795
|
-
reduceRightP<T, TResult, R extends T[]>(
|
|
796
|
-
fn: (elem: T, acc: TResult) => TResult,
|
|
797
|
-
acc: TResult,
|
|
798
|
-
list: R,
|
|
799
|
-
): TResult;
|
|
800
|
-
reduceRightP<T, TResult, R extends T[]>(
|
|
801
|
-
fn: (elem: T, acc: TResult) => TResult,
|
|
802
|
-
acc: TResult,
|
|
803
|
-
): (list: R) => TResult;
|
|
804
|
-
reduceRightP<T, TResult, R extends T[]>(fn: (elem: T, acc: TResult) => TResult): {
|
|
805
|
-
(acc: TResult, list: R): TResult;
|
|
806
|
-
(acc: TResult): (list: R) => TResult
|
|
807
|
-
};
|
|
808
|
-
/**
|
|
809
|
-
* Returns `true` if data structure focused by the given lens equals provided value.
|
|
810
|
-
*/
|
|
811
|
-
lensEq(lens: Function, value: any, data: any): boolean;
|
|
812
|
-
lensEq(lens: Function, value: any): (data: any) => boolean;
|
|
813
|
-
lensEq(lens: Function): (value: any) => (data: any) => boolean;
|
|
814
|
-
|
|
815
|
-
/**
|
|
816
|
-
* Returns `false` if data structure focused by the given lens equals provided value.
|
|
817
|
-
*/
|
|
818
|
-
lensNotEq(lens: Function, value: any, data: any): boolean;
|
|
819
|
-
lensNotEq(lens: Function, value: any): (data: any) => boolean;
|
|
820
|
-
lensNotEq(lens: Function): (value: any) => (data: any) => boolean;
|
|
821
|
-
|
|
822
|
-
/**
|
|
823
|
-
* Returns `true` if data structure focused by the given lens satisfies the predicate.
|
|
824
|
-
* Note that the predicate is expected to return boolean value and will be evaluated
|
|
825
|
-
* as `false` unless the predicate returns `true`.
|
|
826
|
-
*/
|
|
827
|
-
lensSatisfies(predicate: Function, lens: Function, data: any): boolean;
|
|
828
|
-
lensSatisfies(predicate: Function, lens: Function): (data: any) => boolean;
|
|
829
|
-
lensSatisfies(predicate: Function): (lens: Function) => (data: any) => boolean;
|
|
830
|
-
|
|
831
|
-
/**
|
|
832
|
-
* Returns `true` if data structure focused by the given lens doesn't satisfy the predicate.
|
|
833
|
-
* Note that the predicate is expected to return boolean value.
|
|
834
|
-
*/
|
|
835
|
-
lensNotSatisfy(predicate: Function, lens: Function, data: any): boolean;
|
|
836
|
-
lensNotSatisfy(predicate: Function, lens: Function): (data: any) => boolean;
|
|
837
|
-
lensNotSatisfy(predicate: Function): (lens: Function) => (data: any) => boolean;
|
|
838
|
-
|
|
839
|
-
/**
|
|
840
|
-
* Returns a "view" of the given data structure, determined by the given lens
|
|
841
|
-
* The lens's focus determines which portion of the data structure is visible.
|
|
842
|
-
* Returns the defaultValue if "view" is null, undefined or NaN; otherwise the "view" is returned.
|
|
843
|
-
*/
|
|
844
|
-
viewOr(defaultValue: any, lens: Function, data: any): any;
|
|
845
|
-
viewOr(defaultValue: any, lens: Function): (data: any) => any;
|
|
846
|
-
viewOr(defaultValue: any): (lens: Function) => (data: any) => any;
|
|
847
|
-
|
|
848
|
-
/**
|
|
849
|
-
* Defines an isomorphism that will work like a lens. It takes two functions.
|
|
850
|
-
* The function that converts and the function that recovers.
|
|
851
|
-
*/
|
|
852
|
-
lensIso: {
|
|
853
|
-
(to: Function, from: Function): Function
|
|
854
|
-
(to: Function): (from: Function) => Function
|
|
855
|
-
from(lens: Function): Function,
|
|
856
|
-
};
|
|
857
|
-
|
|
858
|
-
/**
|
|
859
|
-
* Creates a [Traversable](https://github.com/fantasyland/fantasy-land#traversable) lens
|
|
860
|
-
* from an [Applicative](https://github.com/fantasyland/fantasy-land#applicative)-returning function.
|
|
861
|
-
*
|
|
862
|
-
* When executed, it maps an [Applicative](https://github.com/fantasyland/fantasy-land#applicative)-returning
|
|
863
|
-
* function over a [Traversable](https://github.com/fantasyland/fantasy-land#traversable),
|
|
864
|
-
* then uses [`sequence`](#sequence) to transform the resulting Traversable of Applicative
|
|
865
|
-
* into an Applicative of Traversable.
|
|
866
|
-
*
|
|
867
|
-
* Dispatches to the `traverse` method of the third argument, if present.
|
|
868
|
-
*/
|
|
869
|
-
lensTraverse(of: Function): Function;
|
|
870
|
-
|
|
871
|
-
/**
|
|
872
|
-
* Returns true if the specified object property is not equal,
|
|
873
|
-
* in R.equals terms, to the given value; false otherwise.
|
|
874
|
-
*/
|
|
875
|
-
propNotEq(prop: string | number, value: any, obj: object): boolean;
|
|
876
|
-
propNotEq(prop: string | number, value: any): (obj: object) => boolean;
|
|
877
|
-
propNotEq(prop: string | number): {
|
|
878
|
-
(value: any, obj: object): boolean;
|
|
879
|
-
(value: any): (obj: object) => boolean;
|
|
880
|
-
};
|
|
881
|
-
|
|
882
|
-
/**
|
|
883
|
-
* Determines whether a nested path on an object doesn't have a specific value,
|
|
884
|
-
* in R.equals terms. Most likely used to filter a list.
|
|
885
|
-
*/
|
|
886
|
-
pathNotEq(path: Array<string | number>, value: any, obj: object): boolean;
|
|
887
|
-
pathNotEq(path: Array<string | number>, value: any): (obj: object) => boolean;
|
|
888
|
-
pathNotEq(path: Array<string | number>): {
|
|
889
|
-
(value: any, obj: object): boolean;
|
|
890
|
-
(value: any): (obj: object) => boolean;
|
|
891
|
-
};
|
|
892
|
-
|
|
893
|
-
/**
|
|
894
|
-
* Checks if `value` is between `low` and up to but not including `high`.
|
|
895
|
-
*/
|
|
896
|
-
inRange(low: number, high: number, value: number): boolean;
|
|
897
|
-
inRange(low: number, high: number): (value: number) => boolean;
|
|
898
|
-
inRange(low: number): {
|
|
899
|
-
(high: number, value: number): boolean;
|
|
900
|
-
(high: number): (value: number) => boolean;
|
|
901
|
-
};
|
|
902
|
-
|
|
903
|
-
/**
|
|
904
|
-
* Spreads object under property path onto provided object.
|
|
905
|
-
*/
|
|
906
|
-
spreadPath(path: Array<string | number>, obj: object): object;
|
|
907
|
-
spreadPath(path: Array<string | number>): (obj: object) => object;
|
|
908
|
-
|
|
909
|
-
/**
|
|
910
|
-
* Spreads object under property onto provided object.
|
|
911
|
-
*/
|
|
912
|
-
spreadProp(prop: string | number, obj: object): object;
|
|
913
|
-
spreadProp(prop: string | number): (obj: object) => object;
|
|
914
|
-
|
|
915
|
-
/**
|
|
916
|
-
* Flattens a property path so that its fields are spread out into the provided object.
|
|
917
|
-
*/
|
|
918
|
-
flattenPath(path: Array<string | number>, obj: object): object;
|
|
919
|
-
flattenPath(path: Array<string | number>): (obj: object) => object;
|
|
920
|
-
|
|
921
|
-
/**
|
|
922
|
-
* Flattens a property so that its fields are spread out into the provided object.
|
|
923
|
-
*/
|
|
924
|
-
flattenProp(prop: string | number, obj: object): object;
|
|
925
|
-
flattenProp(prop: string | number): (obj: object) => object;
|
|
926
|
-
|
|
927
|
-
/**
|
|
928
|
-
* Creates a new object out of a list of keys and a list of values by applying the function
|
|
929
|
-
* to each equally-positioned pair in the lists.
|
|
930
|
-
* Key/value pairing is truncated to the length of the shorter of the two lists.
|
|
931
|
-
*/
|
|
932
|
-
zipObjWith<T, U, V>(fn: (value: T, key: U) => [string, V], keys: U[], values: T[]): { [k: string]: V };
|
|
933
|
-
zipObjWith<T, U, V>(fn: (value: T, key: U) => [string, V]): (keys: U[], values: T[]) => { [k: string]: V };
|
|
934
|
-
zipObjWith<T, U, V>(fn: (value: T, key: U) => [string, V]): {
|
|
935
|
-
(keys: U[], values: T[]): { [k: string]: V };
|
|
936
|
-
(keys: U[]): (values: T[]) => { [k: string]: V };
|
|
937
|
-
};
|
|
938
|
-
|
|
939
|
-
/**
|
|
940
|
-
* Creates a new list out of the supplied object by applying the function to each key/value pairing.
|
|
941
|
-
*/
|
|
942
|
-
unzipObjWith<T, U, V>(fn: (v: T, k: string) => [U, V], obj: { [k: string]: T }): [U[], V[]];
|
|
943
|
-
unzipObjWith<T, U, V>(fn: (v: T, k: string) => [U, V]): (obj: { [k: string]: T }) => [U[], V[]];
|
|
944
|
-
|
|
945
|
-
/**
|
|
946
|
-
* Composable shortcut for `Promise.all`.
|
|
947
|
-
*
|
|
948
|
-
* The `allP` method returns a single Promise that resolves when all of the promises
|
|
949
|
-
* in the iterable argument have resolved or when the iterable argument contains no promises.
|
|
950
|
-
* It rejects with the reason of the first promise that rejects.
|
|
951
|
-
*/
|
|
952
|
-
allP<T>(iterable: Iterable<T>): Promise<T[]>;
|
|
953
|
-
|
|
954
|
-
/**
|
|
955
|
-
* Returns a Promise that is resolved with an array of reasons when all of the provided Promises reject, or rejected when any Promise is resolved.
|
|
956
|
-
* This pattern is like allP, but fulfillments and rejections are transposed - rejections become the fulfillment values and vice versa.
|
|
957
|
-
*/
|
|
958
|
-
noneP<T>(iterable: Iterable<T | Promise<T>>): Promise<T[]>;
|
|
959
|
-
|
|
960
|
-
/**
|
|
961
|
-
* allSettledP returns a promise that is fulfilled with an array of promise state snapshots,
|
|
962
|
-
* but only after all the original promises have settled, i.e. become either fulfilled or rejected.
|
|
963
|
-
* We say that a promise is settled if it is not pending, i.e. if it is either fulfilled or rejected.
|
|
964
|
-
*/
|
|
965
|
-
allSettledP<T>(iterable: Iterable<T>): Promise<Array<SettledPromise<T>>>;
|
|
966
|
-
|
|
967
|
-
/**
|
|
968
|
-
* Returns a promise that is fulfilled by the first given promise to be fulfilled,
|
|
969
|
-
* or rejected with an array of rejection reasons if all of the given promises are rejected.
|
|
970
|
-
*/
|
|
971
|
-
anyP<T>(iterable: Iterable<T>): Promise<T>;
|
|
972
|
-
firstP<T>(iterable: Iterable<T>): Promise<T>; // alias
|
|
973
|
-
|
|
974
|
-
/**
|
|
975
|
-
* Returns a promise that is fulfilled by the last given promise to be fulfilled,
|
|
976
|
-
* or rejected with an array of rejection reasons if all of the given promises are rejected.
|
|
977
|
-
*/
|
|
978
|
-
lastP<T>(iterable: Iterable<T>): Promise<T>;
|
|
979
|
-
|
|
980
|
-
/**
|
|
981
|
-
* Composable shortcut for `Promise.resolve`.
|
|
982
|
-
*
|
|
983
|
-
* Returns a Promise object that is resolved with the given value.
|
|
984
|
-
* If the value is a thenable (i.e. has a "then" method), the returned promise will
|
|
985
|
-
* "follow" that thenable, adopting its eventual state.
|
|
986
|
-
*/
|
|
987
|
-
resolveP<T>(value?: T): Promise<T>;
|
|
988
|
-
|
|
989
|
-
/**
|
|
990
|
-
* Composable shortcut for `Promise.reject`.
|
|
991
|
-
*
|
|
992
|
-
* Returns a Promise object that is rejected with the given reason.
|
|
993
|
-
*/
|
|
994
|
-
rejectP<T>(value?: T): Promise<T>;
|
|
995
|
-
|
|
996
|
-
/**
|
|
997
|
-
* Creates a promise which resolves/rejects after the specified milliseconds.
|
|
998
|
-
*/
|
|
999
|
-
delayP: {
|
|
1000
|
-
(milliseconds: number): Promise<undefined>
|
|
1001
|
-
<T>(options: { timeout: number, value: T }): Promise<T>
|
|
1002
|
-
reject(milliseconds: number): Promise<undefined>
|
|
1003
|
-
reject<T>(options: { timeout: number, value: T }): Promise<T>
|
|
1004
|
-
};
|
|
1005
|
-
|
|
1006
|
-
/**
|
|
1007
|
-
* Composable shortcut for `Promise.catch`.
|
|
1008
|
-
* The catchP function returns a Promise. It takes two arguments: a callback function for the rejections of the Promise
|
|
1009
|
-
* and the promise instance itself.
|
|
1010
|
-
*/
|
|
1011
|
-
catchP<A, B = unknown>(onRejected: (error: any) => B | Promise<B>, promise: Promise<A>): Promise<A | B>;
|
|
1012
|
-
catchP<A, B = unknown>(onRejected: (error: any) => B | Promise<B>): (promise: Promise<A>) => Promise<A | B>;
|
|
1013
|
-
|
|
1014
|
-
/**
|
|
1015
|
-
* Composable shortcut for `Promise.then` that allows for success and failure call backs.
|
|
1016
|
-
* The thenCatchP function returns a Promise. It takes three arguments: a callback function for the success of the Promise,
|
|
1017
|
-
* a callback function for the failure of the Promise, and the promise instance itself.
|
|
1018
|
-
*/
|
|
1019
|
-
thenCatchP<A, B>(onFulfilled: Function, onRejected: (error: any) => B | Promise<B>, thenable: Promise<A>): Promise<A | B>;
|
|
1020
|
-
thenCatchP<A, B>(onFulfilled: Function, onRejected: (error: any) => B | Promise<B>): (thenable: Promise<A>) => Promise<A | B>;
|
|
1021
|
-
thenCatchP<A, B>(onFulfilled: Function): (onRejected: (error: any) => B | Promise<B>) => (thenable: Promise<A>) => Promise<A | B>;
|
|
1022
|
-
|
|
1023
|
-
/**
|
|
1024
|
-
* Runs the given list of functions in order with the supplied object, then returns the object.
|
|
1025
|
-
* Also known as the normal order sequencing combinator.
|
|
1026
|
-
*
|
|
1027
|
-
* Acts as a transducer if a transformer is given as second parameter.
|
|
1028
|
-
*/
|
|
1029
|
-
seq<T>(fns: Function[], x: T): T;
|
|
1030
|
-
seq<T>(fns: Function[]): (x: T) => T;
|
|
1031
|
-
sequencing<T>(fns: Function[], x: T): T; // alias
|
|
1032
|
-
sequencing<T>(fns: Function[]): (x: T) => T; // alias
|
|
1033
|
-
|
|
1034
|
-
/**
|
|
1035
|
-
* Returns the elements of the given list or string (or object with a slice method)
|
|
1036
|
-
* from fromIndex (inclusive).
|
|
1037
|
-
* Dispatches to the slice method of the third argument, if present.
|
|
1038
|
-
*/
|
|
1039
|
-
sliceFrom<T>(fromIndex: number, list: string | T[]): string | T[];
|
|
1040
|
-
sliceFrom(fromIndex: number): <T>(list: string | T[]) => string | T[];
|
|
1041
|
-
|
|
1042
|
-
/**
|
|
1043
|
-
* Returns the elements of the given list or string (or object with a slice method)
|
|
1044
|
-
* to toIndex (exclusive).
|
|
1045
|
-
* Dispatches to the slice method of the second argument, if present.
|
|
1046
|
-
*/
|
|
1047
|
-
sliceTo<T>(toIndex: number, list: string | T[]): string | T[];
|
|
1048
|
-
sliceTo(toIndex: number): <T>(list: string | T[]) => string | T[];
|
|
1049
|
-
|
|
1050
|
-
/**
|
|
1051
|
-
* Returns a partial copy of an array omitting the indexes specified.
|
|
1052
|
-
*/
|
|
1053
|
-
omitIndexes<T>(indexes: number[], list: T[]): T[];
|
|
1054
|
-
omitIndexes(indexes: number[]): <T>(list: T[]) => T[];
|
|
1055
|
-
|
|
1056
|
-
/**
|
|
1057
|
-
* Returns `true` if the supplied list or string has a length greater than `valueLength`.
|
|
1058
|
-
*/
|
|
1059
|
-
lengthGt<T>(valueLength: number, list: string | T[]): boolean;
|
|
1060
|
-
lengthGt(valueLength: number): <T>(list: string | T[]) => boolean;
|
|
1061
|
-
|
|
1062
|
-
/**
|
|
1063
|
-
* Returns `true` if the supplied list or string has a length less than `valueLength`.
|
|
1064
|
-
*/
|
|
1065
|
-
lengthLt<T>(valueLength: number, list: string | T[]): boolean;
|
|
1066
|
-
lengthLt(valueLength: number): <T>(list: string | T[]) => boolean;
|
|
1067
|
-
|
|
1068
|
-
/**
|
|
1069
|
-
* Returns `true` if the supplied list or string has a length less than or equal to
|
|
1070
|
-
* `valueLength`.
|
|
1071
|
-
*/
|
|
1072
|
-
lengthLte<T>(valueLength: number, list: string | T[]): boolean;
|
|
1073
|
-
lengthLte(valueLength: number): <T>(list: string | T[]) => boolean;
|
|
1074
|
-
|
|
1075
|
-
/**
|
|
1076
|
-
* Returns `true` if the supplied list or string has a length greater than or equal to
|
|
1077
|
-
* `valueLength`.
|
|
1078
|
-
*/
|
|
1079
|
-
lengthGte<T>(valueLength: number, list: string | T[]): boolean;
|
|
1080
|
-
lengthGte(valueLength: number): <T>(list: string | T[]) => boolean;
|
|
1081
|
-
|
|
1082
|
-
/**
|
|
1083
|
-
* Returns `true` if the supplied list or string has a length equal to `valueLength`.
|
|
1084
|
-
*/
|
|
1085
|
-
lengthEq<T>(valueLength: number, list: string | T[]): boolean;
|
|
1086
|
-
lengthEq(valueLength: number): <T>(list: string | T[]) => boolean;
|
|
1087
|
-
|
|
1088
|
-
/**
|
|
1089
|
-
* Returns `true` if the supplied list or string has a length not equal to `valueLength`.
|
|
1090
|
-
*/
|
|
1091
|
-
lengthNotEq<T>(valueLength: number, list: string | T[]): boolean;
|
|
1092
|
-
lengthNotEq(valueLength: number): <T>(list: string | T[]) => boolean;
|
|
1093
|
-
|
|
1094
|
-
/**
|
|
1095
|
-
* Returns true if all items in the list are equivalent using `R.equals` for equality comparisons.
|
|
1096
|
-
*/
|
|
1097
|
-
allEqual<T>(list: T[]): boolean;
|
|
1098
|
-
|
|
1099
|
-
/**
|
|
1100
|
-
* Returns `true` if its arguments are not equivalent, `false` otherwise. Handles
|
|
1101
|
-
* cyclical data structures.
|
|
1102
|
-
*
|
|
1103
|
-
* Dispatches symmetrically to the `equals` methods of both arguments, if
|
|
1104
|
-
* present.
|
|
1105
|
-
*/
|
|
1106
|
-
notEqual(a: any, b: any): boolean;
|
|
1107
|
-
notEqual(a: any): (b: any) => boolean;
|
|
1108
|
-
|
|
1109
|
-
/**
|
|
1110
|
-
* Constructs and returns a new string which contains the specified
|
|
1111
|
-
* number of copies of the string on which it was called, concatenated together.
|
|
1112
|
-
*/
|
|
1113
|
-
repeatStr(value: string, count: number): string;
|
|
1114
|
-
repeatStr(value: string): (count: number) => string;
|
|
1115
|
-
|
|
1116
|
-
/*
|
|
1117
|
-
* Returns true if all items in the list are equivalent using `R.identical` for equality comparisons.
|
|
1118
|
-
*/
|
|
1119
|
-
allIdentical<T>(list: T[]): boolean;
|
|
1120
|
-
|
|
1121
|
-
/*
|
|
1122
|
-
* Returns true if all items in the list are equivalent to user provided value using `R.identical` for equality comparisons.
|
|
1123
|
-
*/
|
|
1124
|
-
allIdenticalTo<T>(val: T, list: T[]): boolean;
|
|
1125
|
-
allIdenticalTo<T>(val: T): (list: T[]) => boolean;
|
|
1126
|
-
|
|
1127
|
-
/*
|
|
1128
|
-
* Returns true if all items in the list are equivalent to user provided value using `R.equals` for equality comparisons.
|
|
1129
|
-
*/
|
|
1130
|
-
allEqualTo<T>(val: T, list: T[]): boolean;
|
|
1131
|
-
allEqualTo<T>(val: T): <T>(list: T[]) => boolean;
|
|
1132
|
-
|
|
1133
|
-
/*
|
|
1134
|
-
* Flattens the list to the specified depth.
|
|
1135
|
-
*/
|
|
1136
|
-
flattenDepth<T>(depth: number, list: T[]): T[];
|
|
1137
|
-
flattenDepth(depth: number): (list: any[]) => any[];
|
|
1138
|
-
|
|
1139
|
-
/**
|
|
1140
|
-
* Checks if input value is a `thenable`.
|
|
1141
|
-
* `thenable` is an object or function that defines a `then` method.
|
|
1142
|
-
*/
|
|
1143
|
-
isThenable(val: any): boolean;
|
|
1144
|
-
|
|
1145
|
-
/**
|
|
1146
|
-
* Checks if input value is a native `Promise`.
|
|
1147
|
-
* The Promise object represents the eventual completion (or failure)
|
|
1148
|
-
* of an asynchronous operation, and its resulting value.
|
|
1149
|
-
*/
|
|
1150
|
-
isPromise(val: any): val is Promise<any>;
|
|
1151
|
-
|
|
1152
|
-
/**
|
|
1153
|
-
* Checks if input value is the Boolean primitive `true`. Will return false for Boolean
|
|
1154
|
-
* objects created using the `Boolean` function as a constructor.
|
|
1155
|
-
*/
|
|
1156
|
-
isTrue(val: any): boolean;
|
|
1157
|
-
|
|
1158
|
-
/**
|
|
1159
|
-
* Checks if input value is the Boolean primitive `false`. Will return false for Boolean objects created using the `Boolean` function as a constructor.
|
|
1160
|
-
*/
|
|
1161
|
-
isFalse(val: any): boolean;
|
|
1162
|
-
|
|
1163
|
-
/**
|
|
1164
|
-
* In JavaScript, a `truthy` value is a value that is considered true
|
|
1165
|
-
* when evaluated in a Boolean context. All values are truthy unless
|
|
1166
|
-
* they are defined as falsy (i.e., except for `false`, `0`, `""`, `null`, `undefined`, and `NaN`).
|
|
1167
|
-
*/
|
|
1168
|
-
isTruthy(val: any): boolean;
|
|
1169
|
-
|
|
1170
|
-
/**
|
|
1171
|
-
* A falsy value is a value that translates to false when evaluated in a Boolean context.
|
|
1172
|
-
* Falsy values are `false`, `0`, `""`, `null`, `undefined`, and `NaN`.
|
|
1173
|
-
*/
|
|
1174
|
-
isFalsy(val: any): boolean;
|
|
1175
|
-
|
|
1176
|
-
/**
|
|
1177
|
-
* Returns the second argument if predicate function returns `true`,
|
|
1178
|
-
* otherwise the third argument is returned.
|
|
1179
|
-
*/
|
|
1180
|
-
defaultWhen<DefVal, Val>(predicate: Function, defaultVal: DefVal, val: Val): DefVal | Val;
|
|
1181
|
-
defaultWhen<DefVal, Val>(predicate: Function, defaultVal: DefVal): (val: Val) => DefVal | Val;
|
|
1182
|
-
defaultWhen(predicate: Function): <DefVal, Val>(defaultVal: DefVal) => (val: Val) => DefVal | Val;
|
|
1183
|
-
|
|
1184
|
-
/**
|
|
1185
|
-
* Returns the first element of the list which matches the predicate.
|
|
1186
|
-
* Returns default value if no element matches or matched element is `null`, `undefined` or `NaN`.
|
|
1187
|
-
* Dispatches to the find method of the second argument, if present.
|
|
1188
|
-
* Acts as a transducer if a transformer is given in list position.
|
|
1189
|
-
*/
|
|
1190
|
-
findOr<DefVal, T>(defaultVal: DefVal, predicate: (element: T) => boolean, list: ReadonlyArray<T>): T | DefVal;
|
|
1191
|
-
findOr<DefVal, T>(defaultVal: DefVal, predicate: (element: T) => boolean): (list: ReadonlyArray<T>) => T | DefVal;
|
|
1192
|
-
findOr<DefVal, T>(defaultVal: DefVal): {
|
|
1193
|
-
(predicate: (element: T) => boolean, list: ReadonlyArray<T>): T | DefVal;
|
|
1194
|
-
(predicate: (element: T) => boolean): (list: ReadonlyArray<T>) => T | DefVal;
|
|
1195
|
-
};
|
|
1196
|
-
|
|
1197
|
-
/**
|
|
1198
|
-
* Y-combinator
|
|
1199
|
-
*
|
|
1200
|
-
* The Y combinator is an interesting function which only works with functional languages,
|
|
1201
|
-
* showing how recursion can still be done even without any variable or function declarations,
|
|
1202
|
-
* only functions and parameters
|
|
1203
|
-
*/
|
|
1204
|
-
Y(le: Function): Function;
|
|
1205
|
-
|
|
1206
|
-
/**
|
|
1207
|
-
* A function which calls the two provided functions and returns the complement of `&&`ing
|
|
1208
|
-
* the results. It returns true if the first function is false-y and the complement of the
|
|
1209
|
-
* second function otherwise. Note that this is short-circuited, meaning that the second
|
|
1210
|
-
* function will not be invoked if the first returns a false-y value. In short it will
|
|
1211
|
-
* return true unless both predicates return true.
|
|
1212
|
-
*
|
|
1213
|
-
* In addition to functions, `RA.notBoth` also accepts any fantasy-land compatible
|
|
1214
|
-
* applicative functor.
|
|
1215
|
-
*/
|
|
1216
|
-
notBoth(firstPredicate: Function, secondPredicate: Function): Function;
|
|
1217
|
-
|
|
1218
|
-
/**
|
|
1219
|
-
* A function which calls the two provided functions and returns the complement of `||`ing
|
|
1220
|
-
* the results. It returns false if the first function is truth-y and the complement of the
|
|
1221
|
-
* second function otherwise. Note that this is short-circuited, meaning that the second
|
|
1222
|
-
* function will not be invoked if the first returns a truth-y value. In short it will
|
|
1223
|
-
* return true if neither predicate returns true.
|
|
1224
|
-
*
|
|
1225
|
-
* In addition to functions, `RA.neither` also accepts any fantasy-land compatible
|
|
1226
|
-
* applicative functor.
|
|
1227
|
-
*/
|
|
1228
|
-
neither(firstPredicate: Function, secondPredicate: Function): Function;
|
|
1229
|
-
|
|
1230
|
-
/**
|
|
1231
|
-
* Returns false if both arguments are truesy; true otherwise.
|
|
1232
|
-
*/
|
|
1233
|
-
nand(a: any, b: any): Boolean;
|
|
1234
|
-
nand(a: any): (b: any) => Boolean;
|
|
1235
|
-
|
|
1236
|
-
/**
|
|
1237
|
-
* Returns true if both arguments are falsy; false otherwise.
|
|
1238
|
-
*/
|
|
1239
|
-
nor(a: any, b: any): Boolean;
|
|
1240
|
-
nor(a: any): (b: any) => Boolean;
|
|
1241
|
-
|
|
1242
|
-
/**
|
|
1243
|
-
* Takes a list of predicates and returns a predicate that returns true for a given list of
|
|
1244
|
-
* arguments if one or more of the provided predicates is not satisfied by those arguments.
|
|
1245
|
-
* It is the complement of Ramda's allPass.
|
|
1246
|
-
*
|
|
1247
|
-
* The function returned is a curried function whose arity matches that of the
|
|
1248
|
-
* highest-arity predicate.
|
|
1249
|
-
*/
|
|
1250
|
-
notAllPass(predicates: Function[]): Function;
|
|
1251
|
-
|
|
1252
|
-
/**
|
|
1253
|
-
* Takes a list of predicates and returns a predicate that returns true for a given list of
|
|
1254
|
-
* arguments if none of the provided predicates are satisfied by those arguments. It is the
|
|
1255
|
-
* complement of Ramda's anyPass.
|
|
1256
|
-
*
|
|
1257
|
-
* The function returned is a curried function whose arity matches that of the
|
|
1258
|
-
* highest-arity predicate.
|
|
1259
|
-
*/
|
|
1260
|
-
nonePass(predicates: Function[]): Function;
|
|
1261
|
-
|
|
1262
|
-
/**
|
|
1263
|
-
* Takes a combining predicate and a list of functions and returns a function which will map
|
|
1264
|
-
* the arguments it receives to the list of functions and returns the result of passing the
|
|
1265
|
-
* values returned from each function to the combining predicate. A combining predicate is a
|
|
1266
|
-
* function that combines a list of Boolean values into a single Boolean value, such as
|
|
1267
|
-
* `R.any` or `R.all`. It will test each value using `RA.isTruthy`, meaning the functions
|
|
1268
|
-
* don't necessarily have to be predicates.
|
|
1269
|
-
*
|
|
1270
|
-
* The function returned is curried to the number of functions supplied, and if called with
|
|
1271
|
-
* more arguments than functions, any remaining arguments are passed in to the combining
|
|
1272
|
-
* predicate untouched.
|
|
1273
|
-
*/
|
|
1274
|
-
argsPass<T>(combiningPredicate: (fn: (a: T) => boolean) => (list: T[]) => boolean, predicates: Pred[]): Pred;
|
|
1275
|
-
argsPass<T>(combiningPredicate: (fn: (a: T) => boolean) => (list: T[]) => boolean): (predicates: Pred[]) => Pred;
|
|
1276
|
-
|
|
1277
|
-
/**
|
|
1278
|
-
* Returns a function which is called with the given arguments. If any of the given arguments are null or undefined,
|
|
1279
|
-
* the corresponding default value for that argument is used instead.
|
|
1280
|
-
*/
|
|
1281
|
-
fnull(fn: Function, defaults: any[]): Function;
|
|
1282
|
-
fnull(fn: Function): (defaults: any[]) => Function;
|
|
1283
|
-
|
|
1284
|
-
/**
|
|
1285
|
-
* Accepts a function with any arity and returns a function with arity of zero.
|
|
1286
|
-
* The returned function ignores any arguments supplied to it.
|
|
1287
|
-
*/
|
|
1288
|
-
dropArgs(fn: Function): Function;
|
|
1289
|
-
|
|
1290
|
-
/**
|
|
1291
|
-
* Creates an array with all falsy values removed.
|
|
1292
|
-
* The values false, null, 0, "", undefined, and NaN are falsy.
|
|
1293
|
-
*/
|
|
1294
|
-
compact<T>(list: T[]): Array<Exclude<NonNullable<T>, false | '' | 0>>;
|
|
1295
|
-
|
|
1296
|
-
/**
|
|
1297
|
-
* Returns a new list containing the contents of the given list, followed by the given
|
|
1298
|
-
* element. Like {@link http://ramdajs.com/docs/#append|R.append} but with argument order
|
|
1299
|
-
* reversed.
|
|
1300
|
-
*/
|
|
1301
|
-
appendFlipped<T>(list: T[], val: any): T[];
|
|
1302
|
-
appendFlipped<T>(list: T[]): (val: any) => T[];
|
|
1303
|
-
|
|
1304
|
-
/**
|
|
1305
|
-
* Returns true if the specified value is equal, in R.equals terms,
|
|
1306
|
-
* to at least one element of the given list or false otherwise.
|
|
1307
|
-
* Given list can be a string.
|
|
1308
|
-
*
|
|
1309
|
-
* Like {@link http://ramdajs.com/docs/#contains|R.includes} but with argument order reversed.
|
|
1310
|
-
*/
|
|
1311
|
-
included<T>(list: T[], val: T): boolean;
|
|
1312
|
-
included<T>(list: T[]): (val: T) => boolean;
|
|
1313
|
-
|
|
1314
|
-
/**
|
|
1315
|
-
* Can be used as a way to compose multiple invokers together to form polymorphic functions,
|
|
1316
|
-
* or functions that exhibit different behaviors based on their argument(s).
|
|
1317
|
-
* Consumes dispatching functions and keep trying to invoke each in turn, until a non-nil value is returned.
|
|
1318
|
-
*
|
|
1319
|
-
* Accepts a list of dispatching functions and returns a new function.
|
|
1320
|
-
* When invoked, this new function is applied to some arguments,
|
|
1321
|
-
* each dispatching function is applied to those same arguments until one of the
|
|
1322
|
-
* dispatching functions returns a non-nil value.
|
|
1323
|
-
*/
|
|
1324
|
-
dispatch(functions: Function[]): Function;
|
|
1325
|
-
|
|
1326
|
-
/**
|
|
1327
|
-
* Returns a new list with the item at the position `fromIdx` moved to the position `toIdx`.
|
|
1328
|
-
* If the `toIdx` is out of the `list` range, the item will be placed at the last position
|
|
1329
|
-
* of the `list`. When negative indices are provided, the behavior of the move is
|
|
1330
|
-
* unspecified.
|
|
1331
|
-
*/
|
|
1332
|
-
move<T>(fromIdx: number, toIdx: number, list: T[]): T[];
|
|
1333
|
-
move<T>(fromIdx: number): (toIdx: number, list: T[]) => T[];
|
|
1334
|
-
move<T>(fromIdx: number): {
|
|
1335
|
-
(toIdx: number, list: T[]): T[];
|
|
1336
|
-
(toIdx: number): (list: T[]) => T[];
|
|
1337
|
-
};
|
|
1338
|
-
|
|
1339
|
-
/**
|
|
1340
|
-
* Returns the value of a number rounded to the nearest integer.
|
|
1341
|
-
*/
|
|
1342
|
-
round(val: number): number;
|
|
1343
|
-
|
|
1344
|
-
/**
|
|
1345
|
-
* Subtracts its first argument from its second argument.
|
|
1346
|
-
*/
|
|
1347
|
-
subtractNum(subtrahend: number, minuend: number): number;
|
|
1348
|
-
subtractNum(subtrahend: number): (minuend: number) => number;
|
|
1349
|
-
|
|
1350
|
-
/**
|
|
1351
|
-
* Returns the smallest integer greater than or equal to a given number.
|
|
1352
|
-
*
|
|
1353
|
-
* Note: ceil(null) returns integer 0 and does not give a NaN error.
|
|
1354
|
-
*/
|
|
1355
|
-
ceil(val: number): number;
|
|
1356
|
-
|
|
1357
|
-
/**
|
|
1358
|
-
* Returns the largest integer less than or equal to a given number.
|
|
1359
|
-
*
|
|
1360
|
-
* Note: floor(null) returns integer 0 and do not give a NaN error.
|
|
1361
|
-
*/
|
|
1362
|
-
floor(val: number): number;
|
|
1363
|
-
|
|
1364
|
-
/**
|
|
1365
|
-
* Returns the integer part of a number by removing any fractional digits.
|
|
1366
|
-
*
|
|
1367
|
-
*/
|
|
1368
|
-
trunc(val: number): number;
|
|
1369
|
-
|
|
1370
|
-
/**
|
|
1371
|
-
* Returns the sign of a number, indicating whether the number is positive, negative or zero.
|
|
1372
|
-
*/
|
|
1373
|
-
sign(val: number): number;
|
|
1374
|
-
|
|
1375
|
-
/**
|
|
1376
|
-
* Takes a generator function and returns an async function.
|
|
1377
|
-
* The async function returned is a curried function whose arity matches that of the generator function.
|
|
1378
|
-
*
|
|
1379
|
-
* Note: This function is handy for environments that does support generators but doesn't support async/await.
|
|
1380
|
-
*/
|
|
1381
|
-
async(generatorFn: Function): Function;
|
|
1382
|
-
|
|
1383
|
-
/**
|
|
1384
|
-
* Replace all substring matches in a string with a replacement.
|
|
1385
|
-
*/
|
|
1386
|
-
replaceAll(searchValue: string | RegExp, replaceValue: string, str: string): string;
|
|
1387
|
-
replaceAll(searchValue: string | RegExp): (replaceValue: string, str: string) => string;
|
|
1388
|
-
replaceAll(searchValue: string | RegExp): {
|
|
1389
|
-
(replaceValue: string, str: string): string;
|
|
1390
|
-
(replaceValue: string): (str: string) => string;
|
|
1391
|
-
};
|
|
1392
|
-
|
|
1393
|
-
/**
|
|
1394
|
-
* Escapes the RegExp special characters.
|
|
1395
|
-
*/
|
|
1396
|
-
escapeRegExp(val: string): string;
|
|
1397
|
-
|
|
1398
|
-
/**
|
|
1399
|
-
* Divides two numbers, where the second number is divided by the first number.
|
|
1400
|
-
*/
|
|
1401
|
-
divideNum(divisor: number, dividend: number): number;
|
|
1402
|
-
divideNum(divisor: number): (dividend: number) => number;
|
|
1403
|
-
|
|
1404
|
-
/**
|
|
1405
|
-
* Identity type.
|
|
1406
|
-
*/
|
|
1407
|
-
Identity: Function;
|
|
1408
|
-
|
|
1409
|
-
/**
|
|
1410
|
-
* Converts value to an array.
|
|
1411
|
-
*/
|
|
1412
|
-
toArray<T>(iterable: Iterable<T> | T): any[];
|
|
1413
|
-
|
|
1414
|
-
/**
|
|
1415
|
-
* Returns true if all items in the list are unique. `R.equals` is used to determine equality.
|
|
1416
|
-
*/
|
|
1417
|
-
allUnique<T>(list: T[]): boolean;
|
|
1418
|
-
|
|
1419
|
-
/**
|
|
1420
|
-
* Returns true if at least one item of the list is repeated. `R.equals` is used to determine equality.
|
|
1421
|
-
*/
|
|
1422
|
-
notAllUnique<T>(list: T[]): boolean;
|
|
1423
|
-
|
|
1424
|
-
/**
|
|
1425
|
-
* Removes whitespace from the beginning of a string
|
|
1426
|
-
*/
|
|
1427
|
-
trimStart(value: string): string;
|
|
1428
|
-
trimLeft(value: string): string;
|
|
1429
|
-
|
|
1430
|
-
/**
|
|
1431
|
-
* Removes whitespace from the end of a string.
|
|
1432
|
-
*/
|
|
1433
|
-
trimEnd(value: string): string;
|
|
1434
|
-
trimRight(value: string): string;
|
|
1435
|
-
|
|
1436
|
-
/**
|
|
1437
|
-
* Removes specified characters from the end of a string.
|
|
1438
|
-
*/
|
|
1439
|
-
trimCharsEnd(chars: string, value: string): string;
|
|
1440
|
-
trimCharsEnd(chars: string): (value: string) => string;
|
|
1441
|
-
|
|
1442
|
-
/**
|
|
1443
|
-
* Removes specified characters from the beginning of a string.
|
|
1444
|
-
*/
|
|
1445
|
-
trimCharsStart(chars: string, value: string): string;
|
|
1446
|
-
trimCharsStart(chars: string): (value: string) => string;
|
|
1447
|
-
|
|
1448
|
-
/**
|
|
1449
|
-
* The function pads the current string with a given string
|
|
1450
|
-
* (repeated, if needed) so that the resulting string reaches a given length.
|
|
1451
|
-
* The padding is applied from the end of the current string.
|
|
1452
|
-
*/
|
|
1453
|
-
padCharsEnd(padString: string, targetLength: number, value: string): string;
|
|
1454
|
-
padCharsEnd(padString: string, targetLength: number): (value: string) => string;
|
|
1455
|
-
padCharsEnd(padString: string): (targetLength: number, value: string) => string;
|
|
1456
|
-
|
|
1457
|
-
/**
|
|
1458
|
-
* The function pads the current string with an empty string
|
|
1459
|
-
* so that the resulting string reaches a given length.
|
|
1460
|
-
* The padding is applied from the end of the current string.
|
|
1461
|
-
*/
|
|
1462
|
-
padEnd(targetLength: number, value: string): string;
|
|
1463
|
-
padEnd(targetLength: number): (value: string) => string;
|
|
1464
|
-
|
|
1465
|
-
/**
|
|
1466
|
-
* The function pads the current string with a given string
|
|
1467
|
-
* (repeated, if needed) so that the resulting string reaches a given lenght.
|
|
1468
|
-
* The padding is applied to the start of the current string.
|
|
1469
|
-
*/
|
|
1470
|
-
padCharsStart(padString: string, targetLength: number, value: string): string;
|
|
1471
|
-
padCharsStart(padString: string, targetLength: number): (value: string) => string;
|
|
1472
|
-
padCharsStart(padString: string): (targetLength: number, value: string) => string;
|
|
1473
|
-
|
|
1474
|
-
/**
|
|
1475
|
-
* Pads string on the left side if it's shorter than length.
|
|
1476
|
-
*/
|
|
1477
|
-
padStart(targetLength: number, value: string): string;
|
|
1478
|
-
padStart(targetLength: number): (value: string) => string;
|
|
1479
|
-
|
|
1480
|
-
/**
|
|
1481
|
-
* Sort a list of objects by a list of props (if first prop value is equivalent, sort by second, etc).
|
|
1482
|
-
*/
|
|
1483
|
-
sortByProps(props: string[], list: object[]): object[];
|
|
1484
|
-
sortByProps(props: string[]): (list: object[]) => object[];
|
|
1485
|
-
|
|
1486
|
-
/**
|
|
1487
|
-
* When given a number n and an array, returns an array containing every nth element.
|
|
1488
|
-
*/
|
|
1489
|
-
skipTake<T>(n: number, list: T[]): T[];
|
|
1490
|
-
skipTake<T>(n: number): (list: T[]) => T[];
|
|
1491
|
-
|
|
1492
|
-
/**
|
|
1493
|
-
* Sort a list of objects by a list of paths (if first path value is equivalent, sort by second, etc).
|
|
1494
|
-
*/
|
|
1495
|
-
sortByPaths(props: string[][], list: object[]): object[];
|
|
1496
|
-
sortByPaths(props: string[][]): (list: object[]) => object[];
|
|
1497
|
-
|
|
1498
|
-
/**
|
|
1499
|
-
* Determine if input value is an indexed data type.
|
|
1500
|
-
*/
|
|
1501
|
-
isIndexed(val: any): val is string | any[];
|
|
1502
|
-
|
|
1503
|
-
/**
|
|
1504
|
-
* Invokes the method at path of object with given arguments.
|
|
1505
|
-
*/
|
|
1506
|
-
invokeArgs(pathToMethod: string[], args: any[], obj: object): any;
|
|
1507
|
-
invokeArgs(pathToMethod: string[], args: any[]): (obj: object) => any;
|
|
1508
|
-
invokeArgs(pathToMethod: string[]): (args: any[], obj: object) => any;
|
|
1509
|
-
|
|
1510
|
-
/**
|
|
1511
|
-
* Invokes the method at path of object.
|
|
1512
|
-
*/
|
|
1513
|
-
invoke(pathToMethod: string[], obj: object): any;
|
|
1514
|
-
invoke(pathToMethod: string[]): (obj: object) => any;
|
|
1515
|
-
|
|
1516
|
-
/**
|
|
1517
|
-
* Converts double-precision 64-bit binary format IEEE 754 to signed 32 bit integer number.
|
|
1518
|
-
*/
|
|
1519
|
-
toInteger32(n: number): number;
|
|
1520
|
-
toInt32(n: number): number; // alias
|
|
1521
|
-
|
|
1522
|
-
/**
|
|
1523
|
-
* Converts double-precision 64-bit binary format IEEE 754 to unsigned 32 bit integer number.
|
|
1524
|
-
*/
|
|
1525
|
-
toUinteger32(val: number): number;
|
|
1526
|
-
toUint32(val: number): number; // alias
|
|
1527
|
-
|
|
1528
|
-
/**
|
|
1529
|
-
* Converts value to a number.
|
|
1530
|
-
*/
|
|
1531
|
-
toNumber(val: any): number;
|
|
1532
|
-
|
|
1533
|
-
/**
|
|
1534
|
-
* Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end.
|
|
1535
|
-
*
|
|
1536
|
-
* `Note`: JavaScript follows the IEEE-754 standard for resolving floating-point values which can produce unexpected results.
|
|
1537
|
-
*/
|
|
1538
|
-
rangeStep(step: number, from: number, to: number): number[];
|
|
1539
|
-
rangeStep(step: number, from: number): (to: number) => number[];
|
|
1540
|
-
rangeStep(step: number): {
|
|
1541
|
-
(from: number, to: number): number[];
|
|
1542
|
-
(from: number): (to: number) => number[];
|
|
1543
|
-
};
|
|
1544
|
-
|
|
1545
|
-
/**
|
|
1546
|
-
* Returns true if two lists have at least one element common to both lists.
|
|
1547
|
-
*/
|
|
1548
|
-
overlaps<T>(list1: T[], list2: T[]): boolean;
|
|
1549
|
-
overlaps<T>(list1: T[]): (list2: T[]) => boolean;
|
|
1550
|
-
}
|
|
3
|
+
interface Functor<T> {
|
|
4
|
+
map<U>(fn: (t: T) => U): Functor<U>;
|
|
1551
5
|
}
|
|
1552
6
|
|
|
1553
|
-
|
|
7
|
+
interface Apply<T> extends Functor<T> {
|
|
8
|
+
ap<U>(fn: Apply<(t: T) => U>): Apply<U>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface Foldable<T> {
|
|
12
|
+
reduce<Acc>(fn: (acc: Acc, val: T) => Acc, initAcc: Acc): Acc;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface Filterable<T> {
|
|
16
|
+
filter(fn: (t: T) => Boolean): Filterable<T>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface Semigroup {
|
|
20
|
+
// https://www.typescriptlang.org/docs/handbook/advanced-types.html#polymorphic-this-types
|
|
21
|
+
concat(other: this): this;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface Catamorphism<T> {
|
|
25
|
+
cata<T1>(leftFn: (v: T1) => T, rightFn: (v: T1) => T): T;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
type SettledPromiseStatus = 'fulfilled' | 'rejected';
|
|
29
|
+
|
|
30
|
+
interface SettledPromise<T> {
|
|
31
|
+
status: SettledPromiseStatus;
|
|
32
|
+
value: T;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
type Variadic<T1, T2> = (...args: T1[]) => T2;
|
|
36
|
+
|
|
37
|
+
type Pred = (...a: any[]) => boolean;
|
|
38
|
+
|
|
39
|
+
interface Dictionary<T> {
|
|
40
|
+
[key: string]: T;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
type DictPred<T> = (value: T, key: string) => boolean;
|
|
44
|
+
type Primitive = string | number | bigint | boolean | undefined | null | symbol;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Checks if input value is `Array`.
|
|
48
|
+
*/
|
|
49
|
+
export function isArray(val: any): val is any[];
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Checks whether the passed value is iterable.
|
|
53
|
+
*/
|
|
54
|
+
export function isIterable<T>(val: any): val is Iterable<T>;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Checks if input value is an empty `Array`.
|
|
58
|
+
*/
|
|
59
|
+
export function isEmptyArray(val: any): val is any[];
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Checks if input value is `Boolean`.
|
|
63
|
+
*/
|
|
64
|
+
export function isBoolean(val: any): val is boolean;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Checks if value is a primitive data type. There are 6 primitive data types: `string`, `number`, `bigint`, `boolean`, `undefined`, `symbol` and a special case of `null`.
|
|
68
|
+
* See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Primitive_values
|
|
69
|
+
* for definition of what sub-types comprise a primitive.
|
|
70
|
+
*/
|
|
71
|
+
export function isPrimitive<T>(val: T | Primitive): val is Primitive;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Checks if value is not a primitive data type. There are 6 primitive data types: `string`, `number`, `bigint`, `boolean`, `undefined`, `symbol` and a special case of `null`.
|
|
75
|
+
*/
|
|
76
|
+
export function isNotPrimitive<T>(val: T | Primitive): val is T;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Checks if an object exists in another object's prototype chain.
|
|
80
|
+
*/
|
|
81
|
+
export function isPrototypeOf(type: object, object: object): boolean;
|
|
82
|
+
export function isPrototypeOf(type: object): (object: object) => boolean;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Returns `true` if the given value is its type's empty value, `null` or `undefined`.
|
|
86
|
+
*/
|
|
87
|
+
export function isNilOrEmpty(val: any): boolean;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Returns `true` if the given value is not its type's empty value, nor `null` nor `undefined`.
|
|
91
|
+
*/
|
|
92
|
+
export function isNotNilOrEmpty(val: any): boolean;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Checks if input value is complement of `Array`.
|
|
96
|
+
*/
|
|
97
|
+
export function isNotArray(val: any): boolean;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Checks if input value is a non empty `Array`.
|
|
101
|
+
*/
|
|
102
|
+
export function isNonEmptyArray(val: any): val is any[];
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Checks if input value is complement of `Boolean`.
|
|
106
|
+
*/
|
|
107
|
+
export function isNotBoolean(val: any): boolean;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Returns true if the given value is not its type's empty value; `false` otherwise.
|
|
111
|
+
*/
|
|
112
|
+
export function isNotEmpty(val: any): boolean;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Checks if input value is complement of `null` or `undefined`.
|
|
116
|
+
*/
|
|
117
|
+
/* tslint:disable-next-line:no-null-undefined-union null or undefined is the accurate type here */
|
|
118
|
+
export function isNotNil<T>(val: T | null | undefined): val is T;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Checks if input value is complement of `null`.
|
|
122
|
+
*/
|
|
123
|
+
export function isNotNull(val: any): boolean;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Checks if input value is complement of `String`.
|
|
127
|
+
*/
|
|
128
|
+
export function isNotString(val: any): boolean;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Checks if input value is a non empty `String`.
|
|
132
|
+
*/
|
|
133
|
+
export function isNonEmptyString(val: any): boolean;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Checks if input value is complement `undefined`.
|
|
137
|
+
*/
|
|
138
|
+
export function isNotUndefined(val: any): boolean;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Checks if input value is `Symbol`.
|
|
142
|
+
*/
|
|
143
|
+
export function isSymbol(val: any): val is Symbol;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Checks if input value is `null`.
|
|
147
|
+
*/
|
|
148
|
+
export function isNull(val: any): val is null;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Checks if input value is `String`.
|
|
152
|
+
*/
|
|
153
|
+
export function isString(val: any): val is string;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Checks if input value is an empty `String`.
|
|
157
|
+
*/
|
|
158
|
+
export function isEmptyString(val: any): val is string;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Checks if input value is `undefined`.
|
|
162
|
+
*/
|
|
163
|
+
export function isUndefined(val: any): val is undefined;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Tests whether or not an object is similar to an array.
|
|
167
|
+
*/
|
|
168
|
+
export function isArrayLike(val: any): boolean;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Tests whether or not an object is similar to an array.
|
|
172
|
+
*/
|
|
173
|
+
export function isNotArrayLike(val: any): boolean;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Checks if input value is `Generator Function`.
|
|
177
|
+
*/
|
|
178
|
+
export function isGeneratorFunction(val: any): val is Function;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Checks if input value is complement of `Generator Function`.
|
|
182
|
+
*/
|
|
183
|
+
export function isNotGeneratorFunction(val: any): boolean;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Checks if input value is `Async Function`.
|
|
187
|
+
*/
|
|
188
|
+
export function isAsyncFunction(val: any): val is Function;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Checks if input value is complement of `Async Function`.
|
|
192
|
+
*/
|
|
193
|
+
export function isNotAsyncFunction(val: any): boolean;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Checks if input value is `Function`.
|
|
197
|
+
*/
|
|
198
|
+
export function isFunction(val: any): val is Function;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Checks if input value is complement of `Function`.
|
|
202
|
+
*/
|
|
203
|
+
export function isNotFunction(val: any): boolean;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Checks if input value is language type of `Object`.
|
|
207
|
+
*/
|
|
208
|
+
export function isObj(val: any): val is {} | Function;
|
|
209
|
+
export function isObject(val: any): val is {} | Function; // alias
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Checks if input value is complement of language type of `Object`.
|
|
213
|
+
*/
|
|
214
|
+
export function isNotObj(val: any): boolean;
|
|
215
|
+
export function isNotObject(val: any): boolean; // alias
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Checks if value is object-like. A value is object-like if it's not null and has a typeof result of "object".
|
|
219
|
+
*/
|
|
220
|
+
export function isObjLike(val: any): val is object;
|
|
221
|
+
export function isObjectLike(val: any): val is object; // alias
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Checks if value is not object-like.
|
|
225
|
+
* A value is object-like if it's not null and has a typeof result of "object".
|
|
226
|
+
*/
|
|
227
|
+
export function isNotObjLike(val: any): boolean;
|
|
228
|
+
export function isNotObjectLike(val: any): boolean; // alias
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Check to see if an object is a plain object (created using `{}`, `new Object()` or `Object.create(null)`).
|
|
232
|
+
*/
|
|
233
|
+
export function isPlainObj(val: any): val is object;
|
|
234
|
+
export function isPlainObject(val: any): val is object; // alias
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Check to see if an object is not a plain object
|
|
238
|
+
* (created using `{}`, `new Object()` or `Object.create(null)`).
|
|
239
|
+
*/
|
|
240
|
+
export function isNotPlainObj(val: any): boolean;
|
|
241
|
+
export function isNotPlainObject(val: any): boolean; // alias
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Checks if value is `Date` object.
|
|
245
|
+
*/
|
|
246
|
+
export function isDate(val: any): val is Date;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Checks if value is complement of `Date` object.
|
|
250
|
+
*/
|
|
251
|
+
export function isNotDate(val: any): boolean;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Checks if value is valid `Date` object.
|
|
255
|
+
*/
|
|
256
|
+
export function isValidDate(val: any): val is Date;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Checks if value is complement of valid `Date` object.
|
|
260
|
+
*/
|
|
261
|
+
export function isNotValidDate(val: any): boolean;
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Checks if value is complement of valid `Date` object.
|
|
265
|
+
*/
|
|
266
|
+
export function isInvalidDate(val: any): boolean; // alias of isNotValidDate
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Checks if value is `Map`.
|
|
270
|
+
*/
|
|
271
|
+
export function isMap(val: any): val is Map<any, any>;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Checks if value is complement of `Map` object.
|
|
275
|
+
*/
|
|
276
|
+
export function isNotMap(val: any): boolean;
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Checks whether the passed value is `NaN` and its type is `Number`.
|
|
280
|
+
* It is a more robust version of the original, global isNaN().
|
|
281
|
+
*/
|
|
282
|
+
export function isNaN(val: any): val is typeof NaN;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Checks if value is a natural number.
|
|
286
|
+
* Natural numbers correspond to all non-negative integers and 0.
|
|
287
|
+
*/
|
|
288
|
+
export function isNaturalNumber(val: any): boolean;
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Checks whether the passed value is complement of `NaN` and its type is not `Number`.
|
|
292
|
+
*/
|
|
293
|
+
export function isNotNaN(val: any): boolean;
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Checks if value is a `Number` primitive or object.
|
|
297
|
+
*/
|
|
298
|
+
export function isNumber(val: any): val is number;
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Checks if value is a complement of `Number` primitive or object.
|
|
302
|
+
*/
|
|
303
|
+
export function isNotNumber(val: any): boolean;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Checks if value is a positive `Number` primitive or object. Zero is considered neither
|
|
307
|
+
* positive or negative.
|
|
308
|
+
*/
|
|
309
|
+
export function isPositive(val: any): val is number;
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Checks if value is a negative `Number` primitive or object. Zero is considered neither
|
|
313
|
+
* positive or negative.
|
|
314
|
+
*/
|
|
315
|
+
export function isNegative(val: any): val is number;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Checks if value is a positive zero (+0).
|
|
319
|
+
*/
|
|
320
|
+
export function isPositiveZero(val: any): boolean;
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Checks if value is a negative zero (-0).
|
|
324
|
+
*/
|
|
325
|
+
export function isNegativeZero(val: any): boolean;
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Checks if value is a non-positive `Number` primitive or object. This includes all
|
|
329
|
+
* negative numbers and zero.
|
|
330
|
+
*/
|
|
331
|
+
export function isNonPositive(val: any): val is number;
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Checks if value is a non-negative `Number` primitive or object. This includes all
|
|
335
|
+
* positive numbers and zero.
|
|
336
|
+
*/
|
|
337
|
+
export function isNonNegative(val: any): val is number;
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Checks whether the passed value is a finite `Number`.
|
|
341
|
+
*/
|
|
342
|
+
export function isFinite(val: any): boolean;
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Checks whether the passed value is complement of finite `Number`.
|
|
346
|
+
*/
|
|
347
|
+
export function isNotFinite(val: any): boolean;
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Checks whether the passed value is an `integer`.
|
|
351
|
+
*/
|
|
352
|
+
export function isInteger(val: any): val is number;
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Checks whether the passed value is a signed 32 bit `integer`.
|
|
356
|
+
*/
|
|
357
|
+
export function isInteger32(val: any): boolean;
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Checks whether the passed value is an unsigned 32 bit integer number.
|
|
361
|
+
*/
|
|
362
|
+
export function isUinteger32(val: any): boolean;
|
|
363
|
+
export function isUint32(val: any): boolean; // alias
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Checks whether the passed value is complement of `integer`.
|
|
367
|
+
*/
|
|
368
|
+
export function isNotInteger(val: any): boolean;
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Checks if value is a BigInt.
|
|
372
|
+
*/
|
|
373
|
+
export function isBigInt(val: any): boolean;
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Returns `true` if the given value is its type's empty value, `false`, `undefined`
|
|
377
|
+
* as well as strings containing only whitespace characters; `false` otherwise.
|
|
378
|
+
*/
|
|
379
|
+
export function isBlank(val: any): boolean;
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Checks whether the passed value is a `float`.
|
|
383
|
+
*/
|
|
384
|
+
export function isFloat(val: any): val is number;
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Checks whether the passed value is a safe `integer`.
|
|
388
|
+
*/
|
|
389
|
+
export function isSafeInteger(val: any): boolean;
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Checks whether the passed value is complement of a `float`.
|
|
393
|
+
*/
|
|
394
|
+
export function isNotFloat(val: any): boolean;
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* Checks if value is a valid `Number`. A valid `Number` is a number that is not `NaN`,
|
|
398
|
+
* `Infinity` or `-Infinity`.
|
|
399
|
+
*/
|
|
400
|
+
export function isValidNumber(val: any): boolean;
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Checks if value is not a valid `Number`. A valid `Number` is a number that is not `NaN`,
|
|
404
|
+
* `Infinity` or `-Infinity`.
|
|
405
|
+
*/
|
|
406
|
+
export function isNotValidNumber(val: any): boolean;
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Checks if value is odd integer number.
|
|
410
|
+
* An odd number is an integer which is not a multiple DIVISIBLE of two.
|
|
411
|
+
*/
|
|
412
|
+
export function isOdd(val: any): boolean;
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Checks if value is even integer number.
|
|
416
|
+
* An even number is an integer which is "evenly divisible" by two.
|
|
417
|
+
* Zero is an even number because zero divided by two equals zero,
|
|
418
|
+
* which despite not being a natural number, is an integer.
|
|
419
|
+
* Even numbers are either positive or negative.
|
|
420
|
+
*/
|
|
421
|
+
export function isEven(val: any): boolean;
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Checks if `value` is an `Error`, `EvalError`, `RangeError`, `ReferenceError`, `SyntaxError`, `TypeError` or `URIError` object.
|
|
425
|
+
*/
|
|
426
|
+
export function isError(val: any): val is Error;
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Checks if input value is a pair.
|
|
430
|
+
*/
|
|
431
|
+
export function isPair(val: any): val is any[];
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Checks if input value is complement of a pair.
|
|
435
|
+
*/
|
|
436
|
+
export function isNotPair(val: any): boolean;
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* Checks if value is `RegExp` object.
|
|
440
|
+
*/
|
|
441
|
+
export function isRegExp(val: any): boolean;
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Checks if value is `Set`.
|
|
445
|
+
*/
|
|
446
|
+
export function isSet(val: any): val is Set<any>;
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Checks if value is complement of `Set` object.
|
|
450
|
+
*/
|
|
451
|
+
export function isNotSet(val: any): boolean;
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Checks if value is complement of `RegExp` object.
|
|
455
|
+
*/
|
|
456
|
+
export function isNotRegExp(val: any): boolean;
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* Checks if input value is a sparse Array.
|
|
460
|
+
* An array with at least one "empty slot" in it is often called a "sparse array."
|
|
461
|
+
* Empty slot doesn't mean that the slot contains `null` or `undefined` values,
|
|
462
|
+
* but rather that the slots don't exist.
|
|
463
|
+
*/
|
|
464
|
+
export function isSparseArray(val: any): boolean;
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* Checks whether the passed value is
|
|
468
|
+
* {@link https://github.com/getify/You-Dont-Know-JS/blob/9959fc904d584bbf0b02cf41c192f74ff4238581/types-grammar/ch4.md#the-curious-case-of-the-|a sentinel value}.
|
|
469
|
+
*/
|
|
470
|
+
export function isSentinelValue(val: any): boolean;
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* A function that returns `undefined`.
|
|
474
|
+
*/
|
|
475
|
+
export function stubUndefined(): undefined;
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* A function that returns `null`.
|
|
479
|
+
*/
|
|
480
|
+
export function stubNull(): null;
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* A function that returns new empty array on every call.
|
|
484
|
+
*/
|
|
485
|
+
export function stubArray(): any[];
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* This function returns a new empty object.
|
|
489
|
+
*/
|
|
490
|
+
export function stubObj(): {};
|
|
491
|
+
export function stubObject(): {}; // alias
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* A function that returns empty string.
|
|
495
|
+
*/
|
|
496
|
+
export function stubString(): '';
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* A function that performs no operations.
|
|
500
|
+
*/
|
|
501
|
+
export function noop(...args: any[]): undefined;
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Picks values from list by indexes.
|
|
505
|
+
*/
|
|
506
|
+
export function pickIndexes<T>(indexes: number[], list: T[]): T[];
|
|
507
|
+
export function pickIndexes(indexes: number[]): <T>(list: T[]) => T[];
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Creates a list from from arguments.
|
|
511
|
+
*/
|
|
512
|
+
export function list(...items: any[]): any[];
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Returns a singleton array containing the value provided.
|
|
516
|
+
* If value is already an array, it is returned as is.
|
|
517
|
+
*/
|
|
518
|
+
export function ensureArray<T>(value: T | T[]): T[];
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Returns the result of concatenating the given lists or strings.
|
|
522
|
+
* Note: RA.concatAll expects all elements to be of the same type.
|
|
523
|
+
* It will throw an error if you concat an Array with a non-Array value.
|
|
524
|
+
* Dispatches to the concat method of the preceding element, if present.
|
|
525
|
+
* Can also concatenate multiple elements of a [fantasy-land compatible semigroup](https://github.com/fantasyland/fantasy-land#semigroup).
|
|
526
|
+
* Returns undefined if empty array was passed.
|
|
527
|
+
*/
|
|
528
|
+
export function concatAll<S extends Semigroup>(
|
|
529
|
+
foldable: Foldable<S>
|
|
530
|
+
): S | undefined;
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* Returns the result of concatenating the given lists or strings.
|
|
534
|
+
*/
|
|
535
|
+
export function concatRight<T extends any[]>(firstList: T, secondList: T): T;
|
|
536
|
+
export function concatRight<T extends any[]>(
|
|
537
|
+
firstList: T
|
|
538
|
+
): (secondList: T) => T;
|
|
539
|
+
export function concatRight(firstList: string, secondList: string): string;
|
|
540
|
+
export function concatRight(firstList: string): (secondList: string) => string;
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* Acts as multiple path: arrays of paths in, array of values out. Preserves order.
|
|
544
|
+
*/
|
|
545
|
+
export function paths(ps: Array<Array<string | number>>, obj: object): any[];
|
|
546
|
+
export function paths(
|
|
547
|
+
ps: Array<Array<string | number>>
|
|
548
|
+
): (obj: object) => any[];
|
|
549
|
+
|
|
550
|
+
/**
|
|
551
|
+
* If the given, non-null object has a value at the given path, returns the value at that path.
|
|
552
|
+
* Otherwise returns the result of invoking the provided function with the object.
|
|
553
|
+
*/
|
|
554
|
+
export function pathOrLazy<T>(
|
|
555
|
+
defaultValueFn: () => T,
|
|
556
|
+
path: Array<number | string>,
|
|
557
|
+
obj: object
|
|
558
|
+
): T;
|
|
559
|
+
export function pathOrLazy<T>(
|
|
560
|
+
defaultValueFn: () => T,
|
|
561
|
+
path: Array<number | string>
|
|
562
|
+
): (obj: object) => T;
|
|
563
|
+
export function pathOrLazy<T>(defaultValueFn: () => T): {
|
|
564
|
+
(path: Array<number | string>, obj: object): T;
|
|
565
|
+
(path: Array<number | string>): (obj: object) => T;
|
|
566
|
+
};
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* "lifts" a function to be the specified arity, so that it may "map over" objects that satisfy
|
|
570
|
+
* the Apply spec of fantasy land.
|
|
571
|
+
*/
|
|
572
|
+
export function liftFN<T>(arity: number, fn: Variadic<Apply<T>, T>): Apply<T>;
|
|
573
|
+
export function liftFN(
|
|
574
|
+
arity: number
|
|
575
|
+
): <T>(fn: Variadic<Apply<T>, T>) => Apply<T>;
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* "lifts" a function of arity > 1 so that it may "map over" objects that satisfy
|
|
579
|
+
* the Apply spec of fantasy land.
|
|
580
|
+
*/
|
|
581
|
+
export function liftF<T>(fn: Variadic<Apply<T>, T>): Apply<T>;
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* The catamorphism for either. If the either is right than the right function will be executed with
|
|
585
|
+
* the right value and the value of the function returned. Otherwise the left function
|
|
586
|
+
* will be called with the left value.
|
|
587
|
+
*/
|
|
588
|
+
export function cata<V1, V2, T1, T2>(
|
|
589
|
+
leftFn: (leftValue: V1) => T1,
|
|
590
|
+
rightFn: (rightValue: V2) => T2,
|
|
591
|
+
either: Catamorphism<V1 | V2>
|
|
592
|
+
): T1 | T2;
|
|
593
|
+
export function cata<V1, V2, T1, T2>(
|
|
594
|
+
leftFn: (leftValue: V1) => T1,
|
|
595
|
+
rightFn: (rightValue: V2) => T2
|
|
596
|
+
): (either: Catamorphism<V1 | V2>) => T1 | T2;
|
|
597
|
+
export function cata<V1, V2, T1, T2>(
|
|
598
|
+
leftFn: (leftValue: V1) => T1
|
|
599
|
+
): {
|
|
600
|
+
(rightFn: (rightValue: V2) => T2, either: Catamorphism<V1 | V2>): T1 | T2;
|
|
601
|
+
(rightFn: (rightValue: V2) => T2): (either: Catamorphism<V1 | V2>) => T1 | T2;
|
|
602
|
+
};
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* Creates a new object with the own properties of the provided object, but the
|
|
606
|
+
* keys renamed according to the keysMap object as `{oldKey: newKey}`.
|
|
607
|
+
* When some key is not found in the keysMap, then it's passed as-is.
|
|
608
|
+
*/
|
|
609
|
+
export function renameKeys(keysMap: Dictionary<string>, obj: object): object;
|
|
610
|
+
export function renameKeys(
|
|
611
|
+
keysMap: Dictionary<string>
|
|
612
|
+
): (obj: object) => object;
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* Creates a new object with the own properties of the provided object, and the
|
|
616
|
+
* keys copied according to the keysMap object as `{oldKey: newKey}`.
|
|
617
|
+
* When no key from the keysMap is found, then a shallow clone of an object is returned.
|
|
618
|
+
*/
|
|
619
|
+
export function copyKeys(keysMap: Dictionary<string>, obj: object): object;
|
|
620
|
+
export function copyKeys(keysMap: Dictionary<string>): (obj: object) => object;
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* Creates a new object with the own properties of the provided object, but the
|
|
624
|
+
* keys renamed according to logic of renaming function.
|
|
625
|
+
*/
|
|
626
|
+
export function renameKeysWith(
|
|
627
|
+
renameFn: (key: string) => string,
|
|
628
|
+
obj: object
|
|
629
|
+
): object;
|
|
630
|
+
export function renameKeysWith(
|
|
631
|
+
renameFn: (key: string) => string
|
|
632
|
+
): (obj: object) => object;
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* Creates a new object with the own properties of the provided object, but the
|
|
636
|
+
* key `key` renamed according to logic of renaming function.
|
|
637
|
+
*/
|
|
638
|
+
export function renameKeyWith(
|
|
639
|
+
renameFn: (key: string) => string,
|
|
640
|
+
key: string,
|
|
641
|
+
obj: object
|
|
642
|
+
): object;
|
|
643
|
+
export function renameKeyWith(
|
|
644
|
+
renameFn: (key: string) => string,
|
|
645
|
+
key: string
|
|
646
|
+
): (obj: object) => object;
|
|
647
|
+
export function renameKeyWith(renameFn: (key: string) => string): {
|
|
648
|
+
(key: string, obj: object): object;
|
|
649
|
+
(key: string): (obj: object) => object;
|
|
650
|
+
};
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* Functional equivalent of merging object properties with object spread.
|
|
654
|
+
*/
|
|
655
|
+
export function mergeProps(ps: string[], obj: object): object;
|
|
656
|
+
export function mergeProps(ps: string[]): (obj: object) => object;
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* Merge objects under corresponding paths.
|
|
660
|
+
*/
|
|
661
|
+
export function mergePaths(
|
|
662
|
+
paths: Array<Array<string | number>>,
|
|
663
|
+
obj: object
|
|
664
|
+
): object;
|
|
665
|
+
export function mergePaths(
|
|
666
|
+
paths: Array<Array<string | number>>
|
|
667
|
+
): (obj: object) => object;
|
|
668
|
+
|
|
669
|
+
/**
|
|
670
|
+
* Create a new object with the own properties of the object under the `p`
|
|
671
|
+
* merged with the own properties of the provided `source`.
|
|
672
|
+
* If a key exists in both objects, the value from the `source` object will be used.
|
|
673
|
+
*/
|
|
674
|
+
export function mergeProp(p: string, source: object, obj: object): object;
|
|
675
|
+
export function mergeProp(p: string, source: object): (obj: object) => object;
|
|
676
|
+
export function mergeProp(p: string): {
|
|
677
|
+
(source: object, obj: object): object;
|
|
678
|
+
(source: object): (obj: object) => object;
|
|
679
|
+
};
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* Create a new object with the own properties of the object under the `path`
|
|
683
|
+
* merged with the own properties of the provided `source`.
|
|
684
|
+
* If a key exists in both objects, the value from the `source` object will be used.
|
|
685
|
+
*/
|
|
686
|
+
export function mergePath(
|
|
687
|
+
path: Array<string | number>,
|
|
688
|
+
source: object,
|
|
689
|
+
obj: object
|
|
690
|
+
): object;
|
|
691
|
+
export function mergePath(
|
|
692
|
+
path: Array<string | number>,
|
|
693
|
+
source: object
|
|
694
|
+
): (obj: object) => object;
|
|
695
|
+
export function mergePath(path: Array<string | number>): {
|
|
696
|
+
(source: object, obj: object): object;
|
|
697
|
+
(source: object): (obj: object) => object;
|
|
698
|
+
};
|
|
699
|
+
|
|
700
|
+
/**
|
|
701
|
+
* Returns a partial copy of an object containing only the keys
|
|
702
|
+
* that don't satisfy the supplied predicate.
|
|
703
|
+
*/
|
|
704
|
+
export function omitBy<T, U extends Dictionary<T>>(
|
|
705
|
+
pred: DictPred<T>,
|
|
706
|
+
obj: U
|
|
707
|
+
): U;
|
|
708
|
+
export function omitBy<T, U extends Dictionary<T>>(
|
|
709
|
+
pred: DictPred<T>
|
|
710
|
+
): (obj: U) => U;
|
|
711
|
+
|
|
712
|
+
/**
|
|
713
|
+
* Weave a configuration into function returning the runnable monad like `Reader` or `Free`.
|
|
714
|
+
*/
|
|
715
|
+
export function weave(fn: Function, config: any): Function;
|
|
716
|
+
export function weave(fn: Function): (config: any) => Function;
|
|
717
|
+
|
|
718
|
+
/**
|
|
719
|
+
* Weave a configuration into function returning the runnable monad like `Reader` or `Free`.
|
|
720
|
+
*/
|
|
721
|
+
export function weaveLazy(fn: Function, configAccessor: Function): Function;
|
|
722
|
+
export function weaveLazy(fn: Function): (configAccessor: Function) => Function;
|
|
723
|
+
|
|
724
|
+
/**
|
|
725
|
+
* Returns a curried equivalent of the provided function, with the specified arity.
|
|
726
|
+
* This function is like curryN, except that the provided arguments order is reversed.
|
|
727
|
+
*/
|
|
728
|
+
export function curryRightN(arity: number, fn: Function): Function;
|
|
729
|
+
export function curryRightN(arity: number): (fn: Function) => Function;
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* Returns a curried equivalent of the provided function.
|
|
733
|
+
* This function is like curry, except that the provided arguments order is reversed.
|
|
734
|
+
*/
|
|
735
|
+
export function curryRight(fn: Function): Function;
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* {@link http://ramdajs.com/docs/#map|R.map} function that more closely resembles Array.prototype.map.
|
|
739
|
+
* It takes two new parameters to its callback function: the current index, and the entire list.
|
|
740
|
+
*/
|
|
741
|
+
export function mapIndexed<T, U>(
|
|
742
|
+
iterator: (elem: T, key: number, list: T[]) => U,
|
|
743
|
+
list: ReadonlyArray<T>
|
|
744
|
+
): U[];
|
|
745
|
+
export function mapIndexed<T, U>(
|
|
746
|
+
iterator: (elem: T, key: number, list: T[]) => U
|
|
747
|
+
): (list: ReadonlyArray<T>) => U[];
|
|
748
|
+
export function mapIndexed<T, U>(
|
|
749
|
+
iterator: (elem: T, key: number, list: Dictionary<T>) => U,
|
|
750
|
+
list: Dictionary<T>
|
|
751
|
+
): Dictionary<U>;
|
|
752
|
+
export function mapIndexed<T, U>(
|
|
753
|
+
iterator: (elem: T, key: number, list: Dictionary<T>) => U
|
|
754
|
+
): (list: Dictionary<T>) => Dictionary<U>;
|
|
755
|
+
export function mapIndexed<T, U>(
|
|
756
|
+
iterator: (elem: T, key: number, list: Functor<T>) => U,
|
|
757
|
+
list: Functor<T>
|
|
758
|
+
): Functor<U>;
|
|
759
|
+
export function mapIndexed<T, U>(
|
|
760
|
+
iterator: (elem: T, key: number, list: Functor<T>) => U
|
|
761
|
+
): (list: Functor<T>) => Functor<U>;
|
|
762
|
+
export function mapIndexed(
|
|
763
|
+
iterator: (char: string, key: number, str: string) => string,
|
|
764
|
+
str: string
|
|
765
|
+
): string[];
|
|
766
|
+
export function mapIndexed(
|
|
767
|
+
iterator: (char: string, key: number, str: string) => string
|
|
768
|
+
): (str: string) => string[];
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* {@link http://ramdajs.com/docs/#reduce|R.reduce} function that more closely resembles Array.prototype.reduce.
|
|
772
|
+
* It takes two new parameters to its callback function: the current index, and the entire list.
|
|
773
|
+
*/
|
|
774
|
+
export function reduceIndexed<T, TResult, R extends T[]>(
|
|
775
|
+
iterator: (acc: TResult, elem: T, key: number, list: R) => TResult,
|
|
776
|
+
acc: TResult,
|
|
777
|
+
list: R
|
|
778
|
+
): TResult;
|
|
779
|
+
export function reduceIndexed<T, TResult, R extends T[]>(
|
|
780
|
+
iterator: (acc: TResult, elem: T, key: number, list: R) => TResult,
|
|
781
|
+
acc: TResult
|
|
782
|
+
): (list: R) => TResult;
|
|
783
|
+
export function reduceIndexed<T, TResult, R extends T[]>(
|
|
784
|
+
iterator: (acc: TResult, elem: T, key: number, list: R) => TResult
|
|
785
|
+
): {
|
|
786
|
+
(acc: TResult): (list: R) => TResult;
|
|
787
|
+
(acc: TResult, list: R): TResult;
|
|
788
|
+
};
|
|
789
|
+
|
|
790
|
+
/**
|
|
791
|
+
* {@link http://ramdajs.com/docs/#filter|R.filter} function that more closely resembles `Array.prototype.filter`.
|
|
792
|
+
* It takes two new parameters to its callback function: the current index, and the entire list.
|
|
793
|
+
*
|
|
794
|
+
* `filterIndexed` implementation is simple: `
|
|
795
|
+
* const filterIndexed = R.addIndex(R.filter);
|
|
796
|
+
* `
|
|
797
|
+
*/
|
|
798
|
+
export function filterIndexed<T>(
|
|
799
|
+
iterator: (elem: T, idx: number, list: T[]) => Boolean,
|
|
800
|
+
list: ReadonlyArray<T>
|
|
801
|
+
): T[];
|
|
802
|
+
export function filterIndexed<T>(
|
|
803
|
+
iterator: (elem: T, idx: number, list: T[]) => Boolean
|
|
804
|
+
): (list: ReadonlyArray<T>) => T[];
|
|
805
|
+
export function filterIndexed<T>(
|
|
806
|
+
iterator: (elem: T, idx: number, list: Dictionary<T>) => Boolean,
|
|
807
|
+
list: Dictionary<T>
|
|
808
|
+
): Dictionary<T>;
|
|
809
|
+
export function filterIndexed<T>(
|
|
810
|
+
iterator: (elem: T, idx: number, list: Dictionary<T>) => Boolean
|
|
811
|
+
): (list: Dictionary<T>) => Dictionary<T>;
|
|
812
|
+
export function filterIndexed<T>(
|
|
813
|
+
iterator: (elem: T, idx: number, list: Filterable<T>) => Boolean,
|
|
814
|
+
list: Filterable<T>
|
|
815
|
+
): Filterable<T>;
|
|
816
|
+
export function filterIndexed<T>(
|
|
817
|
+
iterator: (elem: T, idx: number, list: Filterable<T>) => Boolean
|
|
818
|
+
): (list: Filterable<T>) => Filterable<Boolean>;
|
|
819
|
+
export function filterIndexed(
|
|
820
|
+
iterator: (char: string, idx: number, str: string) => Boolean,
|
|
821
|
+
str: string
|
|
822
|
+
): string[];
|
|
823
|
+
export function filterIndexed(
|
|
824
|
+
iterator: (char: string, idx: number, str: string) => Boolean
|
|
825
|
+
): (str: string) => string[];
|
|
826
|
+
|
|
827
|
+
/**
|
|
828
|
+
* Given an `Iterable`(arrays are `Iterable`), or a promise of an `Iterable`,
|
|
829
|
+
* which produces promises (or a mix of promises and values),
|
|
830
|
+
* iterate over all the values in the `Iterable` into an array and
|
|
831
|
+
* reduce the array to a value using the given iterator function.
|
|
832
|
+
*/
|
|
833
|
+
export function reduceP<T, TResult, R extends T[]>(
|
|
834
|
+
fn: (acc: TResult, elem: T) => TResult,
|
|
835
|
+
acc: TResult,
|
|
836
|
+
list: R
|
|
837
|
+
): TResult;
|
|
838
|
+
export function reduceP<T, TResult, R extends T[]>(
|
|
839
|
+
fn: (acc: TResult, elem: T) => TResult,
|
|
840
|
+
acc: TResult
|
|
841
|
+
): (list: R) => TResult;
|
|
842
|
+
export function reduceP<T, TResult, R extends T[]>(
|
|
843
|
+
fn: (acc: TResult, elem: T) => TResult
|
|
844
|
+
): {
|
|
845
|
+
(acc: TResult, list: R): TResult;
|
|
846
|
+
(acc: TResult): (list: R) => TResult;
|
|
847
|
+
};
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* Given an `Iterable`(arrays are `Iterable`), or a promise of an `Iterable`,
|
|
851
|
+
* which produces promises (or a mix of promises and values),
|
|
852
|
+
* iterate over all the values in the `Iterable` into an array and
|
|
853
|
+
* reduce the array to a value using the given iterator function.
|
|
854
|
+
*
|
|
855
|
+
* Similar to {@link RA.reduceP|reduceP} except moves through the input list from the right to the left.
|
|
856
|
+
* The iterator function receives two values: (value, acc),
|
|
857
|
+
* while the arguments' order of reduceP's iterator function is (acc, value).
|
|
858
|
+
*/
|
|
859
|
+
export function reduceRightP<T, TResult, R extends T[]>(
|
|
860
|
+
fn: (elem: T, acc: TResult) => TResult,
|
|
861
|
+
acc: TResult,
|
|
862
|
+
list: R
|
|
863
|
+
): TResult;
|
|
864
|
+
export function reduceRightP<T, TResult, R extends T[]>(
|
|
865
|
+
fn: (elem: T, acc: TResult) => TResult,
|
|
866
|
+
acc: TResult
|
|
867
|
+
): (list: R) => TResult;
|
|
868
|
+
export function reduceRightP<T, TResult, R extends T[]>(
|
|
869
|
+
fn: (elem: T, acc: TResult) => TResult
|
|
870
|
+
): {
|
|
871
|
+
(acc: TResult, list: R): TResult;
|
|
872
|
+
(acc: TResult): (list: R) => TResult;
|
|
873
|
+
};
|
|
874
|
+
/**
|
|
875
|
+
* Returns `true` if data structure focused by the given lens equals provided value.
|
|
876
|
+
*/
|
|
877
|
+
export function lensEq(lens: Function, value: any, data: any): boolean;
|
|
878
|
+
export function lensEq(lens: Function, value: any): (data: any) => boolean;
|
|
879
|
+
export function lensEq(lens: Function): (value: any) => (data: any) => boolean;
|
|
880
|
+
|
|
881
|
+
/**
|
|
882
|
+
* Returns `false` if data structure focused by the given lens equals provided value.
|
|
883
|
+
*/
|
|
884
|
+
export function lensNotEq(lens: Function, value: any, data: any): boolean;
|
|
885
|
+
export function lensNotEq(lens: Function, value: any): (data: any) => boolean;
|
|
886
|
+
export function lensNotEq(
|
|
887
|
+
lens: Function
|
|
888
|
+
): (value: any) => (data: any) => boolean;
|
|
889
|
+
|
|
890
|
+
/**
|
|
891
|
+
* Returns `true` if data structure focused by the given lens satisfies the predicate.
|
|
892
|
+
* Note that the predicate is expected to return boolean value and will be evaluated
|
|
893
|
+
* as `false` unless the predicate returns `true`.
|
|
894
|
+
*/
|
|
895
|
+
export function lensSatisfies(
|
|
896
|
+
predicate: Function,
|
|
897
|
+
lens: Function,
|
|
898
|
+
data: any
|
|
899
|
+
): boolean;
|
|
900
|
+
export function lensSatisfies(
|
|
901
|
+
predicate: Function,
|
|
902
|
+
lens: Function
|
|
903
|
+
): (data: any) => boolean;
|
|
904
|
+
export function lensSatisfies(
|
|
905
|
+
predicate: Function
|
|
906
|
+
): (lens: Function) => (data: any) => boolean;
|
|
907
|
+
|
|
908
|
+
/**
|
|
909
|
+
* Returns `true` if data structure focused by the given lens doesn't satisfy the predicate.
|
|
910
|
+
* Note that the predicate is expected to return boolean value.
|
|
911
|
+
*/
|
|
912
|
+
export function lensNotSatisfy(
|
|
913
|
+
predicate: Function,
|
|
914
|
+
lens: Function,
|
|
915
|
+
data: any
|
|
916
|
+
): boolean;
|
|
917
|
+
export function lensNotSatisfy(
|
|
918
|
+
predicate: Function,
|
|
919
|
+
lens: Function
|
|
920
|
+
): (data: any) => boolean;
|
|
921
|
+
export function lensNotSatisfy(
|
|
922
|
+
predicate: Function
|
|
923
|
+
): (lens: Function) => (data: any) => boolean;
|
|
924
|
+
|
|
925
|
+
/**
|
|
926
|
+
* Returns a "view" of the given data structure, determined by the given lens
|
|
927
|
+
* The lens's focus determines which portion of the data structure is visible.
|
|
928
|
+
* Returns the defaultValue if "view" is null, undefined or NaN; otherwise the "view" is returned.
|
|
929
|
+
*/
|
|
930
|
+
export function viewOr(defaultValue: any, lens: Function, data: any): any;
|
|
931
|
+
export function viewOr(defaultValue: any, lens: Function): (data: any) => any;
|
|
932
|
+
export function viewOr(
|
|
933
|
+
defaultValue: any
|
|
934
|
+
): (lens: Function) => (data: any) => any;
|
|
935
|
+
|
|
936
|
+
/**
|
|
937
|
+
* Defines an isomorphism that will work like a lens. It takes two functions.
|
|
938
|
+
* The function that converts and the function that recovers.
|
|
939
|
+
*/
|
|
940
|
+
|
|
941
|
+
export function lensIso(to: Function, from: Function): Function;
|
|
942
|
+
export function lensIso(to: Function): (from: Function) => Function;
|
|
943
|
+
export namespace lensIso {
|
|
944
|
+
function from(lens: Function): Function;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
/**
|
|
948
|
+
* Creates a [Traversable](https://github.com/fantasyland/fantasy-land#traversable) lens
|
|
949
|
+
* from an [Applicative](https://github.com/fantasyland/fantasy-land#applicative)-returning function.
|
|
950
|
+
*
|
|
951
|
+
* When executed, it maps an [Applicative](https://github.com/fantasyland/fantasy-land#applicative)-returning
|
|
952
|
+
* function over a [Traversable](https://github.com/fantasyland/fantasy-land#traversable),
|
|
953
|
+
* then uses [`sequence`](#sequence) to transform the resulting Traversable of Applicative
|
|
954
|
+
* into an Applicative of Traversable.
|
|
955
|
+
*
|
|
956
|
+
* Dispatches to the `traverse` method of the third argument, if present.
|
|
957
|
+
*/
|
|
958
|
+
export function lensTraverse(of: Function): Function;
|
|
959
|
+
|
|
960
|
+
/**
|
|
961
|
+
* Returns true if the specified object property is not equal,
|
|
962
|
+
* in R.equals terms, to the given value; false otherwise.
|
|
963
|
+
*/
|
|
964
|
+
export function propNotEq(
|
|
965
|
+
prop: string | number,
|
|
966
|
+
value: any,
|
|
967
|
+
obj: object
|
|
968
|
+
): boolean;
|
|
969
|
+
export function propNotEq(
|
|
970
|
+
prop: string | number,
|
|
971
|
+
value: any
|
|
972
|
+
): (obj: object) => boolean;
|
|
973
|
+
export function propNotEq(prop: string | number): {
|
|
974
|
+
(value: any, obj: object): boolean;
|
|
975
|
+
(value: any): (obj: object) => boolean;
|
|
976
|
+
};
|
|
977
|
+
|
|
978
|
+
/**
|
|
979
|
+
* Determines whether a nested path on an object doesn't have a specific value,
|
|
980
|
+
* in R.equals terms. Most likely used to filter a list.
|
|
981
|
+
*/
|
|
982
|
+
export function pathNotEq(
|
|
983
|
+
path: Array<string | number>,
|
|
984
|
+
value: any,
|
|
985
|
+
obj: object
|
|
986
|
+
): boolean;
|
|
987
|
+
export function pathNotEq(
|
|
988
|
+
path: Array<string | number>,
|
|
989
|
+
value: any
|
|
990
|
+
): (obj: object) => boolean;
|
|
991
|
+
export function pathNotEq(path: Array<string | number>): {
|
|
992
|
+
(value: any, obj: object): boolean;
|
|
993
|
+
(value: any): (obj: object) => boolean;
|
|
994
|
+
};
|
|
995
|
+
|
|
996
|
+
/**
|
|
997
|
+
* Checks if `value` is between `low` and up to but not including `high`.
|
|
998
|
+
*/
|
|
999
|
+
export function inRange(low: number, high: number, value: number): boolean;
|
|
1000
|
+
export function inRange(low: number, high: number): (value: number) => boolean;
|
|
1001
|
+
export function inRange(low: number): {
|
|
1002
|
+
(high: number, value: number): boolean;
|
|
1003
|
+
(high: number): (value: number) => boolean;
|
|
1004
|
+
};
|
|
1005
|
+
|
|
1006
|
+
/**
|
|
1007
|
+
* Spreads object under property path onto provided object.
|
|
1008
|
+
*/
|
|
1009
|
+
export function spreadPath(path: Array<string | number>, obj: object): object;
|
|
1010
|
+
export function spreadPath(
|
|
1011
|
+
path: Array<string | number>
|
|
1012
|
+
): (obj: object) => object;
|
|
1013
|
+
|
|
1014
|
+
/**
|
|
1015
|
+
* Spreads object under property onto provided object.
|
|
1016
|
+
*/
|
|
1017
|
+
export function spreadProp(prop: string | number, obj: object): object;
|
|
1018
|
+
export function spreadProp(prop: string | number): (obj: object) => object;
|
|
1019
|
+
|
|
1020
|
+
/**
|
|
1021
|
+
* Flattens a property path so that its fields are spread out into the provided object.
|
|
1022
|
+
*/
|
|
1023
|
+
export function flattenPath(path: Array<string | number>, obj: object): object;
|
|
1024
|
+
export function flattenPath(
|
|
1025
|
+
path: Array<string | number>
|
|
1026
|
+
): (obj: object) => object;
|
|
1027
|
+
|
|
1028
|
+
/**
|
|
1029
|
+
* Flattens a property so that its fields are spread out into the provided object.
|
|
1030
|
+
*/
|
|
1031
|
+
export function flattenProp(prop: string | number, obj: object): object;
|
|
1032
|
+
export function flattenProp(prop: string | number): (obj: object) => object;
|
|
1033
|
+
|
|
1034
|
+
/**
|
|
1035
|
+
* Creates a new object out of a list of keys and a list of values by applying the function
|
|
1036
|
+
* to each equally-positioned pair in the lists.
|
|
1037
|
+
* Key/value pairing is truncated to the length of the shorter of the two lists.
|
|
1038
|
+
*/
|
|
1039
|
+
export function zipObjWith<T, U, V>(
|
|
1040
|
+
fn: (value: T, key: U) => [string, V],
|
|
1041
|
+
keys: U[],
|
|
1042
|
+
values: T[]
|
|
1043
|
+
): { [k: string]: V };
|
|
1044
|
+
export function zipObjWith<T, U, V>(
|
|
1045
|
+
fn: (value: T, key: U) => [string, V]
|
|
1046
|
+
): (keys: U[], values: T[]) => { [k: string]: V };
|
|
1047
|
+
export function zipObjWith<T, U, V>(
|
|
1048
|
+
fn: (value: T, key: U) => [string, V]
|
|
1049
|
+
): {
|
|
1050
|
+
(keys: U[], values: T[]): { [k: string]: V };
|
|
1051
|
+
(keys: U[]): (values: T[]) => { [k: string]: V };
|
|
1052
|
+
};
|
|
1053
|
+
|
|
1054
|
+
/**
|
|
1055
|
+
* Creates a new list out of the supplied object by applying the function to each key/value pairing.
|
|
1056
|
+
*/
|
|
1057
|
+
export function unzipObjWith<T, U, V>(
|
|
1058
|
+
fn: (v: T, k: string) => [U, V],
|
|
1059
|
+
obj: { [k: string]: T }
|
|
1060
|
+
): [U[], V[]];
|
|
1061
|
+
export function unzipObjWith<T, U, V>(
|
|
1062
|
+
fn: (v: T, k: string) => [U, V]
|
|
1063
|
+
): (obj: { [k: string]: T }) => [U[], V[]];
|
|
1064
|
+
|
|
1065
|
+
/**
|
|
1066
|
+
* Composable shortcut for `Promise.all`.
|
|
1067
|
+
*
|
|
1068
|
+
* The `allP` method returns a single Promise that resolves when all of the promises
|
|
1069
|
+
* in the iterable argument have resolved or when the iterable argument contains no promises.
|
|
1070
|
+
* It rejects with the reason of the first promise that rejects.
|
|
1071
|
+
*/
|
|
1072
|
+
export function allP<T>(iterable: Iterable<T>): Promise<T[]>;
|
|
1073
|
+
|
|
1074
|
+
/**
|
|
1075
|
+
* Returns a Promise that is resolved with an array of reasons when all of the provided Promises reject, or rejected when any Promise is resolved.
|
|
1076
|
+
* This pattern is like allP, but fulfillments and rejections are transposed - rejections become the fulfillment values and vice versa.
|
|
1077
|
+
*/
|
|
1078
|
+
export function noneP<T>(iterable: Iterable<T | Promise<T>>): Promise<T[]>;
|
|
1079
|
+
|
|
1080
|
+
/**
|
|
1081
|
+
* allSettledP returns a promise that is fulfilled with an array of promise state snapshots,
|
|
1082
|
+
* but only after all the original promises have settled, i.e. become either fulfilled or rejected.
|
|
1083
|
+
* We say that a promise is settled if it is not pending, i.e. if it is either fulfilled or rejected.
|
|
1084
|
+
*/
|
|
1085
|
+
export function allSettledP<T>(
|
|
1086
|
+
iterable: Iterable<T>
|
|
1087
|
+
): Promise<Array<SettledPromise<T>>>;
|
|
1088
|
+
|
|
1089
|
+
/**
|
|
1090
|
+
* Returns a promise that is fulfilled by the first given promise to be fulfilled,
|
|
1091
|
+
* or rejected with an array of rejection reasons if all of the given promises are rejected.
|
|
1092
|
+
*/
|
|
1093
|
+
export function anyP<T>(iterable: Iterable<T>): Promise<T>;
|
|
1094
|
+
export function firstP<T>(iterable: Iterable<T>): Promise<T>; // alias
|
|
1095
|
+
|
|
1096
|
+
/**
|
|
1097
|
+
* Returns a promise that is fulfilled by the last given promise to be fulfilled,
|
|
1098
|
+
* or rejected with an array of rejection reasons if all of the given promises are rejected.
|
|
1099
|
+
*/
|
|
1100
|
+
export function lastP<T>(iterable: Iterable<T>): Promise<T>;
|
|
1101
|
+
|
|
1102
|
+
/**
|
|
1103
|
+
* Composable shortcut for `Promise.resolve`.
|
|
1104
|
+
*
|
|
1105
|
+
* Returns a Promise object that is resolved with the given value.
|
|
1106
|
+
* If the value is a thenable (i.e. has a "then" method), the returned promise will
|
|
1107
|
+
* "follow" that thenable, adopting its eventual state.
|
|
1108
|
+
*/
|
|
1109
|
+
export function resolveP<T>(value?: T): Promise<T>;
|
|
1110
|
+
|
|
1111
|
+
/**
|
|
1112
|
+
* Composable shortcut for `Promise.reject`.
|
|
1113
|
+
*
|
|
1114
|
+
* Returns a Promise object that is rejected with the given reason.
|
|
1115
|
+
*/
|
|
1116
|
+
export function rejectP<T>(value?: T): Promise<T>;
|
|
1117
|
+
|
|
1118
|
+
/**
|
|
1119
|
+
* Creates a promise which resolves/rejects after the specified milliseconds.
|
|
1120
|
+
*/
|
|
1121
|
+
export function delayP(milliseconds: number): Promise<undefined>;
|
|
1122
|
+
export function delayP<T>(options: { timeout: number; value: T }): Promise<T>;
|
|
1123
|
+
export namespace delayP {
|
|
1124
|
+
function reject(milliseconds: number): Promise<undefined>;
|
|
1125
|
+
function reject<T>(options: { timeout: number; value: T }): Promise<T>;
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
/**
|
|
1129
|
+
* Composable shortcut for `Promise.catch`.
|
|
1130
|
+
* The catchP function returns a Promise. It takes two arguments: a callback function for the rejections of the Promise
|
|
1131
|
+
* and the promise instance itself.
|
|
1132
|
+
*/
|
|
1133
|
+
export function catchP<A, B = unknown>(
|
|
1134
|
+
onRejected: (error: any) => B | Promise<B>,
|
|
1135
|
+
promise: Promise<A>
|
|
1136
|
+
): Promise<A | B>;
|
|
1137
|
+
export function catchP<A, B = unknown>(
|
|
1138
|
+
onRejected: (error: any) => B | Promise<B>
|
|
1139
|
+
): (promise: Promise<A>) => Promise<A | B>;
|
|
1140
|
+
|
|
1141
|
+
/**
|
|
1142
|
+
* Composable shortcut for `Promise.then` that allows for success and failure call backs.
|
|
1143
|
+
* The thenCatchP function returns a Promise. It takes three arguments: a callback function for the success of the Promise,
|
|
1144
|
+
* a callback function for the failure of the Promise, and the promise instance itself.
|
|
1145
|
+
*/
|
|
1146
|
+
export function thenCatchP<A, B>(
|
|
1147
|
+
onFulfilled: Function,
|
|
1148
|
+
onRejected: (error: any) => B | Promise<B>,
|
|
1149
|
+
thenable: Promise<A>
|
|
1150
|
+
): Promise<A | B>;
|
|
1151
|
+
export function thenCatchP<A, B>(
|
|
1152
|
+
onFulfilled: Function,
|
|
1153
|
+
onRejected: (error: any) => B | Promise<B>
|
|
1154
|
+
): (thenable: Promise<A>) => Promise<A | B>;
|
|
1155
|
+
export function thenCatchP<A, B>(
|
|
1156
|
+
onFulfilled: Function
|
|
1157
|
+
): (
|
|
1158
|
+
onRejected: (error: any) => B | Promise<B>
|
|
1159
|
+
) => (thenable: Promise<A>) => Promise<A | B>;
|
|
1160
|
+
|
|
1161
|
+
/**
|
|
1162
|
+
* Runs the given list of functions in order with the supplied object, then returns the object.
|
|
1163
|
+
* Also known as the normal order sequencing combinator.
|
|
1164
|
+
*
|
|
1165
|
+
* Acts as a transducer if a transformer is given as second parameter.
|
|
1166
|
+
*/
|
|
1167
|
+
export function seq<T>(fns: Function[], x: T): T;
|
|
1168
|
+
export function seq<T>(fns: Function[]): (x: T) => T;
|
|
1169
|
+
export function sequencing<T>(fns: Function[], x: T): T; // alias
|
|
1170
|
+
export function sequencing<T>(fns: Function[]): (x: T) => T; // alias
|
|
1171
|
+
|
|
1172
|
+
/**
|
|
1173
|
+
* Returns the elements of the given list or string (or object with a slice method)
|
|
1174
|
+
* from fromIndex (inclusive).
|
|
1175
|
+
* Dispatches to the slice method of the third argument, if present.
|
|
1176
|
+
*/
|
|
1177
|
+
export function sliceFrom<T>(
|
|
1178
|
+
fromIndex: number,
|
|
1179
|
+
list: string | T[]
|
|
1180
|
+
): string | T[];
|
|
1181
|
+
export function sliceFrom(
|
|
1182
|
+
fromIndex: number
|
|
1183
|
+
): <T>(list: string | T[]) => string | T[];
|
|
1184
|
+
|
|
1185
|
+
/**
|
|
1186
|
+
* Returns the elements of the given list or string (or object with a slice method)
|
|
1187
|
+
* to toIndex (exclusive).
|
|
1188
|
+
* Dispatches to the slice method of the second argument, if present.
|
|
1189
|
+
*/
|
|
1190
|
+
export function sliceTo<T>(toIndex: number, list: string | T[]): string | T[];
|
|
1191
|
+
export function sliceTo(
|
|
1192
|
+
toIndex: number
|
|
1193
|
+
): <T>(list: string | T[]) => string | T[];
|
|
1194
|
+
|
|
1195
|
+
/**
|
|
1196
|
+
* Returns a partial copy of an array omitting the indexes specified.
|
|
1197
|
+
*/
|
|
1198
|
+
export function omitIndexes<T>(indexes: number[], list: T[]): T[];
|
|
1199
|
+
export function omitIndexes(indexes: number[]): <T>(list: T[]) => T[];
|
|
1200
|
+
|
|
1201
|
+
/**
|
|
1202
|
+
* Returns `true` if the supplied list or string has a length greater than `valueLength`.
|
|
1203
|
+
*/
|
|
1204
|
+
export function lengthGt<T>(valueLength: number, list: string | T[]): boolean;
|
|
1205
|
+
export function lengthGt(
|
|
1206
|
+
valueLength: number
|
|
1207
|
+
): <T>(list: string | T[]) => boolean;
|
|
1208
|
+
|
|
1209
|
+
/**
|
|
1210
|
+
* Returns `true` if the supplied list or string has a length less than `valueLength`.
|
|
1211
|
+
*/
|
|
1212
|
+
export function lengthLt<T>(valueLength: number, list: string | T[]): boolean;
|
|
1213
|
+
export function lengthLt(
|
|
1214
|
+
valueLength: number
|
|
1215
|
+
): <T>(list: string | T[]) => boolean;
|
|
1216
|
+
|
|
1217
|
+
/**
|
|
1218
|
+
* Returns `true` if the supplied list or string has a length less than or equal to
|
|
1219
|
+
* `valueLength`.
|
|
1220
|
+
*/
|
|
1221
|
+
export function lengthLte<T>(valueLength: number, list: string | T[]): boolean;
|
|
1222
|
+
export function lengthLte(
|
|
1223
|
+
valueLength: number
|
|
1224
|
+
): <T>(list: string | T[]) => boolean;
|
|
1225
|
+
|
|
1226
|
+
/**
|
|
1227
|
+
* Returns `true` if the supplied list or string has a length greater than or equal to
|
|
1228
|
+
* `valueLength`.
|
|
1229
|
+
*/
|
|
1230
|
+
export function lengthGte<T>(valueLength: number, list: string | T[]): boolean;
|
|
1231
|
+
export function lengthGte(
|
|
1232
|
+
valueLength: number
|
|
1233
|
+
): <T>(list: string | T[]) => boolean;
|
|
1234
|
+
|
|
1235
|
+
/**
|
|
1236
|
+
* Returns `true` if the supplied list or string has a length equal to `valueLength`.
|
|
1237
|
+
*/
|
|
1238
|
+
export function lengthEq<T>(valueLength: number, list: string | T[]): boolean;
|
|
1239
|
+
export function lengthEq(
|
|
1240
|
+
valueLength: number
|
|
1241
|
+
): <T>(list: string | T[]) => boolean;
|
|
1242
|
+
|
|
1243
|
+
/**
|
|
1244
|
+
* Returns `true` if the supplied list or string has a length not equal to `valueLength`.
|
|
1245
|
+
*/
|
|
1246
|
+
export function lengthNotEq<T>(
|
|
1247
|
+
valueLength: number,
|
|
1248
|
+
list: string | T[]
|
|
1249
|
+
): boolean;
|
|
1250
|
+
export function lengthNotEq(
|
|
1251
|
+
valueLength: number
|
|
1252
|
+
): <T>(list: string | T[]) => boolean;
|
|
1253
|
+
|
|
1254
|
+
/**
|
|
1255
|
+
* Returns true if all items in the list are equivalent using `R.equals` for equality comparisons.
|
|
1256
|
+
*/
|
|
1257
|
+
export function allEqual<T>(list: T[]): boolean;
|
|
1258
|
+
|
|
1259
|
+
/**
|
|
1260
|
+
* Returns `true` if its arguments are not equivalent, `false` otherwise. Handles
|
|
1261
|
+
* cyclical data structures.
|
|
1262
|
+
*
|
|
1263
|
+
* Dispatches symmetrically to the `equals` methods of both arguments, if
|
|
1264
|
+
* present.
|
|
1265
|
+
*/
|
|
1266
|
+
export function notEqual(a: any, b: any): boolean;
|
|
1267
|
+
export function notEqual(a: any): (b: any) => boolean;
|
|
1268
|
+
|
|
1269
|
+
/**
|
|
1270
|
+
* Constructs and returns a new string which contains the specified
|
|
1271
|
+
* number of copies of the string on which it was called, concatenated together.
|
|
1272
|
+
*/
|
|
1273
|
+
export function repeatStr(value: string, count: number): string;
|
|
1274
|
+
export function repeatStr(value: string): (count: number) => string;
|
|
1275
|
+
|
|
1276
|
+
/*
|
|
1277
|
+
* Returns true if all items in the list are equivalent using `R.identical` for equality comparisons.
|
|
1278
|
+
*/
|
|
1279
|
+
export function allIdentical<T>(list: T[]): boolean;
|
|
1280
|
+
|
|
1281
|
+
/*
|
|
1282
|
+
* Returns true if all items in the list are equivalent to user provided value using `R.identical` for equality comparisons.
|
|
1283
|
+
*/
|
|
1284
|
+
export function allIdenticalTo<T>(val: T, list: T[]): boolean;
|
|
1285
|
+
export function allIdenticalTo<T>(val: T): (list: T[]) => boolean;
|
|
1286
|
+
|
|
1287
|
+
/*
|
|
1288
|
+
* Returns true if all items in the list are equivalent to user provided value using `R.equals` for equality comparisons.
|
|
1289
|
+
*/
|
|
1290
|
+
export function allEqualTo<T>(val: T, list: T[]): boolean;
|
|
1291
|
+
export function allEqualTo<T>(val: T): <T>(list: T[]) => boolean;
|
|
1292
|
+
|
|
1293
|
+
/*
|
|
1294
|
+
* Flattens the list to the specified depth.
|
|
1295
|
+
*/
|
|
1296
|
+
export function flattenDepth<T>(depth: number, list: T[]): T[];
|
|
1297
|
+
export function flattenDepth(depth: number): (list: any[]) => any[];
|
|
1298
|
+
|
|
1299
|
+
/**
|
|
1300
|
+
* Checks if input value is a `thenable`.
|
|
1301
|
+
* `thenable` is an object or function that defines a `then` method.
|
|
1302
|
+
*/
|
|
1303
|
+
export function isThenable(val: any): boolean;
|
|
1304
|
+
|
|
1305
|
+
/**
|
|
1306
|
+
* Checks if input value is a native `Promise`.
|
|
1307
|
+
* The Promise object represents the eventual completion (or failure)
|
|
1308
|
+
* of an asynchronous operation, and its resulting value.
|
|
1309
|
+
*/
|
|
1310
|
+
export function isPromise(val: any): val is Promise<any>;
|
|
1311
|
+
|
|
1312
|
+
/**
|
|
1313
|
+
* Checks if input value is the Boolean primitive `true`. Will return false for Boolean
|
|
1314
|
+
* objects created using the `Boolean` function as a constructor.
|
|
1315
|
+
*/
|
|
1316
|
+
export function isTrue(val: any): boolean;
|
|
1317
|
+
|
|
1318
|
+
/**
|
|
1319
|
+
* Checks if input value is the Boolean primitive `false`. Will return false for Boolean objects created using the `Boolean` function as a constructor.
|
|
1320
|
+
*/
|
|
1321
|
+
export function isFalse(val: any): boolean;
|
|
1322
|
+
|
|
1323
|
+
/**
|
|
1324
|
+
* In JavaScript, a `truthy` value is a value that is considered true
|
|
1325
|
+
* when evaluated in a Boolean context. All values are truthy unless
|
|
1326
|
+
* they are defined as falsy (i.e., except for `false`, `0`, `""`, `null`, `undefined`, and `NaN`).
|
|
1327
|
+
*/
|
|
1328
|
+
export function isTruthy(val: any): boolean;
|
|
1329
|
+
|
|
1330
|
+
/**
|
|
1331
|
+
* A falsy value is a value that translates to false when evaluated in a Boolean context.
|
|
1332
|
+
* Falsy values are `false`, `0`, `""`, `null`, `undefined`, and `NaN`.
|
|
1333
|
+
*/
|
|
1334
|
+
export function isFalsy(val: any): boolean;
|
|
1335
|
+
|
|
1336
|
+
/**
|
|
1337
|
+
* Returns the second argument if predicate function returns `true`,
|
|
1338
|
+
* otherwise the third argument is returned.
|
|
1339
|
+
*/
|
|
1340
|
+
export function defaultWhen<DefVal, Val>(
|
|
1341
|
+
predicate: Function,
|
|
1342
|
+
defaultVal: DefVal,
|
|
1343
|
+
val: Val
|
|
1344
|
+
): DefVal | Val;
|
|
1345
|
+
export function defaultWhen<DefVal, Val>(
|
|
1346
|
+
predicate: Function,
|
|
1347
|
+
defaultVal: DefVal
|
|
1348
|
+
): (val: Val) => DefVal | Val;
|
|
1349
|
+
export function defaultWhen(
|
|
1350
|
+
predicate: Function
|
|
1351
|
+
): <DefVal, Val>(defaultVal: DefVal) => (val: Val) => DefVal | Val;
|
|
1352
|
+
|
|
1353
|
+
/**
|
|
1354
|
+
* Returns the first element of the list which matches the predicate.
|
|
1355
|
+
* Returns default value if no element matches or matched element is `null`, `undefined` or `NaN`.
|
|
1356
|
+
* Dispatches to the find method of the second argument, if present.
|
|
1357
|
+
* Acts as a transducer if a transformer is given in list position.
|
|
1358
|
+
*/
|
|
1359
|
+
export function findOr<DefVal, T>(
|
|
1360
|
+
defaultVal: DefVal,
|
|
1361
|
+
predicate: (element: T) => boolean,
|
|
1362
|
+
list: ReadonlyArray<T>
|
|
1363
|
+
): T | DefVal;
|
|
1364
|
+
export function findOr<DefVal, T>(
|
|
1365
|
+
defaultVal: DefVal,
|
|
1366
|
+
predicate: (element: T) => boolean
|
|
1367
|
+
): (list: ReadonlyArray<T>) => T | DefVal;
|
|
1368
|
+
export function findOr<DefVal, T>(
|
|
1369
|
+
defaultVal: DefVal
|
|
1370
|
+
): {
|
|
1371
|
+
(predicate: (element: T) => boolean, list: ReadonlyArray<T>): T | DefVal;
|
|
1372
|
+
(predicate: (element: T) => boolean): (list: ReadonlyArray<T>) => T | DefVal;
|
|
1373
|
+
};
|
|
1374
|
+
|
|
1375
|
+
/**
|
|
1376
|
+
* Y-combinator
|
|
1377
|
+
*
|
|
1378
|
+
* The Y combinator is an interesting function which only works with functional languages,
|
|
1379
|
+
* showing how recursion can still be done even without any variable or function declarations,
|
|
1380
|
+
* only functions and parameters
|
|
1381
|
+
*/
|
|
1382
|
+
export function Y(le: Function): Function;
|
|
1383
|
+
|
|
1384
|
+
/**
|
|
1385
|
+
* A function which calls the two provided functions and returns the complement of `&&`ing
|
|
1386
|
+
* the results. It returns true if the first function is false-y and the complement of the
|
|
1387
|
+
* second function otherwise. Note that this is short-circuited, meaning that the second
|
|
1388
|
+
* function will not be invoked if the first returns a false-y value. In short it will
|
|
1389
|
+
* return true unless both predicates return true.
|
|
1390
|
+
*
|
|
1391
|
+
* In addition to functions, `RA.notBoth` also accepts any fantasy-land compatible
|
|
1392
|
+
* applicative functor.
|
|
1393
|
+
*/
|
|
1394
|
+
export function notBoth(
|
|
1395
|
+
firstPredicate: Function,
|
|
1396
|
+
secondPredicate: Function
|
|
1397
|
+
): Function;
|
|
1398
|
+
|
|
1399
|
+
/**
|
|
1400
|
+
* A function which calls the two provided functions and returns the complement of `||`ing
|
|
1401
|
+
* the results. It returns false if the first function is truth-y and the complement of the
|
|
1402
|
+
* second function otherwise. Note that this is short-circuited, meaning that the second
|
|
1403
|
+
* function will not be invoked if the first returns a truth-y value. In short it will
|
|
1404
|
+
* return true if neither predicate returns true.
|
|
1405
|
+
*
|
|
1406
|
+
* In addition to functions, `RA.neither` also accepts any fantasy-land compatible
|
|
1407
|
+
* applicative functor.
|
|
1408
|
+
*/
|
|
1409
|
+
export function neither(
|
|
1410
|
+
firstPredicate: Function,
|
|
1411
|
+
secondPredicate: Function
|
|
1412
|
+
): Function;
|
|
1413
|
+
|
|
1414
|
+
/**
|
|
1415
|
+
* Returns false if both arguments are truesy; true otherwise.
|
|
1416
|
+
*/
|
|
1417
|
+
export function nand(a: any, b: any): Boolean;
|
|
1418
|
+
export function nand(a: any): (b: any) => Boolean;
|
|
1419
|
+
|
|
1420
|
+
/**
|
|
1421
|
+
* Returns true if both arguments are falsy; false otherwise.
|
|
1422
|
+
*/
|
|
1423
|
+
export function nor(a: any, b: any): Boolean;
|
|
1424
|
+
export function nor(a: any): (b: any) => Boolean;
|
|
1425
|
+
|
|
1426
|
+
/**
|
|
1427
|
+
* Takes a list of predicates and returns a predicate that returns true for a given list of
|
|
1428
|
+
* arguments if one or more of the provided predicates is not satisfied by those arguments.
|
|
1429
|
+
* It is the complement of Ramda's allPass.
|
|
1430
|
+
*
|
|
1431
|
+
* The function returned is a curried function whose arity matches that of the
|
|
1432
|
+
* highest-arity predicate.
|
|
1433
|
+
*/
|
|
1434
|
+
export function notAllPass(predicates: Function[]): Function;
|
|
1435
|
+
|
|
1436
|
+
/**
|
|
1437
|
+
* Takes a list of predicates and returns a predicate that returns true for a given list of
|
|
1438
|
+
* arguments if none of the provided predicates are satisfied by those arguments. It is the
|
|
1439
|
+
* complement of Ramda's anyPass.
|
|
1440
|
+
*
|
|
1441
|
+
* The function returned is a curried function whose arity matches that of the
|
|
1442
|
+
* highest-arity predicate.
|
|
1443
|
+
*/
|
|
1444
|
+
export function nonePass(predicates: Function[]): Function;
|
|
1445
|
+
|
|
1446
|
+
/**
|
|
1447
|
+
* Takes a combining predicate and a list of functions and returns a function which will map
|
|
1448
|
+
* the arguments it receives to the list of functions and returns the result of passing the
|
|
1449
|
+
* values returned from each function to the combining predicate. A combining predicate is a
|
|
1450
|
+
* function that combines a list of Boolean values into a single Boolean value, such as
|
|
1451
|
+
* `R.any` or `R.all`. It will test each value using `RA.isTruthy`, meaning the functions
|
|
1452
|
+
* don't necessarily have to be predicates.
|
|
1453
|
+
*
|
|
1454
|
+
* The function returned is curried to the number of functions supplied, and if called with
|
|
1455
|
+
* more arguments than functions, any remaining arguments are passed in to the combining
|
|
1456
|
+
* predicate untouched.
|
|
1457
|
+
*/
|
|
1458
|
+
export function argsPass<T>(
|
|
1459
|
+
combiningPredicate: (fn: (a: T) => boolean) => (list: T[]) => boolean,
|
|
1460
|
+
predicates: Pred[]
|
|
1461
|
+
): Pred;
|
|
1462
|
+
export function argsPass<T>(
|
|
1463
|
+
combiningPredicate: (fn: (a: T) => boolean) => (list: T[]) => boolean
|
|
1464
|
+
): (predicates: Pred[]) => Pred;
|
|
1465
|
+
|
|
1466
|
+
/**
|
|
1467
|
+
* Returns a function which is called with the given arguments. If any of the given arguments are null or undefined,
|
|
1468
|
+
* the corresponding default value for that argument is used instead.
|
|
1469
|
+
*/
|
|
1470
|
+
export function fnull(fn: Function, defaults: any[]): Function;
|
|
1471
|
+
export function fnull(fn: Function): (defaults: any[]) => Function;
|
|
1472
|
+
|
|
1473
|
+
/**
|
|
1474
|
+
* Accepts a function with any arity and returns a function with arity of zero.
|
|
1475
|
+
* The returned function ignores any arguments supplied to it.
|
|
1476
|
+
*/
|
|
1477
|
+
export function dropArgs(fn: Function): Function;
|
|
1478
|
+
|
|
1479
|
+
/**
|
|
1480
|
+
* Creates an array with all falsy values removed.
|
|
1481
|
+
* The values false, null, 0, "", undefined, and NaN are falsy.
|
|
1482
|
+
*/
|
|
1483
|
+
export function compact<T>(
|
|
1484
|
+
list: T[]
|
|
1485
|
+
): Array<Exclude<NonNullable<T>, false | '' | 0>>;
|
|
1486
|
+
|
|
1487
|
+
/**
|
|
1488
|
+
* Returns a new list containing the contents of the given list, followed by the given
|
|
1489
|
+
* element. Like {@link http://ramdajs.com/docs/#append|R.append} but with argument order
|
|
1490
|
+
* reversed.
|
|
1491
|
+
*/
|
|
1492
|
+
export function appendFlipped<T>(list: T[], val: any): T[];
|
|
1493
|
+
export function appendFlipped<T>(list: T[]): (val: any) => T[];
|
|
1494
|
+
|
|
1495
|
+
/**
|
|
1496
|
+
* Returns true if the specified value is equal, in R.equals terms,
|
|
1497
|
+
* to at least one element of the given list or false otherwise.
|
|
1498
|
+
* Given list can be a string.
|
|
1499
|
+
*
|
|
1500
|
+
* Like {@link http://ramdajs.com/docs/#contains|R.includes} but with argument order reversed.
|
|
1501
|
+
*/
|
|
1502
|
+
export function included<T>(list: T[], val: T): boolean;
|
|
1503
|
+
export function included<T>(list: T[]): (val: T) => boolean;
|
|
1504
|
+
|
|
1505
|
+
/**
|
|
1506
|
+
* Can be used as a way to compose multiple invokers together to form polymorphic functions,
|
|
1507
|
+
* or functions that exhibit different behaviors based on their argument(s).
|
|
1508
|
+
* Consumes dispatching functions and keep trying to invoke each in turn, until a non-nil value is returned.
|
|
1509
|
+
*
|
|
1510
|
+
* Accepts a list of dispatching functions and returns a new function.
|
|
1511
|
+
* When invoked, this new function is applied to some arguments,
|
|
1512
|
+
* each dispatching function is applied to those same arguments until one of the
|
|
1513
|
+
* dispatching functions returns a non-nil value.
|
|
1514
|
+
*/
|
|
1515
|
+
export function dispatch(functions: Function[]): Function;
|
|
1516
|
+
|
|
1517
|
+
/**
|
|
1518
|
+
* Returns a new list with the item at the position `fromIdx` moved to the position `toIdx`.
|
|
1519
|
+
* If the `toIdx` is out of the `list` range, the item will be placed at the last position
|
|
1520
|
+
* of the `list`. When negative indices are provided, the behavior of the move is
|
|
1521
|
+
* unspecified.
|
|
1522
|
+
*/
|
|
1523
|
+
export function move<T>(fromIdx: number, toIdx: number, list: T[]): T[];
|
|
1524
|
+
export function move<T>(fromIdx: number): (toIdx: number, list: T[]) => T[];
|
|
1525
|
+
export function move<T>(fromIdx: number): {
|
|
1526
|
+
(toIdx: number, list: T[]): T[];
|
|
1527
|
+
(toIdx: number): (list: T[]) => T[];
|
|
1528
|
+
};
|
|
1529
|
+
|
|
1530
|
+
/**
|
|
1531
|
+
* Returns the value of a number rounded to the nearest integer.
|
|
1532
|
+
*/
|
|
1533
|
+
export function round(val: number): number;
|
|
1534
|
+
|
|
1535
|
+
/**
|
|
1536
|
+
* Subtracts its first argument from its second argument.
|
|
1537
|
+
*/
|
|
1538
|
+
export function subtractNum(subtrahend: number, minuend: number): number;
|
|
1539
|
+
export function subtractNum(subtrahend: number): (minuend: number) => number;
|
|
1540
|
+
|
|
1541
|
+
/**
|
|
1542
|
+
* Returns the smallest integer greater than or equal to a given number.
|
|
1543
|
+
*
|
|
1544
|
+
* Note: ceil(null) returns integer 0 and does not give a NaN error.
|
|
1545
|
+
*/
|
|
1546
|
+
export function ceil(val: number): number;
|
|
1547
|
+
|
|
1548
|
+
/**
|
|
1549
|
+
* Returns the largest integer less than or equal to a given number.
|
|
1550
|
+
*
|
|
1551
|
+
* Note: floor(null) returns integer 0 and do not give a NaN error.
|
|
1552
|
+
*/
|
|
1553
|
+
export function floor(val: number): number;
|
|
1554
|
+
|
|
1555
|
+
/**
|
|
1556
|
+
* Returns the integer part of a number by removing any fractional digits.
|
|
1557
|
+
*
|
|
1558
|
+
*/
|
|
1559
|
+
export function trunc(val: number): number;
|
|
1560
|
+
|
|
1561
|
+
/**
|
|
1562
|
+
* Returns the sign of a number, indicating whether the number is positive, negative or zero.
|
|
1563
|
+
*/
|
|
1564
|
+
export function sign(val: number): number;
|
|
1565
|
+
|
|
1566
|
+
/**
|
|
1567
|
+
* Takes a generator function and returns an async function.
|
|
1568
|
+
* The async function returned is a curried function whose arity matches that of the generator function.
|
|
1569
|
+
*
|
|
1570
|
+
* Note: This function is handy for environments that does support generators but doesn't support async/await.
|
|
1571
|
+
*/
|
|
1572
|
+
export function async(generatorFn: Function): Function;
|
|
1573
|
+
|
|
1574
|
+
/**
|
|
1575
|
+
* Replace all substring matches in a string with a replacement.
|
|
1576
|
+
*/
|
|
1577
|
+
export function replaceAll(
|
|
1578
|
+
searchValue: string | RegExp,
|
|
1579
|
+
replaceValue: string,
|
|
1580
|
+
str: string
|
|
1581
|
+
): string;
|
|
1582
|
+
export function replaceAll(
|
|
1583
|
+
searchValue: string | RegExp
|
|
1584
|
+
): (replaceValue: string, str: string) => string;
|
|
1585
|
+
export function replaceAll(searchValue: string | RegExp): {
|
|
1586
|
+
(replaceValue: string, str: string): string;
|
|
1587
|
+
(replaceValue: string): (str: string) => string;
|
|
1588
|
+
};
|
|
1589
|
+
|
|
1590
|
+
/**
|
|
1591
|
+
* Escapes the RegExp special characters.
|
|
1592
|
+
*/
|
|
1593
|
+
export function escapeRegExp(val: string): string;
|
|
1594
|
+
|
|
1595
|
+
/**
|
|
1596
|
+
* Divides two numbers, where the second number is divided by the first number.
|
|
1597
|
+
*/
|
|
1598
|
+
export function divideNum(divisor: number, dividend: number): number;
|
|
1599
|
+
export function divideNum(divisor: number): (dividend: number) => number;
|
|
1600
|
+
|
|
1601
|
+
/**
|
|
1602
|
+
* Identity type.
|
|
1603
|
+
*/
|
|
1604
|
+
export const Identity: Function;
|
|
1605
|
+
|
|
1606
|
+
/**
|
|
1607
|
+
* Converts value to an array.
|
|
1608
|
+
*/
|
|
1609
|
+
export function toArray<T>(iterable: Iterable<T> | T): any[];
|
|
1610
|
+
|
|
1611
|
+
/**
|
|
1612
|
+
* Returns true if all items in the list are unique. `R.equals` is used to determine equality.
|
|
1613
|
+
*/
|
|
1614
|
+
export function allUnique<T>(list: T[]): boolean;
|
|
1615
|
+
|
|
1616
|
+
/**
|
|
1617
|
+
* Returns true if at least one item of the list is repeated. `R.equals` is used to determine equality.
|
|
1618
|
+
*/
|
|
1619
|
+
export function notAllUnique<T>(list: T[]): boolean;
|
|
1620
|
+
|
|
1621
|
+
/**
|
|
1622
|
+
* Removes whitespace from the beginning of a string
|
|
1623
|
+
*/
|
|
1624
|
+
export function trimStart(value: string): string;
|
|
1625
|
+
export function trimLeft(value: string): string;
|
|
1626
|
+
|
|
1627
|
+
/**
|
|
1628
|
+
* Removes whitespace from the end of a string.
|
|
1629
|
+
*/
|
|
1630
|
+
export function trimEnd(value: string): string;
|
|
1631
|
+
export function trimRight(value: string): string;
|
|
1632
|
+
|
|
1633
|
+
/**
|
|
1634
|
+
* Removes specified characters from the end of a string.
|
|
1635
|
+
*/
|
|
1636
|
+
export function trimCharsEnd(chars: string, value: string): string;
|
|
1637
|
+
export function trimCharsEnd(chars: string): (value: string) => string;
|
|
1638
|
+
|
|
1639
|
+
/**
|
|
1640
|
+
* Removes specified characters from the beginning of a string.
|
|
1641
|
+
*/
|
|
1642
|
+
export function trimCharsStart(chars: string, value: string): string;
|
|
1643
|
+
export function trimCharsStart(chars: string): (value: string) => string;
|
|
1644
|
+
|
|
1645
|
+
/**
|
|
1646
|
+
* The function pads the current string with a given string
|
|
1647
|
+
* (repeated, if needed) so that the resulting string reaches a given length.
|
|
1648
|
+
* The padding is applied from the end of the current string.
|
|
1649
|
+
*/
|
|
1650
|
+
export function padCharsEnd(
|
|
1651
|
+
padString: string,
|
|
1652
|
+
targetLength: number,
|
|
1653
|
+
value: string
|
|
1654
|
+
): string;
|
|
1655
|
+
export function padCharsEnd(
|
|
1656
|
+
padString: string,
|
|
1657
|
+
targetLength: number
|
|
1658
|
+
): (value: string) => string;
|
|
1659
|
+
export function padCharsEnd(
|
|
1660
|
+
padString: string
|
|
1661
|
+
): (targetLength: number, value: string) => string;
|
|
1662
|
+
|
|
1663
|
+
/**
|
|
1664
|
+
* The function pads the current string with an empty string
|
|
1665
|
+
* so that the resulting string reaches a given length.
|
|
1666
|
+
* The padding is applied from the end of the current string.
|
|
1667
|
+
*/
|
|
1668
|
+
export function padEnd(targetLength: number, value: string): string;
|
|
1669
|
+
export function padEnd(targetLength: number): (value: string) => string;
|
|
1670
|
+
|
|
1671
|
+
/**
|
|
1672
|
+
* The function pads the current string with a given string
|
|
1673
|
+
* (repeated, if needed) so that the resulting string reaches a given lenght.
|
|
1674
|
+
* The padding is applied to the start of the current string.
|
|
1675
|
+
*/
|
|
1676
|
+
export function padCharsStart(
|
|
1677
|
+
padString: string,
|
|
1678
|
+
targetLength: number,
|
|
1679
|
+
value: string
|
|
1680
|
+
): string;
|
|
1681
|
+
export function padCharsStart(
|
|
1682
|
+
padString: string,
|
|
1683
|
+
targetLength: number
|
|
1684
|
+
): (value: string) => string;
|
|
1685
|
+
export function padCharsStart(
|
|
1686
|
+
padString: string
|
|
1687
|
+
): (targetLength: number, value: string) => string;
|
|
1688
|
+
|
|
1689
|
+
/**
|
|
1690
|
+
* Pads string on the left side if it's shorter than length.
|
|
1691
|
+
*/
|
|
1692
|
+
export function padStart(targetLength: number, value: string): string;
|
|
1693
|
+
export function padStart(targetLength: number): (value: string) => string;
|
|
1694
|
+
|
|
1695
|
+
/**
|
|
1696
|
+
* Sort a list of objects by a list of props (if first prop value is equivalent, sort by second, etc).
|
|
1697
|
+
*/
|
|
1698
|
+
export function sortByProps(props: string[], list: object[]): object[];
|
|
1699
|
+
export function sortByProps(props: string[]): (list: object[]) => object[];
|
|
1700
|
+
|
|
1701
|
+
/**
|
|
1702
|
+
* When given a number n and an array, returns an array containing every nth element.
|
|
1703
|
+
*/
|
|
1704
|
+
export function skipTake<T>(n: number, list: T[]): T[];
|
|
1705
|
+
export function skipTake<T>(n: number): (list: T[]) => T[];
|
|
1706
|
+
|
|
1707
|
+
/**
|
|
1708
|
+
* Sort a list of objects by a list of paths (if first path value is equivalent, sort by second, etc).
|
|
1709
|
+
*/
|
|
1710
|
+
export function sortByPaths(props: string[][], list: object[]): object[];
|
|
1711
|
+
export function sortByPaths(props: string[][]): (list: object[]) => object[];
|
|
1712
|
+
|
|
1713
|
+
/**
|
|
1714
|
+
* Determine if input value is an indexed data type.
|
|
1715
|
+
*/
|
|
1716
|
+
export function isIndexed(val: any): val is string | any[];
|
|
1717
|
+
|
|
1718
|
+
/**
|
|
1719
|
+
* Invokes the method at path of object with given arguments.
|
|
1720
|
+
*/
|
|
1721
|
+
export function invokeArgs(
|
|
1722
|
+
pathToMethod: string[],
|
|
1723
|
+
args: any[],
|
|
1724
|
+
obj: object
|
|
1725
|
+
): any;
|
|
1726
|
+
export function invokeArgs(
|
|
1727
|
+
pathToMethod: string[],
|
|
1728
|
+
args: any[]
|
|
1729
|
+
): (obj: object) => any;
|
|
1730
|
+
export function invokeArgs(
|
|
1731
|
+
pathToMethod: string[]
|
|
1732
|
+
): (args: any[], obj: object) => any;
|
|
1733
|
+
|
|
1734
|
+
/**
|
|
1735
|
+
* Invokes the method at path of object.
|
|
1736
|
+
*/
|
|
1737
|
+
export function invoke(pathToMethod: string[], obj: object): any;
|
|
1738
|
+
export function invoke(pathToMethod: string[]): (obj: object) => any;
|
|
1739
|
+
|
|
1740
|
+
/**
|
|
1741
|
+
* Converts double-precision 64-bit binary format IEEE 754 to signed 32 bit integer number.
|
|
1742
|
+
*/
|
|
1743
|
+
export function toInteger32(n: number): number;
|
|
1744
|
+
export function toInt32(n: number): number; // alias
|
|
1745
|
+
|
|
1746
|
+
/**
|
|
1747
|
+
* Converts double-precision 64-bit binary format IEEE 754 to unsigned 32 bit integer number.
|
|
1748
|
+
*/
|
|
1749
|
+
export function toUinteger32(val: number): number;
|
|
1750
|
+
export function toUint32(val: number): number; // alias
|
|
1751
|
+
|
|
1752
|
+
/**
|
|
1753
|
+
* Converts value to a number.
|
|
1754
|
+
*/
|
|
1755
|
+
export function toNumber(val: any): number;
|
|
1756
|
+
|
|
1757
|
+
/**
|
|
1758
|
+
* Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end.
|
|
1759
|
+
*
|
|
1760
|
+
* `Note`: JavaScript follows the IEEE-754 standard for resolving floating-point values which can produce unexpected results.
|
|
1761
|
+
*/
|
|
1762
|
+
export function rangeStep(step: number, from: number, to: number): number[];
|
|
1763
|
+
export function rangeStep(step: number, from: number): (to: number) => number[];
|
|
1764
|
+
export function rangeStep(step: number): {
|
|
1765
|
+
(from: number, to: number): number[];
|
|
1766
|
+
(from: number): (to: number) => number[];
|
|
1767
|
+
};
|
|
1768
|
+
|
|
1769
|
+
/**
|
|
1770
|
+
* Returns true if two lists have at least one element common to both lists.
|
|
1771
|
+
*/
|
|
1772
|
+
export function overlaps<T>(list1: T[], list2: T[]): boolean;
|
|
1773
|
+
export function overlaps<T>(list1: T[]): (list2: T[]) => boolean;
|
|
1774
|
+
|
|
1775
|
+
export as namespace RA;
|