-
Notifications
You must be signed in to change notification settings - Fork 88
Expand file tree
/
Copy pathindex.d.ts
More file actions
2379 lines (2215 loc) · 80 KB
/
Copy pathindex.d.ts
File metadata and controls
2379 lines (2215 loc) · 80 KB
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
export type RambdaTypes = "Object" | "Number" | "Boolean" | "String" | "Null" | "Array" | "RegExp" | "NaN" | "Function" | "Undefined" | "Async" | "Promise" | "Symbol" | "Set" | "Error" | "Map" | "WeakMap" | "Generator" | "GeneratorFunction" | "BigInt" | "ArrayBuffer" | "Date";
export type EqualTypes<X, Y> =
(<T>() => T extends X ? 1 : 2) extends
(<T>() => T extends Y ? 1 : 2) ? true : false;
export type IterableContainer<T = unknown> = ReadonlyArray<T> | readonly [];
export type Mapped<T extends IterableContainer, K> = {
-readonly [P in keyof T]: K;
};
export type ElementOf<Type extends readonly any[]> = Type[number];
export type MergeTypes<T> = {[KeyType in keyof T]: T[KeyType]} & {};
export type MergeTypesAlternative<T> = T extends infer O ? { [K in keyof O]: O[K] } : never;
export type EntryForKey<T, Key extends keyof T> = Key extends number | string
? [key: `${Key}`, value: Required<T>[Key]]
: never;
export type Entry<T> = MergeTypes<{ [P in keyof T]-?: EntryForKey<T, P> }[keyof T]>;
export type Ord = number | string | boolean | Date;
export type Ordering = -1 | 0 | 1;
interface KeyValuePair<K, V> extends Array<K | V> {
0: K;
1: V;
}
export type Functor<A> = { map: <B>(fn: (x: A) => B) => Functor<B>; [key: string]: any };
export type DeepModify<Keys extends readonly PropertyKey[], U, T> =
Keys extends [infer K, ...infer Rest]
? K extends keyof U
? Rest extends readonly []
? Omit<U, K> & Record<K, T>
: Rest extends readonly PropertyKey[]
? Omit<U, K> & Record<K, DeepModify<Rest, U[K], T>>
: never
: never
: never;
export type PickStringToPickPath<T> = T extends `${infer Head},${infer Tail}` ? [Head, ...PickStringToPickPath<Tail>]
: T extends `${infer Head}` ? [Head]
: [];
declare const emptyObjectSymbol: unique symbol;
type EmptyObject = {[emptyObjectSymbol]?: never};
type EnumerableStringKeyOf<T> =
Required<T> extends Record<infer K, unknown>
? `${Exclude<K, symbol>}`
: never;
type EnumerableStringKeyedValueOf<T> = ValuesOf<{
[K in keyof T]-?: K extends symbol ? never : T[K];
}>;
type ValuesOf<T> =
T extends EmptyObject
? T[keyof T]
: T extends Record<PropertyKey, infer V>
? V
: never;
type MappedValues<T extends object, Value> = MergeTypes<{
-readonly [P in keyof T as `${P extends number | string ? P : never}`]: Value;
}>;
type SimpleMerge<Destination, Source> = {
[Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key];
} & Source;
type OmitIndexSignature<ObjectType> = {
[KeyType in keyof ObjectType as {} extends Record<KeyType, unknown>
? never
: KeyType]: ObjectType[KeyType];
};
type PickIndexSignature<ObjectType> = {
[KeyType in keyof ObjectType as {} extends Record<KeyType, unknown>
? KeyType
: never]: ObjectType[KeyType];
};
type Merge<Destination, Source> =
MergeTypes<
SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>>
& SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>
>;
type StrictNonNullable<T> = Exclude<T, null | undefined>;
type ExcludeFalsy<T> = Exclude<T, null | undefined | false | true | 0 | "">;
type Flatten<T> = T extends object
? T extends readonly any[]
? T
: {
[K in keyof T]-?: NonNullable<T[K]> extends infer V
? V extends object
? V extends readonly any[]
? never
: Flatten<V>
: V
: never
}
: T;
export type FlattenObject<T extends object> = object extends T
? object
: {
[K in keyof T]-?: (
x: NonNullable<T[K]> extends infer V
? V extends object
? V extends readonly any[]
? never
: Flatten<V> extends infer FV
? {
[P in keyof FV as `${Extract<K, string>}.${Extract<P, string>}`]: FV[P]
}
: never
: Pick<T, K>
: never
) => void
} extends Record<keyof T, (y: infer O) => void>
? O
: never;
type isfn<T, U> = (fn: (x: T) => boolean, y: T) => U;
type isfn2<T, V, U> = (fn: (x: T) => boolean, y: V) => U;
interface Switchem<T> {
is: isfn<T, Switchem<T>>;
default: (x: T) => T;
}
interface Switchem2<T, U> {
is: isfn2<T, U, Switchem2<T, U>>;
default: (x: U) => U;
}
/**
* It adds new key-value pair to the object.
*/
export function addProp<T extends object, P extends PropertyKey, V extends unknown>(
prop: P,
value: V
): (obj: T) => MergeTypes<T & Record<P, V>>;
/**
* It receives list of objects and add new property to each item.
*
* The value is based on result of `fn` function, which receives the current object as argument.
*/
export function addPropToObjects<
T extends object,
K extends string,
R
>(
property: K,
fn: (input: T) => R
): (list: T[]) => MergeTypes<T & { [P in K]: R }>[];
/**
* It returns `true`, if all members of array `list` returns `true`, when applied as argument to `predicate` function.
*/
export function all<T>(predicate: (x: T) => boolean): (list: T[]) => boolean;
/**
* It returns `true`, if all functions of `predicates` return `true`, when `input` is their argument.
*/
export function allPass<F extends (...args: any[]) => boolean>(predicates: readonly F[]): F;
/**
* It returns `true`, if at least one member of `list` returns true, when passed to a `predicate` function.
*/
export function any<T>(predicate: (x: T) => boolean): (list: T[]) => boolean;
/**
* It accepts list of `predicates` and returns a function. This function with its `input` will return `true`, if any of `predicates` returns `true` for this `input`.
*/
export function anyPass<T, TF1 extends T, TF2 extends T>(
predicates: [(a: T) => a is TF1, (a: T) => a is TF2],
): (a: T) => a is TF1 | TF2;
export function anyPass<T, TF1 extends T, TF2 extends T, TF3 extends T>(
predicates: [(a: T) => a is TF1, (a: T) => a is TF2, (a: T) => a is TF3],
): (a: T) => a is TF1 | TF2 | TF3;
export function anyPass<T, TF1 extends T, TF2 extends T, TF3 extends T>(
predicates: [(a: T) => a is TF1, (a: T) => a is TF2, (a: T) => a is TF3],
): (a: T) => a is TF1 | TF2 | TF3;
export function anyPass<T, TF1 extends T, TF2 extends T, TF3 extends T, TF4 extends T>(
predicates: [(a: T) => a is TF1, (a: T) => a is TF2, (a: T) => a is TF3, (a: T) => a is TF4],
): (a: T) => a is TF1 | TF2 | TF3 | TF4;
export function anyPass<T, TF1 extends T, TF2 extends T, TF3 extends T, TF4 extends T, TF5 extends T>(
predicates: [
(a: T) => a is TF1,
(a: T) => a is TF2,
(a: T) => a is TF3,
(a: T) => a is TF4,
(a: T) => a is TF5
],
): (a: T) => a is TF1 | TF2 | TF3 | TF4 | TF5;
export function anyPass<T, TF1 extends T, TF2 extends T, TF3 extends T, TF4 extends T, TF5 extends T, TF6 extends T>(
predicates: [
(a: T) => a is TF1,
(a: T) => a is TF2,
(a: T) => a is TF3,
(a: T) => a is TF4,
(a: T) => a is TF5,
(a: T) => a is TF6
],
): (a: T) => a is TF1 | TF2 | TF3 | TF4 | TF5 | TF6;
export function anyPass<F extends (...args: any[]) => boolean>(predicates: readonly F[]): F;
/**
* It adds element `x` at the end of `iterable`.
*/
export function append<T>(el: T): (list: readonly T[]) => T[];
export function append<T>(el: T): (list: T[]) => T[];
/**
* Helper function to be used with `R.sort` to sort list in ascending order.
*/
export function ascend<T>(fn: (obj: T) => Ord): (a: T, b: T)=> Ordering;
/**
* It helps to make sure that input is from specific type. Similar to `R.convertToType`, but it actually checks the type of the input value. If `fn` input returns falsy value, then the function will throw an error.
*/
export function assertType<T, U extends T>(fn: (x: T) => x is U) : (x: T) => U;
export function assertType<T>(fn: (x: T) => boolean): (x: T) => T;
/**
* It returns `true` if all each property in `conditions` returns `true` when applied to corresponding property in `input` object.
*/
export function checkObjectWithSpec<T>(spec: T): <U>(testObj: U) => boolean;
/**
* It removes `null` and `undefined` members from list or object input.
*/
export function compact<T>(list: T[]): Array<StrictNonNullable<T>>;
export function compact<T extends object>(record: T): {
[K in keyof T as Exclude<T[K], null | undefined> extends never
? never
: K
]: Exclude<T[K], null | undefined>
};
/**
* It returns `inverted` version of `origin` function that accept `input` as argument.
*
* The return value of `inverted` is the negative boolean value of `origin(input)`.
*/
export function complement<T extends any[]>(predicate: (...args: T) => unknown): (...args: T) => boolean;
/**
* It returns a new string or array, which is the result of merging `x` and `y`.
*/
export function concat<T>(x: T[]): (y: T[]) => T[];
export function concat(x: string): (y: string) => string;
/**
* It helps to convert a value to a specific type.
* It is useful when you have to overcome TypeScript's type inference.
*/
export function convertToType<T>(x: unknown) : T;
/**
* It counts how many times `predicate` function returns `true`, when supplied with iteration of `list`.
*/
export function count<T>(predicate: (x: T) => boolean): (list: T[]) => number;
/**
* It counts elements in a list after each instance of the input list is passed through `transformFn` function.
*/
export function countBy<T>(fn: (x: T) => string | number): (list: T[]) => { [index: string]: number };
export function createObjectFromKeys<const K extends readonly PropertyKey[], V>(
fn: (key: K[number]) => V
): (keys: K) => { [P in K[number]]: V };
export function createObjectFromKeys<const K extends readonly PropertyKey[], V>(
fn: (key: K[number], index: number) => V
): (keys: K) => { [P in K[number]]: V };
/**
* It returns `defaultValue`, if all of `inputArguments` are `undefined`, `null` or `NaN`.
*
* Else, it returns the first truthy `inputArguments` instance(from left to right).
*/
export function defaultTo<T>(defaultValue: T): (input: unknown) => T;
/**
* `setTimeout` as a promise that resolves to `RAMBDA_DELAY` string after `ms` milliseconds.
*/
export function delay(ms: number): Promise<'RAMBDA_DELAY'>;
/**
* Helper function to be used with `R.sort` to sort list in descending order.
*/
export function descend<T>(fn: (obj: T) => Ord): (a: T, b: T)=> Ordering;
/**
* It returns a merged list of `x` and `y` with all equal elements removed.
*
* `R.equals` is used to determine equality.
*/
export function difference<T>(x: T[]): (y: T[]) => T[];
/**
* It returns `howMany` items dropped from beginning of list.
*/
export function drop<T>(howMany: number): (list: T[]) => T[];
/**
* It returns `howMany` items dropped from the end of list.
*/
export function dropLast<T>(howMany: number): (list: T[]) => T[];
export function dropLastWhile<T>(predicate: (x: T, index: number) => boolean): (list: T[]) => T[];
export function dropLastWhile<T>(predicate: (x: T) => boolean): (list: T[]) => T[];
export function dropRepeatsBy<T, U>(fn: (x: T) => U): (list: T[]) => T[];
export function dropRepeatsWith<T>(predicate: (x: T, y: T) => boolean): (list: T[]) => T[];
export function dropWhile<T>(predicate: (x: T, index: number) => boolean): (list: T[]) => T[];
export function dropWhile<T>(predicate: (x: T) => boolean): (list: T[]) => T[];
export function duplicateBy<T, U>(fn: (x: T) => U): (list: T[]) => T[];
export function eqBy<T>(fn: (x: T) => unknown, a: T): (b: T) => boolean;
/**
* It returns `true` if property `prop` in `obj1` is equal to property `prop` in `obj2` according to `R.equals`.
*/
export function eqProps<T, K extends keyof T>(prop: K, obj1: T): (obj2: T) => boolean;
/**
* It deeply compares `x` and `y` and returns `true` if they are equal.
*/
export function equals<T>(x: T): (y: T) => boolean;
/**
* It takes object of functions as set of rules. These `rules` are applied to the `iterable` input to produce the result.
* It doesn't support nested rules, i.e rules are only one level deep.
*/
export function evolve<T>(rules: {
[K in keyof T]?: (x: T[K]) => T[K]
}): (obj: T) => T;
/**
* Opposite of `R.includes`
*
* `R.equals` is used to determine equality.
*/
export function excludes(list: readonly string[] | string): (substringToFind: string) => boolean;
export function excludes<T>(list: readonly T[]): (target: T) => boolean;
/**
* It returns `true` if there is at least one element in `list` that satisfy the `predicate`.
*/
export function exists<T>(predicate: (x: T) => boolean): (list: T[]) => boolean;
/**
* It filters list or object `input` using a `predicate` function.
*/
export function filter<T, S extends T>(
predicate: (value: T) => value is S,
): (list: T[]) => S[];
export function filter<T>(
predicate: BooleanConstructor,
): (list: readonly T[]) => ExcludeFalsy<T>[];
export function filter<T>(
predicate: BooleanConstructor,
): (list: T[]) => ExcludeFalsy<T>[];
export function filter<T>(
predicate: (value: T, index: number) => boolean,
): (list: T[]) => T[];
export function filterAsync<T>(
predicate: (value: T) => Promise<boolean>,
): (list: T[]) => Promise<T[]>;
/**
* Same as `R.map` but it filters out `null/undefined` if returned from functor functions.
*/
export function filterMap<T extends IterableContainer, U>(
fn: (value: T[number], index: number) => U,
): (data: T) => Mapped<T, ExcludeFalsy<U>>;
export function filterMap<T extends IterableContainer, U>(
fn: (value: T[number]) => U,
): (data: T) => Mapped<T, ExcludeFalsy<U>>;
/**
* It loops over each property of `obj` and returns a new object with only those properties that satisfy the `predicate`.
*/
export function filterObject<T extends object>(
valueMapper: (
value: EnumerableStringKeyedValueOf<T>,
key: EnumerableStringKeyOf<T>,
data: T,
) => boolean,
): <U extends T>(data: T) => U;
/**
* It returns the first element of `list` that satisfy the `predicate`.
*
* If there is no such element, it returns `undefined`.
*/
export function find<T, S extends T>(predicate: (x: T) => x is S): (list: T[]) => S | undefined;
export function find<T>(predicate: (x: T) => boolean): (list: T[]) => T | undefined;
/**
* It returns the index of the first element of `list` satisfying the `predicate` function.
*
* If there is no such element, then `-1` is returned.
*/
export function findIndex<T>(predicate: (x: T) => boolean): (list: T[]) => number;
/**
* It returns the last element of `list` satisfying the `predicate` function.
*
* If there is no such element, then `undefined` is returned.
*/
export function findLast<T>(fn: (x: T) => boolean): (list: T[]) => T | undefined;
/**
* It returns the index of the last element of `list` satisfying the `predicate` function.
*
* If there is no such element, then `-1` is returned.
*/
export function findLastIndex<T>(predicate: (x: T) => boolean): (list: T[]) => number;
/**
* It returns the `nth` element of `list` that satisfy the `predicate` function.
*/
export function findNth<T>(predicate: (x: T) => boolean, nth: number): (list: T[]) => T | undefined;
/**
* It maps `fn` over `list` and then flatten the result by one-level.
*/
export function flatMap<T, U extends unknown>(transformFn: (x: T extends any[] ? T[number]: never) => U): (listOfLists: T[]) => U[];
/**
* It deeply flattens an array.
* You must pass expected output type as a type argument.
*/
export function flatten<T>(list: any[]): T[];
/**
* It transforms object to object where each value is represented with its path.
*/
export function flattenObject<T extends object>(obj: T): FlattenObject<T>;
/**
* It splits `list` according to a provided `groupFn` function and returns an object.
*/
export function groupBy<T, K extends string = string>(fn: (x: T) => K): (list: T[]) => Partial<Record<K, T[]>>;
/**
* It returns the first element of list or string `input`. It returns `undefined` if array has length of 0.
*/
export function head<T>(listOrString: T): T extends string ? string :
T extends [] ? undefined:
T extends readonly [infer F, ...infer R] ? F :
T extends readonly [infer F] ? F :
T extends [infer F] ? F :
T extends [infer F, ...infer R] ? F :
T extends unknown[] ? T[number] :
undefined;
/**
* If `input` is string, then this method work as native `String.includes`.
*
* If `input` is array, then `R.equals` is used to define if `valueToFind` belongs to the list.
*/
export function includes<T>(list: readonly T[]): (target: T) => boolean;
export function includes(list: readonly string[] | string): (substringToFind: string) => boolean;
/**
* It transforms list of objects to object using specified property as the base for the returned object.
*/
export function indexBy<T, K extends keyof T>(
property: K
): (list: readonly T[]) => Record<string, T>;
export function indexBy<T, K extends keyof T>(
property: K
): (list: T[]) => Record<string, T>;
/**
* It uses `R.equals` for list of objects/arrays or native `indexOf` for any other case.
*/
export function indexOf<T>(valueToFind: T): (list: T[]) => number;
/**
* It returns all but the last element of list or string `input`.
*/
export function init<T extends unknown>(input: T): T extends unknown[] ?
T['length'] extends 0 ? [] : T['length'] extends 1 ? [] :
T extends [...infer U, any] ? U : T : T extends string ? string : never;
/**
* It generates a new string from `inputWithTags` by replacing all `{{x}}` occurrences with values provided by `templateArguments`.
*/
export function interpolate(inputWithTags: string): (templateArguments: object) => string;
/**
* It loops through `listA` and `listB` and returns the intersection of the two according to `R.equals`.
*/
export function intersection<T>(listA: T[]): (listB: T[]) => T[];
/**
* It returns a new list by applying a `predicate` function to all elements of `list1` and `list2` and keeping only these elements where `predicate` returns `true`.
*/
export function intersectionWith<T1, T2>(
pred: (a: T1, b: T2) => boolean,
list1: T1[],
): (list2: T2[]) => T1[];
/**
* It adds a `separator` between members of `list`.
*/
export function intersperse<T>(separator: T): (list: T[]) => T[];
/**
* It returns a string of all `list` instances joined with a `glue`.
*/
export function join<T>(glue: string): (list: T[]) => string;
/**
* It returns the last element of `input`, as the `input` can be either a string or an array. It returns `undefined` if array has length of 0.
*/
export function last<T>(listOrString: T): T extends string ? string :
T extends [] ? undefined :
T extends readonly [...infer R, infer L] ? L :
T extends readonly [infer L] ? L :
T extends [infer L] ? L :
T extends [...infer R, infer L] ? L :
T extends unknown[] ? T[number] :
undefined;
/**
* It returns the last index of `target` in `list` array.
*
* `R.equals` is used to determine equality between `target` and members of `list`.
*
* If there is no such index, then `-1` is returned.
*/
export function lastIndexOf<T>(target: T): (list: T[]) => number;
/**
* It returns the result of looping through `iterable` with `fn`.
*/
export function map<T extends IterableContainer, U>(
fn: (value: T[number], index: number) => U,
): (data: T) => Mapped<T, U>;
export function map<T extends IterableContainer, U>(
fn: (value: T[number]) => U,
): (data: T) => Mapped<T, U>;
/**
* Sequential asynchronous mapping with `fn` over members of `list`.
*/
export function mapAsync<T extends IterableContainer, U>(
fn: (value: T[number], index: number) => Promise<U>,
): (data: T) => Promise<Mapped<T, U>>;
export function mapAsync<T extends IterableContainer, U>(
fn: (value: T[number]) => Promise<U>,
): (data: T) => Promise<Mapped<T, U>>;
/**
* Chained 2 or 3 `R.map` transformations as one.
*/
export function mapChain<T extends IterableContainer, U, V>(
fn1: (value: T[number], index: number) => U,
fn2: (value: U, index: number) => V,
): (data: T) => Mapped<T, V>;
export function mapChain<T extends IterableContainer, U, V>(
fn1: (value: T[number], index: number) => U,
fn2: (value: U) => V,
): (data: T) => Mapped<T, V>;
export function mapChain<T extends IterableContainer, U, V>(
fn1: (value: T[number]) => U,
fn2: (value: U, index: number) => V,
): (data: T) => Mapped<T, V>;
export function mapChain<T extends IterableContainer, U, V>(
fn1: (value: T[number]) => U,
fn2: (value: U) => V,
): (data: T) => Mapped<T, V>;
export function mapChain<T extends IterableContainer, U, V, Y>(
fn1: (value: T[number], index: number) => U,
fn2: (value: U, index: number) => V,
fn3: (value: V, index: number) => Y,
): (data: T) => Mapped<T, Y>;
export function mapChain<T extends IterableContainer, U, V, Y>(
fn1: (value: T[number]) => U,
fn2: (value: U) => V,
fn3: (value: V) => Y,
): (data: T) => Mapped<T, Y>;
/**
* It returns a copy of `obj` with keys transformed by `fn`.
*/
export function mapKeys<T>(fn: (prop: string, value: T) => string): (obj: Record<string, T>) => Record<string, T>;
export function mapObject<T extends object, Value>(
valueMapper: (
value: EnumerableStringKeyedValueOf<T>,
key: EnumerableStringKeyOf<T>,
data: T,
) => Value,
): (data: T) => MappedValues<T, Value>;
export function mapObjectAsync<T extends object, Value>(
valueMapper: (
value: EnumerableStringKeyedValueOf<T>,
key: EnumerableStringKeyOf<T>,
data: T,
) => Promise<Value>,
): (data: T) => Promise<MappedValues<T, Value>>;
/**
* Wrapper around `Promise.all` for asynchronous mapping with `fn` over members of `list`.
* There is optional `batchSize` parameter to allow parallel execution to run in batches. In this case, the whole batch must complete before the next batch starts.
*/
export function mapParallelAsync<T extends IterableContainer, U>(
fn: (value: T[number], index: number) => Promise<U>,
batchSize?: number,
): (data: T) => Promise<Mapped<T, U>>;
export function mapParallelAsync<T extends IterableContainer, U>(
fn: (value: T[number]) => Promise<U>,
batchSize?: number,
): (data: T) => Promise<Mapped<T, U>>;
/**
* Convenience method, when one needs to maps over a object property that is a list.
*/
export function mapPropObject<T extends object, K extends keyof T, Value extends unknown>(
prop: K,
valueMapper: (
listItem: T[K] extends ReadonlyArray<infer ElementType> ? ElementType : never,
list: T[K] extends ReadonlyArray<any> ? T[K] : never,
) => Value,
): (data: T) => T[K] extends ReadonlyArray<any>
? MergeTypes<Omit<T, K> & { [P in K]: Value[] }>
: never;
export function mapPropObject<T extends object, K extends keyof T, Value extends unknown>(
prop: K,
valueMapper: (
listItem: T[K] extends ReadonlyArray<infer ElementType> ? ElementType : never,
) => Value,
): (data: T) => T[K] extends ReadonlyArray<any>
? MergeTypes<Omit<T, K> & { [P in K]: Value[] }>
: never;
/**
* Curried version of `String.prototype.match` which returns empty array, when there is no match.
*/
export function match(regExpression: RegExp | string): (str: string) => string[];
/**
* It returns the greater value between `x` and `y` according to `compareFn` function.
*/
export function maxBy<T>(compareFn: (input: T) => Ord, x: T): (y: T) => T;
/**
* It creates a copy of `source` object with overwritten `newProps` properties.
*/
export function merge<Source>(source: Source): <T>(newProps: T) => Merge<T, Source>;
export function mergeDeep<Source>(source: Source): <T>(newProps: T) => Merge<T, Source>;
/**
* Helper to merge all calculated TypeScript definitions into one definition.
* It returns its input and it is intended to be used as last method inside `R.pipe` chain.
*/
export function mergeTypes<T>(x: T): MergeTypes<T>;
/**
* It returns all but the first and last element of `input`.
*/
export function middle<T extends unknown>(input: T): T extends unknown[] ?
T['length'] extends 0 ? [] : T['length'] extends 1 ? [] : T['length'] extends 2 ? [] :
T extends [any, ...infer U, any] ? U : T : T extends string ? string : never;
/**
* It returns the lesser value between `x` and `y` according to `compareFn` function.
*/
export function minBy<T>(compareFn: (input: T) => Ord, x: T): (y: T) => T;
/**
* It replaces `index` in array `list` with the result of `replaceFn(list[i])`.
*/
export function modifyItemAtIndex<T>(index: number, replaceFn: (x: T) => T): (list: T[]) => T[];
/**
* It changes a property of object on the base of provided path and transformer function.
*/
export function modifyPath<U, T>(path: [], fn: (value: U) => T): (obj: U) => T;
export function modifyPath<
K0 extends keyof U,
U,
T
>(path: [K0], fn: (value: U[K0]) => T): (obj: U) => DeepModify<[K0], U, T>;
export function modifyPath<
K0 extends string & keyof U,
U,
T
>(path: `${K0}`, fn: (value: U[K0]) => T): (obj: U) => DeepModify<[K0], U, T>;
export function modifyPath<
K0 extends keyof U,
K1 extends keyof U[K0],
U,
T
>(path: [K0, K1], fn: (value: U[K0][K1]) => T): (obj: U) => DeepModify<[K0, K1], U, T>;
export function modifyPath<
K0 extends string & keyof U,
K1 extends string & keyof U[K0],
U,
T
>(path: `${K0}.${K1}`, fn: (value: U[K0][K1]) => T): (obj: U) => DeepModify<[K0, K1], U, T>;
export function modifyPath<
K0 extends keyof U,
K1 extends keyof U[K0],
K2 extends keyof U[K0][K1],
U,
T
>(path: [K0, K1, K2], fn: (value: U[K0][K1][K2]) => T): (obj: U) => DeepModify<[K0, K1, K2], U, T>;
export function modifyPath<
K0 extends string & keyof U,
K1 extends string & keyof U[K0],
K2 extends string & keyof U[K0][K1],
U,
T
>(path: `${K0}.${K1}.${K2}`, fn: (value: U[K0][K1][K2]) => T): (obj: U) => DeepModify<[K0, K1, K2], U, T>;
export function modifyPath<
K0 extends keyof U,
K1 extends keyof U[K0],
K2 extends keyof U[K0][K1],
K3 extends keyof U[K0][K1][K2],
U,
T
>(path: [K0, K1, K2, K3], fn: (value: U[K0][K1][K2][K3]) => T): (obj: U) => DeepModify<[K0, K1, K2, K3], U, T>;
export function modifyPath<
K0 extends string & keyof U,
K1 extends string & keyof U[K0],
K2 extends string & keyof U[K0][K1],
K3 extends string & keyof U[K0][K1][K2],
U,
T
>(path: `${K0}.${K1}.${K2}.${K3}`, fn: (value: U[K0][K1][K2][K3]) => T): (obj: U) => DeepModify<[K0, K1, K2, K3], U, T>;
export function modifyPath<
K0 extends keyof U,
K1 extends keyof U[K0],
K2 extends keyof U[K0][K1],
K3 extends keyof U[K0][K1][K2],
K4 extends keyof U[K0][K1][K2][K3],
U,
T
>(path: [K0, K1, K2, K3, K4], fn: (value: U[K0][K1][K2][K3][K4]) => T): (obj: U) => DeepModify<[K0, K1, K2, K3, K4], U, T>;
export function modifyPath<
K0 extends string & keyof U,
K1 extends string & keyof U[K0],
K2 extends string & keyof U[K0][K1],
K3 extends string & keyof U[K0][K1][K2],
K4 extends string & keyof U[K0][K1][K2][K3],
U,
T
>(path: `${K0}.${K1}.${K2}.${K3}.${K4}`, fn: (value: U[K0][K1][K2][K3][K4]) => T): (obj: U) => DeepModify<[K0, K1, K2, K3, K4], U, T>;
export function modifyPath<
K0 extends keyof U,
K1 extends keyof U[K0],
K2 extends keyof U[K0][K1],
K3 extends keyof U[K0][K1][K2],
K4 extends keyof U[K0][K1][K2][K3],
K5 extends keyof U[K0][K1][K2][K3][K4],
U,
T
>(path: [K0, K1, K2, K3, K4, K5], fn: (value: U[K0][K1][K2][K3][K4][K5]) => T): (obj: U) => DeepModify<[K0, K1, K2, K3, K4, K5], U, T>;
export function modifyPath<
K0 extends string & keyof U,
K1 extends string & keyof U[K0],
K2 extends string & keyof U[K0][K1],
K3 extends string & keyof U[K0][K1][K2],
K4 extends string & keyof U[K0][K1][K2][K3],
K5 extends string & keyof U[K0][K1][K2][K3][K4],
U,
T
>(path: `${K0}.${K1}.${K2}.${K3}.${K4}.${K5}`, fn: (value: U[K0][K1][K2][K3][K4][K5]) => T): (obj: U) => DeepModify<[K0, K1, K2, K3, K4, K5], U, T>;
export function modifyPath<
K0 extends keyof U,
K1 extends keyof U[K0],
K2 extends keyof U[K0][K1],
K3 extends keyof U[K0][K1][K2],
K4 extends keyof U[K0][K1][K2][K3],
K5 extends keyof U[K0][K1][K2][K3][K4],
K6 extends keyof U[K0][K1][K2][K3][K4][K5],
U,
T
>(path: [K0, K1, K2, K3, K4, K5, K6], fn: (value: U[K0][K1][K2][K3][K4][K5][K6]) => T): (obj: U) => DeepModify<[K0, K1, K2, K3, K4, K5, K6], U, T>;
export function modifyPath<
K0 extends string & keyof U,
K1 extends string & keyof U[K0],
K2 extends string & keyof U[K0][K1],
K3 extends string & keyof U[K0][K1][K2],
K4 extends string & keyof U[K0][K1][K2][K3],
K5 extends string & keyof U[K0][K1][K2][K3][K4],
K6 extends string & keyof U[K0][K1][K2][K3][K4][K5],
U,
T
>(path: `${K0}.${K1}.${K2}.${K3}.${K4}.${K5}.${K6}`, fn: (value: U[K0][K1][K2][K3][K4][K5][K6]) => T): (obj: U) => DeepModify<[K0, K1, K2, K3, K4, K5, K6], U, T>;
/**
* It changes a property with the result of transformer function.
*/
export function modifyProp<T, K extends keyof T>(
prop: K,
fn: (x: T[K]) => T[K],
): (target: T) => T;
/**
* It returns `true`, if all members of array `list` returns `false`, when applied as argument to `predicate` function.
*/
export function none<T>(predicate: (x: T) => boolean): (list: T[]) => boolean;
/**
* It creates an object with a single key-value pair.
*/
export function objOf<T, K extends PropertyKey>(key: K): (value: T) => { [P in K]: T };
/**
* It will return `true` if `specification` object fully or partially include `obj` object.
*
* `R.equals` is used to determine equality.
*/
export function objectIncludes<T>(specification: T): (obj: Partial<T>) => boolean;
/**
* It returns a partial copy of an `obj` without `propsToOmit` properties.
*/
export function omit<
S extends string,
Keys extends PickStringToPickPath<S>,
>(propsToPick: S): <U extends Partial<Record<ElementOf<Keys>, any>>>(
obj: ElementOf<Keys> extends keyof U ? U : never
) => ElementOf<Keys> extends keyof U ? MergeTypes<Omit<U, ElementOf<Keys>>> : never;
export function omit<const Keys extends PropertyKey[]>(propsToPick: Keys): <
U extends Partial<Record<ElementOf<Keys>, any>>
>(
obj: ElementOf<Keys> extends keyof U ? U : never
) => ElementOf<Keys> extends keyof U ? MergeTypes<Omit<U, ElementOf<Keys>>> : never;
/**
* It will return array of two arrays according to `predicate` function. The first member holds all instances of `input` that pass the `predicate` function, while the second member - those who doesn't.
*/
export function partition<T, S extends T>(
predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S,
): (data: ReadonlyArray<T>) => [Array<S>, Array<Exclude<T, S>>];
export function partition<T>(
predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean,
): (data: ReadonlyArray<T>) => [Array<T>, Array<T>];
/**
* It returns an array containing two objects. The first object holds all properties of the input object for which the predicate returns true, while the second object holds those that do not.
*/
export function partitionObject<T extends unknown, S extends T>(
predicate: (value: T, prop: string, obj: Record<string, T>) => value is S,
): (obj: Record<string, T>) => [Record<string, S>, Record<string, Exclude<T, S>>];
export function partitionObject<T extends unknown>(
predicate: (value: T, prop: string, obj: Record<string, T>) => boolean,
): (obj: Record<string, T>) => [Record<string, T>, Record<string, T>];
/**
* If `pathToSearch` is `'a.b'` then it will return `1` if `obj` is `{a:{b:1}}`.
*
* It will return `undefined`, if such path is not found.
*/
export function path<S, K0 extends string & keyof S>(path: `${K0}`): (obj: S) => S[K0];
export function path<S, K0 extends string & keyof S, K1 extends string & keyof S[K0]>(path: `${K0}.${K1}`): (obj: S) => S[K0][K1];
export function path<
S,
K0 extends keyof S,
K1 extends keyof S[K0],
K2 extends keyof S[K0][K1]
>(path: [K0, K1, K2]): (obj: S) => S[K0][K1][K2];
export function path<
S,
K0 extends string & keyof S,
K1 extends string & keyof S[K0],
K2 extends string & keyof S[K0][K1]
>(path: `${K0}.${K1}.${K2}`): (obj: S) => S[K0][K1][K2];
export function path<
S,
K0 extends keyof S,
K1 extends keyof S[K0],
K2 extends keyof S[K0][K1],
K3 extends keyof S[K0][K1][K2]
>(path: [K0, K1, K2, K3]): (obj: S) => S[K0][K1][K2][K3];
export function path<
S,
K0 extends string & keyof S,
K1 extends string & keyof S[K0],
K2 extends string & keyof S[K0][K1],
K3 extends string & keyof S[K0][K1][K2]
>(path: `${K0}.${K1}.${K2}.${K3}`): (obj: S) => S[K0][K1][K2][K3];
export function path<
S,
K0 extends keyof S,
K1 extends keyof S[K0],
K2 extends keyof S[K0][K1],
K3 extends keyof S[K0][K1][K2],
K4 extends keyof S[K0][K1][K2][K3]
>(path: [K0, K1, K2, K3, K4]): (obj: S) => S[K0][K1][K2][K3][K4];
export function path<
S,
K0 extends string & keyof S,
K1 extends string & keyof S[K0],
K2 extends string & keyof S[K0][K1],
K3 extends string & keyof S[K0][K1][K2],
K4 extends string & keyof S[K0][K1][K2][K3]
>(path: `${K0}.${K1}.${K2}.${K3}.${K4}`): (obj: S) => S[K0][K1][K2][K3][K4];
export function path<
S,
K0 extends keyof S,
K1 extends keyof S[K0],
K2 extends keyof S[K0][K1],
K3 extends keyof S[K0][K1][K2],
K4 extends keyof S[K0][K1][K2][K3],
K5 extends keyof S[K0][K1][K2][K3][K4]
>(path: [K0, K1, K2, K3, K4, K5]): (obj: S) => S[K0][K1][K2][K3][K4][K5];
export function path<
S,
K0 extends string & keyof S,
K1 extends string & keyof S[K0],
K2 extends string & keyof S[K0][K1],
K3 extends string & keyof S[K0][K1][K2],
K4 extends string & keyof S[K0][K1][K2][K3],
K5 extends string & keyof S[K0][K1][K2][K3][K4]
>(path: `${K0}.${K1}.${K2}.${K3}.${K4}.${K5}`): (obj: S) => S[K0][K1][K2][K3][K4][K5];
export function path<
S,
K0 extends keyof S,
K1 extends keyof S[K0],
K2 extends keyof S[K0][K1],
K3 extends keyof S[K0][K1][K2],
K4 extends keyof S[K0][K1][K2][K3],
K5 extends keyof S[K0][K1][K2][K3][K4],
K6 extends keyof S[K0][K1][K2][K3][K4][K5]
>(path: [K0, K1, K2, K3, K4, K5, K6]): (obj: S) => S[K0][K1][K2][K3][K4][K5][K6];
export function path<
S,
K0 extends string & keyof S,
K1 extends string & keyof S[K0],
K2 extends string & keyof S[K0][K1],
K3 extends string & keyof S[K0][K1][K2],
K4 extends string & keyof S[K0][K1][K2][K3],
K5 extends string & keyof S[K0][K1][K2][K3][K4],
K6 extends string & keyof S[K0][K1][K2][K3][K4][K5]
>(path: `${K0}.${K1}.${K2}.${K3}.${K4}.${K5}.${K6}`): (obj: S) => S[K0][K1][K2][K3][K4][K5][K6];
export function path<
S,
K0 extends keyof S,
K1 extends keyof S[K0],
K2 extends keyof S[K0][K1],
K3 extends keyof S[K0][K1][K2],
K4 extends keyof S[K0][K1][K2][K3],
K5 extends keyof S[K0][K1][K2][K3][K4],
K6 extends keyof S[K0][K1][K2][K3][K4][K5],
K7 extends keyof S[K0][K1][K2][K3][K4][K5][K6]
>(path: [K0, K1, K2, K3, K4, K5, K6, K7]): (obj: S) => S[K0][K1][K2][K3][K4][K5][K6][K7];
export function path<
S,
K0 extends string & keyof S,
K1 extends string & keyof S[K0],
K2 extends string & keyof S[K0][K1],
K3 extends string & keyof S[K0][K1][K2],
K4 extends string & keyof S[K0][K1][K2][K3],
K5 extends string & keyof S[K0][K1][K2][K3][K4],
K6 extends string & keyof S[K0][K1][K2][K3][K4][K5],
K7 extends string & keyof S[K0][K1][K2][K3][K4][K5][K6]
>(path: `${K0}.${K1}.${K2}.${K3}.${K4}.${K5}.${K6}.${K7}`): (obj: S) => S[K0][K1][K2][K3][K4][K5][K6][K7];
export function path<
S,
K0 extends keyof S,
K1 extends keyof S[K0],
K2 extends keyof S[K0][K1],
K3 extends keyof S[K0][K1][K2],
K4 extends keyof S[K0][K1][K2][K3],
K5 extends keyof S[K0][K1][K2][K3][K4],
K6 extends keyof S[K0][K1][K2][K3][K4][K5],
K7 extends keyof S[K0][K1][K2][K3][K4][K5][K6],
K8 extends keyof S[K0][K1][K2][K3][K4][K5][K6][K7]
>(path: [K0, K1, K2, K3, K4, K5, K6, K7, K8]): (obj: S) => S[K0][K1][K2][K3][K4][K5][K6][K7][K8];
export function path<
S,
K0 extends string & keyof S,
K1 extends string & keyof S[K0],
K2 extends string & keyof S[K0][K1],
K3 extends string & keyof S[K0][K1][K2],
K4 extends string & keyof S[K0][K1][K2][K3],
K5 extends string & keyof S[K0][K1][K2][K3][K4],
K6 extends string & keyof S[K0][K1][K2][K3][K4][K5],
K7 extends string & keyof S[K0][K1][K2][K3][K4][K5][K6],