-
-
Notifications
You must be signed in to change notification settings - Fork 86
/
index.d.ts
1288 lines (1100 loc) · 49.5 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
declare var RA: RamdaAdjunct.Static;
// TypeScript Version: 2.4
declare namespace RamdaAdjunct {
interface Functor<T> {
map<U>(fn: (t: T) => U): Functor<U>;
}
interface Apply<T> extends Functor<T> {
ap<U>(fn: Apply<(t: T) => U>): Apply<U>;
}
interface Foldable<T> {
reduce<Acc>(fn: (acc: Acc, val: T) => Acc, initAcc: Acc): Acc;
}
interface Semigroup {
// https://www.typescriptlang.org/docs/handbook/advanced-types.html#polymorphic-this-types
concat(other: this): this;
}
interface Catamorphism<T> {
cata<T1>(leftFn: (v: T1) => T, rightFn: (v: T1) => T): T;
}
enum SettledPromiseStatus {
Fulfilled = "fulfilled",
Rejected = "rejected",
}
interface SettledPromise<T> {
status: SettledPromiseStatus;
value: T;
}
type Variadic<T1, T2> = (...args: T1[]) => T2;
type Pred = (...a: any[]) => boolean;
interface Dictionary<T> { [key: string]: T; }
type DictPred<T> = (value: T, key: string) => boolean;
interface Static {
/**
* Checks if input value is `Array`.
*/
isArray(val: any): val is any[];
/**
* Checks whether the passed value is iterable.
*/
isIterable(val: any): boolean;
/**
* Checks if input value is an empty `Array`.
*/
isEmptyArray(val: any): val is any[];
/**
* Checks if input value is `Boolean`.
*/
isBoolean(val: any): val is boolean;
/**
* Returns `true` if the given value is its type's empty value, `null` or `undefined`.
*/
isNilOrEmpty(val: any): boolean;
/**
* Returns `true` if the given value is not its type's empty value, nor `null` nor `undefined`.
*/
isNotNilOrEmpty(val: any): boolean;
/**
* Checks if input value is complement of `Array`.
*/
isNotArray(val: any): boolean;
/**
* Checks if input value is a non empty `Array`.
*/
isNonEmptyArray(val: any): val is any[];
/**
* Checks if input value is complement of `Boolean`.
*/
isNotBoolean(val: any): boolean;
/**
* Returns true if the given value is not its type's empty value; `false` otherwise.
*/
isNotEmpty(val: any): boolean;
/**
* Checks if input value is complement of `null` or `undefined`.
*/
isNotNil(val: any): boolean;
/**
* Checks if input value is complement of `null`.
*/
isNotNull(val: any): boolean;
/**
* Checks if input value is complement of `String`.
*/
isNotString(val: any): boolean;
/**
* Checks if input value is a non empty `String`.
*/
isNonEmptyString(val: any): boolean;
/**
* Checks if input value is complement `undefined`.
*/
isNotUndefined(val: any): boolean;
/**
* Checks if input value is `Symbol`.
*/
isSymbol(val: any): val is Symbol;
/**
* Checks if input value is `null`.
*/
isNull(val: any): val is null;
/**
* Checks if input value is `String`.
*/
isString(val: any): val is string;
/**
* Checks if input value is an empty `String`.
*/
isEmptyString(val: any): val is string;
/**
* Checks if input value is `undefined`.
*/
isUndefined(val: any): val is undefined;
/**
* Tests whether or not an object is similar to an array.
*/
isArrayLike(val: any): boolean;
/**
* Tests whether or not an object is similar to an array.
*/
isNotArrayLike(val: any): boolean;
/**
* Checks if input value is `Generator Function`.
*/
isGeneratorFunction(val: any): val is Function;
/**
* Checks if input value is complement of `Generator Function`.
*/
isNotGeneratorFunction(val: any): boolean;
/**
* Checks if input value is `Async Function`.
*/
isAsyncFunction(val: any): val is Function;
/**
* Checks if input value is complement of `Async Function`.
*/
isNotAsyncFunction(val: any): boolean;
/**
* Checks if input value is `Function`.
*/
isFunction(val: any): val is Function;
/**
* Checks if input value is complement of `Function`.
*/
isNotFunction(val: any): boolean;
/**
* Checks if input value is language type of `Object`.
*/
isObj(val: any): val is {} | Function;
isObject(val: any): val is {} | Function; // alias
/**
* Checks if input value is complement of language type of `Object`.
*/
isNotObj(val: any): boolean;
isNotObject(val: any): boolean; // alias
/**
* Checks if value is object-like. A value is object-like if it's not null and has a typeof result of "object".
*/
isObjLike(val: any): val is object;
isObjectLike(val: any): val is object; // alias
/**
* Checks if value is not object-like.
* A value is object-like if it's not null and has a typeof result of "object".
*/
isNotObjLike(val: any): boolean;
isNotObjectLike(val: any): boolean; // alias
/**
* Check to see if an object is a plain object (created using `{}`, `new Object()` or `Object.create(null)`).
*/
isPlainObj(val: any): val is object;
isPlainObject(val: any): val is object; // alias
/**
* Check to see if an object is not a plain object
* (created using `{}`, `new Object()` or `Object.create(null)`).
*/
isNotPlainObj(val: any): boolean;
isNotPlainObject(val: any): boolean; // alias
/**
* Checks if value is `Date` object.
*/
isDate(val: any): val is Date;
/**
* Checks if value is complement of `Date` object.
*/
isNotDate(val: any): boolean;
/**
* Checks if value is valid `Date` object.
*/
isValidDate(val: any): val is Date;
/**
* Checks if value is complement of valid `Date` object.
*/
isNotValidDate(val: any): boolean;
/**
* Checks if value is complement of valid `Date` object.
*/
isInvalidDate(val: any): boolean; // alias of isNotValidDate
/**
* Checks if value is `Map`.
*/
isMap(val: any): val is Map<any, any>;
/**
* Checks whether the passed value is `NaN` and its type is `Number`.
* It is a more robust version of the original, global isNaN().
*/
isNaN(val: any): val is typeof NaN;
/**
* Checks whether the passed value is complement of `NaN` and its type is not `Number`.
*/
isNotNaN(val: any): boolean;
/**
* Checks if value is a `Number` primitive or object.
*/
isNumber(val: any): val is number;
/**
* Checks if value is a complement of `Number` primitive or object.
*/
isNotNumber(val: any): boolean;
/**
* Checks if value is a positive `Number` primitive or object. Zero is considered neither
* positive or negative.
*/
isPositive(val: any): val is number;
/**
* Checks if value is a negative `Number` primitive or object. Zero is considered neither
* positive or negative.
*/
isNegative(val: any): val is number;
/**
* Checks if value is a positive zero (+0).
*/
isPositiveZero(val: any): boolean;
/**
* Checks if value is a negative zero (-0).
*/
isNegativeZero(val: any): boolean;
/**
* Checks if value is a non-positive `Number` primitive or object. This includes all
* negative numbers and zero.
*/
isNonPositive(val: any): val is number;
/**
* Checks if value is a non-negative `Number` primitive or object. This includes all
* positive numbers and zero.
*/
isNonNegative(val: any): val is number;
/**
* Checks whether the passed value is a finite `Number`.
*/
isFinite(val: any): boolean;
/**
* Checks whether the passed value is complement of finite `Number`.
*/
isNotFinite(val: any): boolean;
/**
* Checks whether the passed value is an `integer`.
*/
isInteger(val: any): val is number;
/**
* Checks whether the passed value is complement of `integer`.
*/
isNotInteger(val: any): boolean;
/**
* Checks whether the passed value is a `float`.
*/
isFloat(val: any): val is number;
/**
* Checks whether the passed value is a safe `integer`.
*/
isSafeInteger(val: any): boolean;
/**
* Checks whether the passed value is complement of a `float`.
*/
isNotFloat(val: any): boolean;
/**
* Checks if value is a valid `Number`. A valid `Number` is a number that is not `NaN`,
* `Infinity` or `-Infinity`.
*/
isValidNumber(val: any): boolean;
/**
* Checks if value is not a valid `Number`. A valid `Number` is a number that is not `NaN`,
* `Infinity` or `-Infinity`.
*/
isNotValidNumber(val: any): boolean;
/**
* Checks if value is odd integer number.
* An odd number is an integer which is not a multiple DIVISIBLE of two.
*/
isOdd(val: any): boolean;
/**
* Checks if value is even integer number.
* An even number is an integer which is "evenly divisible" by two.
* Zero is an even number because zero divided by two equals zero,
* which despite not being a natural number, is an integer.
* Even numbers are either positive or negative.
*/
isEven(val: any): boolean;
/**
* Checks if input value is a pair.
*/
isPair(val: any): val is any[];
/**
* Checks if input value is complement of a pair.
*/
isNotPair(val: any): boolean;
/**
* Checks if value is `RegExp` object.
*/
isRegExp(val: any): boolean;
/**
* Checks if value is `Set`.
*/
isSet(val: any): val is Set<any>;
/**
* Checks if value is complement of `RegExp` object.
*/
isNotRegExp(val: any): boolean;
/**
* Checks if input value is a sparse Array.
* An array with at least one "empty slot" in it is often called a "sparse array."
* Empty slot doesn't mean that the slot contains `null` or `undefined` values,
* but rather that the slots don't exist.
*/
isSparseArray(val: any): boolean;
/**
* A function that returns `undefined`.
*/
stubUndefined(): undefined;
/**
* A function that returns `null`.
*/
stubNull(): null;
/**
* A function that returns new empty array on every call.
*/
stubArray(): any[];
/**
* This function returns a new empty object.
*/
stubObj(): {};
stubObject(): {}; // alias
/**
* A function that returns empty string.
*/
stubString(): "";
/**
* A function that performs no operations.
*/
noop(...args: any[]): undefined;
/**
* Picks values from list by indexes.
*/
pickIndexes<T>(indexes: number[], list: T[]): T[];
pickIndexes(indexes: number[]): <T>(list: T[]) => T[];
/**
* Creates a list from from arguments.
*/
list(...items: any[]): any[];
/**
* Returns a singleton array containing the value provided.
* If value is already an array, it is returned as is.
*/
ensureArray<T>(value: T | T[]): T[];
/**
* Returns the result of concatenating the given lists or strings.
* Note: RA.concatAll expects all elements to be of the same type.
* It will throw an error if you concat an Array with a non-Array value.
* Dispatches to the concat method of the preceding element, if present.
* Can also concatenate multiple elements of a [fantasy-land compatible semigroup](https://github.com/fantasyland/fantasy-land#semigroup).
* Returns undefined if empty array was passed.
*/
concatAll<S extends Semigroup>(foldable: Foldable<S>): S | undefined;
/**
* Returns the result of concatenating the given lists or strings.
*/
concatRight<T extends any[]>(firstList: T, secondList: T): T;
concatRight<T extends any[]>(firstList: T): (secondList: T) => T;
concatRight(firstList: string, secondList: string): string;
concatRight(firstList: string): (secondList: string) => string;
/**
* Acts as multiple path: arrays of paths in, array of values out. Preserves order.
*/
paths(ps: Array<Array<string | number>>, obj: object): any[];
paths(ps: Array<Array<string | number>>): (obj: object) => any[];
/**
* If the given, non-null object has a value at the given path, returns the value at that path.
* Otherwise returns the result of invoking the provided function with the object.
*/
pathOrLazy<T>(
defaultValueFn: () => T,
path: Array<number | string>,
obj: object
): T;
pathOrLazy<T>(
defaultValueFn: () => T,
path: Array<number | string>
): (obj: object) => T;
pathOrLazy<T>(
defaultValueFn: () => T
): {
(path: Array<number | string>, obj: object): T;
(path: Array<number | string>): (obj: object) => T;
};
/**
* "lifts" a function to be the specified arity, so that it may "map over" objects that satisfy
* the Apply spec of fantasy land.
*/
liftFN<T>(arity: number, fn: Variadic<Apply<T>, T>): Apply<T>;
liftFN(arity: number): <T>(fn: Variadic<Apply<T>, T>) => Apply<T>;
/**
* "lifts" a function of arity > 1 so that it may "map over" objects that satisfy
* the Apply spec of fantasy land.
*/
liftF<T>(fn: Variadic<Apply<T>, T>): Apply<T>;
/**
* The catamorphism for either. If the either is right than the right function will be executed with
* the right value and the value of the function returned. Otherwise the left function
* will be called with the left value.
*/
cata<V1, V2, T1, T2>(
leftFn: (leftValue: V1) => T1,
rightFn: (rightValue: V2) => T2,
either: Catamorphism<V1 | V2>,
): T1 | T2;
cata<V1, V2, T1, T2>(
leftFn: (leftValue: V1) => T1,
rightFn: (rightValue: V2) => T2):
(either: Catamorphism<V1 | V2>,
) => T1 | T2;
cata<V1, V2, T1, T2>(leftFn: (leftValue: V1) => T1): {
(rightFn: (rightValue: V2) => T1, either: Catamorphism<V1 | V2>): T1 | T2;
(rightFn: (rightValue: V2) => T1): (either: Catamorphism<V1 | V2>) => T1 | T2
};
/**
* Creates a new object with the own properties of the provided object, but the
* keys renamed according to the keysMap object as `{oldKey: newKey}`.
* When some key is not found in the keysMap, then it's passed as-is.
*/
renameKeys(keysMap: Dictionary<string>, obj: object): object;
renameKeys(keysMap: Dictionary<string>): (obj: object) => object;
/**
* Creates a new object with the own properties of the provided object, but the
* keys renamed according to logic of renaming function.
*/
renameKeysWith(renameFn: (key: string) => string, obj: object): object;
renameKeysWith(renameFn: (key: string) => string): (obj: object) => object;
/**
* Create a new object with the own properties of the second object merged with
* the own properties of the first object. If a key exists in both objects,
* the value from the first object will be used. *
* Putting it simply: it sets properties only if they don't exist.
*/
mergeRight(source: object, destination: object): object;
mergeRight(source: object): (destination: object) => object;
mergeLeft(source: object, destination: object): object; // alias
mergeLeft(source: object): (destination: object) => object; // alias
resetToDefault(defaultOptions: object, options: object): object; // alias of mergeRight
resetToDefault(defaultOptions: object): (options: object) => object; // alias of mergeRight
/**
* Functional equivalent of merging object properties with object spread.
*/
mergeProps(ps: string[], obj: object): object;
mergeProps(ps: string[]): (obj: object) => object;
/**
* Merge objects under corresponding paths.
*/
mergePaths(paths: Array<Array<string | number>>, obj: object): object;
mergePaths(paths: Array<Array<string | number>>): (obj: object) => object;
/**
* Create a new object with the own properties of the object under the `p`
* merged with the own properties of the provided `source`.
* If a key exists in both objects, the value from the `source` object will be used.
*/
mergeProp(p: string, source: object, obj: object): object;
mergeProp(p: string, source: object): (obj: object) => object;
mergeProp(p: string): {
(source: object, obj: object): object;
(source: object): (obj: object) => object;
};
/**
* Create a new object with the own properties of the object under the `path`
* merged with the own properties of the provided `source`.
* If a key exists in both objects, the value from the `source` object will be used.
*/
mergePath(path: Array<string | number>, source: object, obj: object): object;
mergePath(path: Array<string | number>, source: object): (obj: object) => object;
mergePath(path: Array<string | number>): {
(source: object, obj: object): object;
(source: object): (obj: object) => object;
};
/**
* Returns a partial copy of an object containing only the keys
* that don't satisfy the supplied predicate.
*/
omitBy<T, U extends Dictionary<T>>(pred: DictPred<T>, obj: U): U;
omitBy<T, U extends Dictionary<T>>(pred: DictPred<T>): (obj: U) => U;
/**
* Weave a configuration into function returning the runnable monad like `Reader` or `Free`.
*/
weave(fn: Function, config: any): Function;
weave(fn: Function): (config: any) => Function;
/**
* Weave a configuration into function returning the runnable monad like `Reader` or `Free`.
*/
weaveLazy(fn: Function, configAccessor: Function): Function;
weaveLazy(fn: Function): (configAccessor: Function) => Function;
/**
* Returns a curried equivalent of the provided function, with the specified arity.
* This function is like curryN, except that the provided arguments order is reversed.
*/
curryRightN(arity: number, fn: Function): Function;
curryRightN(arity: number): (fn: Function) => Function;
/**
* Returns a curried equivalent of the provided function.
* This function is like curry, except that the provided arguments order is reversed.
*/
curryRight(fn: Function): Function;
/**
* {@link http://ramdajs.com/docs/#map|R.map} function that more closely resembles Array.prototype.map.
* It takes two new parameters to its callback function: the current index, and the entire list.
*/
mapIndexed<T, U>(iterator: (elem: T, key: number, list: T[]) => U, list: T[]): U[];
mapIndexed<T, U>(iterator: (elem: T, key: number, list: T[]) => U): (list: T[]) => U[];
mapIndexed<T, U>(
iterator: (elem: T, key: number, list: Dictionary<T>) => U,
list: Dictionary<T>,
): Dictionary<U>;
mapIndexed<T, U>(
iterator: (elem: T, key: number, list: Dictionary<T>) => U,
): (list: Dictionary<T>) => Dictionary<U>;
mapIndexed<T, U>(iterator: (elem: T, key: number, list: Functor<T>) => U, list: Functor<T>): Functor<U>;
mapIndexed<T, U>(iterator: (elem: T, key: number, list: Functor<T>) => U): (list: Functor<T>) => Functor<U>;
mapIndexed(iterator: (char: string, key: number, str: string) => string, str: string): string[];
mapIndexed(iterator: (char: string, key: number, str: string) => string): (str: string) => string[];
/**
* {@link http://ramdajs.com/docs/#reduce|R.reduce} function that more closely resembles Array.prototype.reduce.
* It takes two new parameters to its callback function: the current index, and the entire list.
*/
reduceIndexed<T, TResult, R extends T[]>(
iterator: (acc: TResult, elem: T, key: number, list: R) => TResult,
acc: TResult,
list: R,
): TResult;
reduceIndexed<T, TResult, R extends T[]>(
iterator: (acc: TResult, elem: T, key: number, list: R) => TResult,
acc: TResult,
): (list: R) => TResult;
reduceIndexed<T, TResult, R extends T[]>(
iterator: (acc: TResult, elem: T, key: number, list: R) => TResult,
): {
(acc: TResult): (list: R) => TResult;
(acc: TResult, list: R): TResult
};
/**
* Given an `Iterable`(arrays are `Iterable`), or a promise of an `Iterable`,
* which produces promises (or a mix of promises and values),
* iterate over all the values in the `Iterable` into an array and
* reduce the array to a value using the given iterator function.
*/
reduceP<T, TResult, R extends T[]>(fn: (acc: TResult, elem: T) => TResult, acc: TResult, list: R): TResult;
reduceP<T, TResult, R extends T[]>(fn: (acc: TResult, elem: T) => TResult, acc: TResult): (list: R) => TResult;
reduceP<T, TResult, R extends T[]>(fn: (acc: TResult, elem: T) => TResult): {
(acc: TResult, list: R): TResult;
(acc: TResult): (list: R) => TResult
};
/**
* Given an `Iterable`(arrays are `Iterable`), or a promise of an `Iterable`,
* which produces promises (or a mix of promises and values),
* iterate over all the values in the `Iterable` into an array and
* reduce the array to a value using the given iterator function.
*
* Similar to {@link RA.reduceP|reduceP} except moves through the input list from the right to the left.
* The iterator function receives two values: (value, acc),
* while the arguments' order of reduceP's iterator function is (acc, value).
*/
reduceRightP<T, TResult, R extends T[]>(
fn: (elem: T, acc: TResult) => TResult,
acc: TResult,
list: R,
): TResult;
reduceRightP<T, TResult, R extends T[]>(
fn: (elem: T, acc: TResult) => TResult,
acc: TResult,
): (list: R) => TResult;
reduceRightP<T, TResult, R extends T[]>(fn: (elem: T, acc: TResult) => TResult): {
(acc: TResult, list: R): TResult;
(acc: TResult): (list: R) => TResult
};
/**
* Returns `true` if data structure focused by the given lens equals provided value.
*/
lensEq(lens: Function, value: any, data: any): boolean;
lensEq(lens: Function, value: any): (data: any) => boolean;
lensEq(lens: Function): (value: any) => (data: any) => boolean;
/**
* Returns `false` if data structure focused by the given lens equals provided value.
*/
lensNotEq(lens: Function, value: any, data: any): boolean;
lensNotEq(lens: Function, value: any): (data: any) => boolean;
lensNotEq(lens: Function): (value: any) => (data: any) => boolean;
/**
* Returns `true` if data structure focused by the given lens satisfies the predicate.
* Note that the predicate is expected to return boolean value and will be evaluated
* as `false` unless the predicate returns `true`.
*/
lensSatisfies(predicate: Function, lens: Function, data: any): boolean;
lensSatisfies(predicate: Function, lens: Function): (data: any) => boolean;
lensSatisfies(predicate: Function): (lens: Function) => (data: any) => boolean;
/**
* Returns `true` if data structure focused by the given lens doesn't satisfy the predicate.
* Note that the predicate is expected to return boolean value.
*/
lensNotSatisfy(predicate: Function, lens: Function, data: any): boolean;
lensNotSatisfy(predicate: Function, lens: Function): (data: any) => boolean;
lensNotSatisfy(predicate: Function): (lens: Function) => (data: any) => boolean;
/**
* Returns a "view" of the given data structure, determined by the given lens
* The lens's focus determines which portion of the data structure is visible.
* Returns the defaultValue if "view" is null, undefined or NaN; otherwise the "view" is returned.
*/
viewOr(defaultValue: any, lens: Function, data: any): any;
viewOr(defaultValue: any, lens: Function): (data: any) => any;
viewOr(defaultValue: any): (lens: Function) => (data: any) => any;
/**
* Defines an isomorphism that will work like a lens. It takes two functions.
* The function that converts and the function that recovers.
*/
lensIso: {
(to: Function, from: Function): Function
(to: Function): (from: Function) => Function
from(lens: Function): Function,
};
/**
* Creates a [Traversable](https://github.com/fantasyland/fantasy-land#traversable) lens
* from an [Applicative](https://github.com/fantasyland/fantasy-land#applicative)-returning function.
*
* When executed, it maps an [Applicative](https://github.com/fantasyland/fantasy-land#applicative)-returning
* function over a [Traversable](https://github.com/fantasyland/fantasy-land#traversable),
* then uses [`sequence`](#sequence) to transform the resulting Traversable of Applicative
* into an Applicative of Traversable.
*
* Dispatches to the `traverse` method of the third argument, if present.
*/
lensTraverse(of: Function): Function;
/**
* Returns true if the specified object property is not equal,
* in R.equals terms, to the given value; false otherwise.
*/
propNotEq(prop: string | number, value: any, obj: object): boolean;
propNotEq(prop: string | number, value: any): (obj: object) => boolean;
propNotEq(prop: string | number): {
(value: any, obj: object): boolean;
(value: any): (obj: object) => boolean;
};
/**
* Determines whether a nested path on an object doesn't have a specific value,
* in R.equals terms. Most likely used to filter a list.
*/
pathNotEq(path: Array<string | number>, value: any, obj: object): boolean;
pathNotEq(path: Array<string | number>, value: any): (obj: object) => boolean;
pathNotEq(path: Array<string | number>): {
(value: any, obj: object): boolean;
(value: any): (obj: object) => boolean;
};
/**
* Checks if `value` is between `low` and up to but not including `high`.
*/
inRange(low: number, high: number, value: number): boolean;
inRange(low: number, high: number): (value: number) => boolean;
inRange(low: number): {
(high: number, value: number): boolean;
(high: number): (value: number) => boolean;
};
/**
* Returns whether or not an object has an own property with the specified name at a given path.
*/
hasPath(path: Array<string | number>, obj: object): boolean;
hasPath(path: Array<string | number>): (obj: object) => boolean;
/**
* Spreads object under property path onto provided object.
*/
spreadPath(path: Array<string | number>, obj: object): object;
spreadPath(path: Array<string | number>): (obj: object) => object;
/**
* Spreads object under property onto provided object.
*/
spreadProp(prop: string | number, obj: object): object;
spreadProp(prop: string | number): (obj: object) => object;
/**
* Flattens a property path so that its fields are spread out into the provided object.
*/
flattenPath(path: Array<string | number>, obj: object): object;
flattenPath(path: Array<string | number>): (obj: object) => object;
/**
* Flattens a property so that its fields are spread out into the provided object.
*/
flattenProp(prop: string | number, obj: object): object;
flattenProp(prop: string | number): (obj: object) => object;
/**
* Creates a new list out of the supplied object by applying the function to each key/value pairing.
*/
unzipObjWith<T, U, V>(fn: (v: T, k: string) => [U, V], obj: { [k: string]: T }): [U[], V[]];
unzipObjWith<T, U, V>(fn: (v: T, k: string) => [U, V]): (obj: { [k: string]: T }) => [U[], V[]];
/**
* Composable shortcut for `Promise.all`.
*
* The `allP` method returns a single Promise that resolves when all of the promises
* in the iterable argument have resolved or when the iterable argument contains no promises.
* It rejects with the reason of the first promise that rejects.
*/
allP<T>(iterable: Iterable<T>): Promise<T[]>;
/**
* 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.
* This pattern is like allP, but fulfillments and rejections are transposed - rejections become the fulfillment values and vice versa.
*/
noneP<T>(iterable: Iterable<T | Promise<T>>): Promise<T[]>;
/**
* allSettledP returns a promise that is fulfilled with an array of promise state snapshots,
* but only after all the original promises have settled, i.e. become either fulfilled or rejected.
* We say that a promise is settled if it is not pending, i.e. if it is either fulfilled or rejected.
*/
allSettledP<T>(iterable: Iterable<T>): Promise<Array<SettledPromise<T>>>;
/**
* Returns a promise that is fulfilled by the first given promise to be fulfilled,
* or rejected with an array of rejection reasons if all of the given promises are rejected.
*/
anyP<T>(iterable: Iterable<T>): Promise<T>;
firstP<T>(iterable: Iterable<T>): Promise<T>; // alias
/**
* Composable shortcut for `Promise.resolve`.
*
* Returns a Promise object that is resolved with the given value.
* If the value is a thenable (i.e. has a "then" method), the returned promise will
* "follow" that thenable, adopting its eventual state.
*/
resolveP<T>(value?: T): Promise<T>;
/**
* Composable shortcut for `Promise.reject`.
*
* Returns a Promise object that is rejected with the given reason.
*/
rejectP<T>(value?: T): Promise<T>;
/**
* Composable shortcut for `Promise.then`.
* The thenP function returns a Promise. It takes two arguments: a callback function for the success of the Promise
* and the promise instance itself.
*/
thenP<T>(onFulfilled: Function, thenable: Promise<T>): Promise<T>;
thenP<T>(onFulfilled: Function): (thenable: Promise<T>) => Promise<T>;
then<T>(onFulfilled: Function, thenable: Promise<T>): Promise<T>;
then<T>(onFulfilled: Function): (thenable: Promise<T>) => Promise<T>;
/**
* Runs the given list of functions in order with the supplied object, then returns the object.
* Also known as the normal order sequencing combinator.
*
* Acts as a transducer if a transformer is given as second parameter.
*/
seq<T>(fns: Function[], x: T): T;
seq<T>(fns: Function[]): (x: T) => T;
sequencing<T>(fns: Function[], x: T): T; // alias
sequencing<T>(fns: Function[]): (x: T) => T; // alias
/**
* Returns the elements of the given list or string (or object with a slice method)
* from fromIndex (inclusive).
* Dispatches to the slice method of the third argument, if present.
*/
sliceFrom<T>(fromIndex: number, list: string | T[]): string | T[];
sliceFrom(fromIndex: number): <T>(list: string | T[]) => string | T[];
/**
* Returns the elements of the given list or string (or object with a slice method)
* to toIndex (exclusive).
* Dispatches to the slice method of the second argument, if present.
*/
sliceTo<T>(toIndex: number, list: string | T[]): string | T[];
sliceTo(toIndex: number): <T>(list: string | T[]) => string | T[];
/**
* Returns a partial copy of an array omitting the indexes specified.
*/
omitIndexes<T>(indexes: number[], list: T[]): T[];
omitIndexes(indexes: number[]): <T>(list: T[]) => T[];
/**
* Returns `true` if the supplied list or string has a length greater than `valueLength`.
*/
lengthGt<T>(valueLength: number, list: string | T[]): boolean;
lengthGt(valueLength: number): <T>(list: string | T[]) => boolean;
/**
* Returns `true` if the supplied list or string has a length less than `valueLength`.
*/
lengthLt<T>(valueLength: number, list: string | T[]): boolean;
lengthLt(valueLength: number): <T>(list: string | T[]) => boolean;
/**
* Returns `true` if the supplied list or string has a length less than or equal to
* `valueLength`.
*/
lengthLte<T>(valueLength: number, list: string | T[]): boolean;
lengthLte(valueLength: number): <T>(list: string | T[]) => boolean;
/**
* Returns `true` if the supplied list or string has a length greater than or equal to
* `valueLength`.
*/
lengthGte<T>(valueLength: number, list: string | T[]): boolean;
lengthGte(valueLength: number): <T>(list: string | T[]) => boolean;
/**
* Returns `true` if the supplied list or string has a length equal to `valueLength`.
*/
lengthEq<T>(valueLength: number, list: string | T[]): boolean;
lengthEq(valueLength: number): <T>(list: string | T[]) => boolean;
/**
* Returns `true` if the supplied list or string has a length not equal to `valueLength`.
*/
lengthNotEq<T>(valueLength: number, list: string | T[]): boolean;
lengthNotEq(valueLength: number): <T>(list: string | T[]) => boolean;
/**
* Returns true if all items in the list are equivalent using `R.equals` for equality comparisons.
*/
allEqual<T>(list: T[]): boolean;
/**
* Constructs and returns a new string which contains the specified
* number of copies of the string on which it was called, concatenated together.
*/
repeatStr(value: string, count: number): string;
repeatStr(value: string): (count: number) => string;
/*
* Returns true if all items in the list are equivalent using `R.identical` for equality comparisons.
*/
allIdentical<T>(list: T[]): boolean;
/*
* Returns true if all items in the list are equivalent to user provided value using `R.identical` for equality comparisons.
*/
allIdenticalTo<T>(val: T, list: T[]): boolean;
allIdenticalTo<T>(val: T): (list: T[]) => boolean;
/*
* Returns true if all items in the list are equivalent to user provided value using `R.equals` for equality comparisons.
*/
allEqualTo<T>(val: T, list: T[]): boolean;
allEqualTo<T>(val: T): <T>(list: T[]) => boolean;
/*
* Flattens the list to the specified depth.
*/
flattenDepth<T>(depth: number, list: T[]): T[];
flattenDepth(depth: number): (list: any[]) => any[];
/**
* Checks if input value is a `thenable`.
* `thenable` is an object or function that defines a `then` method.
*/
isThenable(val: any): boolean;
/**
* Checks if input value is a native `Promise`.
* The Promise object represents the eventual completion (or failure)
* of an asynchronous operation, and its resulting value.
*/