rambda 7.3.0 → 7.4.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/CHANGELOG.md +10 -0
- package/README.md +298 -2270
- package/dist/rambda.js +6 -359
- package/dist/rambda.mjs +13 -369
- package/dist/rambda.umd.js +1 -1
- package/immutable.d.ts +285 -238
- package/index.d.ts +285 -238
- package/package.json +23 -21
- package/rambda.js +187 -0
- package/src/equals.js +0 -12
- package/src/map.js +1 -0
- package/src/nop.js +1 -0
- package/src/test.js +1 -1
package/index.d.ts
CHANGED
|
@@ -7,11 +7,14 @@ export type Iterator<T, U> = (x: T) => U;
|
|
|
7
7
|
export type ObjectIterator<T, U> = (x: T, prop: string, inputObj: Dictionary<T>) => U;
|
|
8
8
|
type Ord = number | string | boolean | Date;
|
|
9
9
|
type Path = string | (number | string)[];
|
|
10
|
+
type RamdaPath = (number | string)[];
|
|
10
11
|
type Predicate<T> = (x: T) => boolean;
|
|
11
12
|
export type IndexedPredicate<T> = (x: T, i: number) => boolean;
|
|
12
13
|
export type ObjectPredicate<T> = (x: T, prop: string, inputObj: Dictionary<T>) => boolean;
|
|
13
|
-
export type RamdaPath = (number | string)[];
|
|
14
14
|
type CondPair<T extends any[], R> = [(...val: T) => boolean, (...val: T) => R]
|
|
15
|
+
type Prop<T, P extends keyof never> = P extends keyof Exclude<T, undefined>
|
|
16
|
+
? T extends undefined ? undefined : T[Extract<P, keyof T>]
|
|
17
|
+
: undefined;
|
|
15
18
|
|
|
16
19
|
type ValueOfRecord<R> =
|
|
17
20
|
R extends Record<any, infer T>
|
|
@@ -136,6 +139,10 @@ type ApplyDiffRule = ApplyDiffUpdate | ApplyDiffAdd | ApplyDiffRemove;
|
|
|
136
139
|
type Resolved<T> = {status: 'fulfilled', value: T} | {status: 'rejected', reason: string|Error}
|
|
137
140
|
|
|
138
141
|
|
|
142
|
+
export function F(): boolean;
|
|
143
|
+
|
|
144
|
+
export function T(): boolean;
|
|
145
|
+
|
|
139
146
|
/**
|
|
140
147
|
* It adds `a` and `b`.
|
|
141
148
|
*/
|
|
@@ -171,12 +178,6 @@ export function always<T>(x: T): (...args: unknown[]) => T;
|
|
|
171
178
|
export function and<T, U>(x: T, y: U): T | U;
|
|
172
179
|
export function and<T>(x: T): <U>(y: U) => T | U;
|
|
173
180
|
|
|
174
|
-
/**
|
|
175
|
-
* Logical OR
|
|
176
|
-
*/
|
|
177
|
-
export function or<T, U>(a: T, b: U): T | U;
|
|
178
|
-
export function or<T>(a: T): <U>(b: U) => T | U;
|
|
179
|
-
|
|
180
181
|
/**
|
|
181
182
|
* It returns `true`, if at least one member of `list` returns true, when passed to a `predicate` function.
|
|
182
183
|
*/
|
|
@@ -195,6 +196,14 @@ export function anyPass<T>(predicates: ((...inputs: T[]) => boolean)[]): (...inp
|
|
|
195
196
|
export function append<T>(x: T, list: T[]): T[];
|
|
196
197
|
export function append<T>(x: T): <T>(list: T[]) => T[];
|
|
197
198
|
|
|
199
|
+
/**
|
|
200
|
+
* It applies function `fn` to the list of arguments.
|
|
201
|
+
*
|
|
202
|
+
* This is useful for creating a fixed-arity function from a variadic function. `fn` should be a bound function if context is significant.
|
|
203
|
+
*/
|
|
204
|
+
export function apply<T = any>(fn: (...args: any[]) => T, args: any[]): T;
|
|
205
|
+
export function apply<T = any>(fn: (...args: any[]) => T): (args: any[]) => T;
|
|
206
|
+
|
|
198
207
|
export function applySpec<Spec extends Record<string, AnyFunction>>(
|
|
199
208
|
spec: Spec
|
|
200
209
|
): (
|
|
@@ -216,6 +225,12 @@ export function assocPath<Output>(path: Path, newValue: any, obj: object): Outpu
|
|
|
216
225
|
export function assocPath<Output>(path: Path, newValue: any): (obj: object) => Output;
|
|
217
226
|
export function assocPath<Output>(path: Path): (newValue: any) => (obj: object) => Output;
|
|
218
227
|
|
|
228
|
+
/**
|
|
229
|
+
* Creates a function that is bound to a context.
|
|
230
|
+
*/
|
|
231
|
+
export function bind<F extends AnyFunction, T>(fn: F, thisObj: T): (...args: Parameters<F>) => ReturnType<F>;
|
|
232
|
+
export function bind<F extends AnyFunction, T>(fn: F): (thisObj: T) => (...args: Parameters<F>) => ReturnType<F>;
|
|
233
|
+
|
|
219
234
|
/**
|
|
220
235
|
* It returns a function with `input` argument.
|
|
221
236
|
*
|
|
@@ -347,6 +362,18 @@ export function cond<T extends any[], R>(conditions: Array<CondPair<T, R>>): (..
|
|
|
347
362
|
*/
|
|
348
363
|
export function converge(after: ((...a: any[]) => any), fns: ((...x: any[]) => any)[]): (...y: any[]) => any;
|
|
349
364
|
|
|
365
|
+
/**
|
|
366
|
+
* It counts how many times `predicate` function returns `true`, when supplied with iteration of `list`.
|
|
367
|
+
*/
|
|
368
|
+
export function count<T>(predicate: (x: T) => boolean, list: T[]): number;
|
|
369
|
+
export function count<T>(predicate: (x: T) => boolean): (list: T[]) => number;
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* It counts elements in a list after each instance of the input list is passed through `transformFn` function.
|
|
373
|
+
*/
|
|
374
|
+
export function countBy<T extends unknown>(transformFn: (x: T) => any, list: T[]): Record<string, number>;
|
|
375
|
+
export function countBy<T extends unknown>(transformFn: (x: T) => any): (list: T[]) => Record<string, number>;
|
|
376
|
+
|
|
350
377
|
/**
|
|
351
378
|
* It expects a function as input and returns its curried version.
|
|
352
379
|
*/
|
|
@@ -407,6 +434,24 @@ export function dropLast<T>(howMany: number): {
|
|
|
407
434
|
(input: string): string;
|
|
408
435
|
};
|
|
409
436
|
|
|
437
|
+
export function dropLastWhile(predicate: (x: string) => boolean, iterable: string): string;
|
|
438
|
+
export function dropLastWhile(predicate: (x: string) => boolean): (iterable: string) => string;
|
|
439
|
+
export function dropLastWhile<T>(predicate: (x: T) => boolean, iterable: T[]): T[];
|
|
440
|
+
export function dropLastWhile<T>(predicate: (x: T) => boolean): <T>(iterable: T[]) => T[];
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* It removes any successive duplicates according to `R.equals`.
|
|
444
|
+
*/
|
|
445
|
+
export function dropRepeats<T>(list: T[]): T[];
|
|
446
|
+
|
|
447
|
+
export function dropRepeatsWith<T>(predicate: (x: T, y: T) => boolean, list: T[]): T[];
|
|
448
|
+
export function dropRepeatsWith<T>(predicate: (x: T, y: T) => boolean): (list: T[]) => T[];
|
|
449
|
+
|
|
450
|
+
export function dropWhile(fn: Predicate<string>, iterable: string): string;
|
|
451
|
+
export function dropWhile(fn: Predicate<string>): (iterable: string) => string;
|
|
452
|
+
export function dropWhile<T>(fn: Predicate<T>, iterable: T[]): T[];
|
|
453
|
+
export function dropWhile<T>(fn: Predicate<T>): (iterable: T[]) => T[];
|
|
454
|
+
|
|
410
455
|
/**
|
|
411
456
|
* It returns a new `predicate` function from `firstPredicate` and `secondPredicate` inputs.
|
|
412
457
|
*
|
|
@@ -426,13 +471,26 @@ export function endsWith(target: string): (iterable: string) => boolean;
|
|
|
426
471
|
export function endsWith<T>(target: T[], list: T[]): boolean;
|
|
427
472
|
export function endsWith<T>(target: T[]): (list: T[]) => boolean;
|
|
428
473
|
|
|
474
|
+
/**
|
|
475
|
+
* It returns `true` if property `prop` in `obj1` is equal to property `prop` in `obj2` according to `R.equals`.
|
|
476
|
+
*/
|
|
477
|
+
export function eqProps<T, U>(prop: string, obj1: T, obj2: U): boolean;
|
|
478
|
+
export function eqProps<P extends string>(prop: P): <T, U>(obj1: Record<P, T>, obj2: Record<P, U>) => boolean;
|
|
479
|
+
export function eqProps<T>(prop: string, obj1: T): <U>(obj2: U) => boolean;
|
|
480
|
+
|
|
429
481
|
/**
|
|
430
482
|
* It deeply compares `x` and `y` and returns `true` if they are equal.
|
|
431
483
|
*/
|
|
432
484
|
export function equals<T>(x: T, y: T): boolean;
|
|
433
485
|
export function equals<T>(x: T): (y: T) => boolean;
|
|
434
486
|
|
|
435
|
-
|
|
487
|
+
/**
|
|
488
|
+
* It takes object or array of functions as set of rules. These `rules` are applied to the `iterable` input to produce the result.
|
|
489
|
+
*/
|
|
490
|
+
export function evolve<T, U>(rules: ((x: T) => U)[], list: T[]): U[];
|
|
491
|
+
export function evolve<T, U>(rules: ((x: T) => U)[]) : (list: T[]) => U[];
|
|
492
|
+
export function evolve<E extends Evolver, V extends Evolvable<E>>(rules: E, obj: V): Evolve<V, E>;
|
|
493
|
+
export function evolve<E extends Evolver>(rules: E): <V extends Evolvable<E>>(obj: V) => Evolve<V, E>;
|
|
436
494
|
|
|
437
495
|
/**
|
|
438
496
|
* It filters list or object `input` using a `predicate` function.
|
|
@@ -641,6 +699,16 @@ export function isNil(x: any): x is null | undefined;
|
|
|
641
699
|
export function join<T>(glue: string, list: T[]): string;
|
|
642
700
|
export function join<T>(glue: string): (list: T[]) => string;
|
|
643
701
|
|
|
702
|
+
/**
|
|
703
|
+
* It applies list of function to a list of inputs.
|
|
704
|
+
*/
|
|
705
|
+
export function juxt<A extends any[], R1>(fns: [(...a: A) => R1]): (...a: A) => [R1];
|
|
706
|
+
export function juxt<A extends any[], R1, R2>(fns: [(...a: A) => R1, (...a: A) => R2]): (...a: A) => [R1, R2];
|
|
707
|
+
export function juxt<A extends any[], R1, R2, R3>(fns: [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3]): (...a: A) => [R1, R2, R3];
|
|
708
|
+
export function juxt<A extends any[], R1, R2, R3, R4>(fns: [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3, (...a: A) => R4]): (...a: A) => [R1, R2, R3, R4];
|
|
709
|
+
export function juxt<A extends any[], R1, R2, R3, R4, R5>(fns: [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3, (...a: A) => R4, (...a: A) => R5]): (...a: A) => [R1, R2, R3, R4, R5];
|
|
710
|
+
export function juxt<A extends any[], U>(fns: Array<(...args: A) => U>): (...args: A) => U[];
|
|
711
|
+
|
|
644
712
|
/**
|
|
645
713
|
* It applies `Object.keys` over `x` and returns its keys.
|
|
646
714
|
*/
|
|
@@ -697,29 +765,6 @@ export function lensProp(prop: string): {
|
|
|
697
765
|
set<T, U, V>(val: T, obj: U): V;
|
|
698
766
|
};
|
|
699
767
|
|
|
700
|
-
/**
|
|
701
|
-
* It returns a copied **Object** or **Array** with modified value received by applying function `fn` to `lens` focus.
|
|
702
|
-
*/
|
|
703
|
-
export function over<T>(lens: Lens, fn: Arity1Fn, value: T): T;
|
|
704
|
-
export function over<T>(lens: Lens, fn: Arity1Fn, value: T[]): T[];
|
|
705
|
-
export function over(lens: Lens, fn: Arity1Fn): <T>(value: T) => T;
|
|
706
|
-
export function over(lens: Lens, fn: Arity1Fn): <T>(value: T[]) => T[];
|
|
707
|
-
export function over(lens: Lens): <T>(fn: Arity1Fn, value: T) => T;
|
|
708
|
-
export function over(lens: Lens): <T>(fn: Arity1Fn, value: T[]) => T[];
|
|
709
|
-
|
|
710
|
-
/**
|
|
711
|
-
* It returns a copied **Object** or **Array** with modified `lens` focus set to `replacer` value.
|
|
712
|
-
*/
|
|
713
|
-
export function set<T, U>(lens: Lens, replacer: U, obj: T): T;
|
|
714
|
-
export function set<U>(lens: Lens, replacer: U): <T>(obj: T) => T;
|
|
715
|
-
export function set(lens: Lens): <T, U>(replacer: U, obj: T) => T;
|
|
716
|
-
|
|
717
|
-
/**
|
|
718
|
-
* It returns the value of `lens` focus over `target` object.
|
|
719
|
-
*/
|
|
720
|
-
export function view<T, U>(lens: Lens): (target: T) => U;
|
|
721
|
-
export function view<T, U>(lens: Lens, target: T): U;
|
|
722
|
-
|
|
723
768
|
/**
|
|
724
769
|
* It returns the result of looping through `iterable` with `fn`.
|
|
725
770
|
*
|
|
@@ -781,12 +826,6 @@ export function median(list: number[]): number;
|
|
|
781
826
|
export function merge<A, B>(target: A, newProps: B): A & B
|
|
782
827
|
export function merge<Output>(target: any): (newProps: any) => Output;
|
|
783
828
|
|
|
784
|
-
/**
|
|
785
|
-
* It creates a copy of `target` object with overidden `newProps` properties. Previously known as `R.merge` but renamed after Ramda did the same.
|
|
786
|
-
*/
|
|
787
|
-
export function mergeRight<A, B>(target: A, newProps: B): A & B
|
|
788
|
-
export function mergeRight<Output>(target: any): (newProps: any) => Output;
|
|
789
|
-
|
|
790
829
|
/**
|
|
791
830
|
* It merges all objects of `list` array sequentially and returns the result.
|
|
792
831
|
*/
|
|
@@ -808,6 +847,22 @@ export function mergeDeepRight<Output>(target: object): (newProps: object) => Ou
|
|
|
808
847
|
export function mergeLeft<Output>(newProps: object, target: object): Output;
|
|
809
848
|
export function mergeLeft<Output>(newProps: object): (target: object) => Output;
|
|
810
849
|
|
|
850
|
+
/**
|
|
851
|
+
* It creates a copy of `target` object with overidden `newProps` properties. Previously known as `R.merge` but renamed after Ramda did the same.
|
|
852
|
+
*/
|
|
853
|
+
export function mergeRight<A, B>(target: A, newProps: B): A & B
|
|
854
|
+
export function mergeRight<Output>(target: any): (newProps: any) => Output;
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
|
+
* It takes two objects and a function, which will be used when there is an overlap between the keys.
|
|
858
|
+
*/
|
|
859
|
+
export function mergeWith(fn: (x: any, z: any) => any, a: Record<string, unknown>, b: Record<string, unknown>): Record<string, unknown>;
|
|
860
|
+
export function mergeWith<Output>(fn: (x: any, z: any) => any, a: Record<string, unknown>, b: Record<string, unknown>): Output;
|
|
861
|
+
export function mergeWith(fn: (x: any, z: any) => any, a: Record<string, unknown>): (b: Record<string, unknown>) => Record<string, unknown>;
|
|
862
|
+
export function mergeWith<Output>(fn: (x: any, z: any) => any, a: Record<string, unknown>): (b: Record<string, unknown>) => Output;
|
|
863
|
+
export function mergeWith(fn: (x: any, z: any) => any): <U, V>(a: U, b: V) => Record<string, unknown>;
|
|
864
|
+
export function mergeWith<Output>(fn: (x: any, z: any) => any): <U, V>(a: U, b: V) => Output;
|
|
865
|
+
|
|
811
866
|
/**
|
|
812
867
|
* It returns the lesser value between `x` and `y`.
|
|
813
868
|
*/
|
|
@@ -821,6 +876,23 @@ export function minBy<T>(compareFn: (input: T) => Ord, x: T, y: T): T;
|
|
|
821
876
|
export function minBy<T>(compareFn: (input: T) => Ord, x: T): (y: T) => T;
|
|
822
877
|
export function minBy<T>(compareFn: (input: T) => Ord): (x: T) => (y: T) => T;
|
|
823
878
|
|
|
879
|
+
export function modify<T extends object, K extends keyof T, P>(
|
|
880
|
+
prop: K,
|
|
881
|
+
fn: (a: T[K]) => P,
|
|
882
|
+
obj: T,
|
|
883
|
+
): Omit<T, K> & Record<K, P>;
|
|
884
|
+
export function modify<K extends string, A, P>(
|
|
885
|
+
prop: K,
|
|
886
|
+
fn: (a: A) => P,
|
|
887
|
+
): <T extends Record<K, A>>(target: T) => Omit<T, K> & Record<K, P>;
|
|
888
|
+
|
|
889
|
+
/**
|
|
890
|
+
* It changes a property of object on the base of provided path and transformer function.
|
|
891
|
+
*/
|
|
892
|
+
export function modifyPath<T extends Record<string, unknown>>(path: Path, fn: (x: any) => unknown, object: Record<string, unknown>): T;
|
|
893
|
+
export function modifyPath<T extends Record<string, unknown>>(path: Path, fn: (x: any) => unknown): (object: Record<string, unknown>) => T;
|
|
894
|
+
export function modifyPath<T extends Record<string, unknown>>(path: Path): (fn: (x: any) => unknown) => (object: Record<string, unknown>) => T;
|
|
895
|
+
|
|
824
896
|
/**
|
|
825
897
|
* Curried version of `x%y`.
|
|
826
898
|
*/
|
|
@@ -851,6 +923,11 @@ export function negate(x: number): number;
|
|
|
851
923
|
export function none<T>(predicate: (x: T) => boolean, list: T[]): boolean;
|
|
852
924
|
export function none<T>(predicate: (x: T) => boolean): (list: T[]) => boolean;
|
|
853
925
|
|
|
926
|
+
/**
|
|
927
|
+
* It returns `undefined`.
|
|
928
|
+
*/
|
|
929
|
+
export function nop(): void;
|
|
930
|
+
|
|
854
931
|
/**
|
|
855
932
|
* It returns a boolean negated version of `input`.
|
|
856
933
|
*/
|
|
@@ -872,10 +949,7 @@ export function nth(n: number): {
|
|
|
872
949
|
export function objOf<T, K extends string>(key: K, value: T): Record<K, T>;
|
|
873
950
|
export function objOf<K extends string>(key: K): <T>(value: T) => Record<K, T>;
|
|
874
951
|
|
|
875
|
-
|
|
876
|
-
* It returns a function, which invokes only once `fn` function.
|
|
877
|
-
*/
|
|
878
|
-
export function once<T extends AnyFunction>(func: T): T;
|
|
952
|
+
export function of<T>(x: T): T[];
|
|
879
953
|
|
|
880
954
|
/**
|
|
881
955
|
* It returns a partial copy of an `obj` without `propsToOmit` properties.
|
|
@@ -887,7 +961,38 @@ export function omit<T, U>(propsToOmit: string): (obj: T) => U;
|
|
|
887
961
|
export function omit<T>(propsToOmit: string, obj: object): T;
|
|
888
962
|
export function omit<T>(propsToOmit: string): (obj: object) => T;
|
|
889
963
|
|
|
890
|
-
|
|
964
|
+
/**
|
|
965
|
+
* It passes the two inputs through `unaryFn` and then the results are passed as inputs the the `binaryFn` to receive the final result(`binaryFn(unaryFn(FIRST_INPUT), unaryFn(SECOND_INPUT))`).
|
|
966
|
+
*
|
|
967
|
+
* This method is also known as P combinator.
|
|
968
|
+
*/
|
|
969
|
+
export function on<T, U, R>(binaryFn: (a: U, b: U) => R, unaryFn: (value: T) => U, a: T, b: T): R;
|
|
970
|
+
export function on<T, U, R>(binaryFn: (a: U, b: U) => R, unaryFn: (value: T) => U, a: T): (b: T) => R;
|
|
971
|
+
export function on<T, U, R>(binaryFn: (a: U, b: U) => R, unaryFn: (value: T) => U): {
|
|
972
|
+
(a: T, b: T): R;
|
|
973
|
+
(a: T): (b: T) => R;
|
|
974
|
+
};
|
|
975
|
+
|
|
976
|
+
/**
|
|
977
|
+
* It returns a function, which invokes only once `fn` function.
|
|
978
|
+
*/
|
|
979
|
+
export function once<T extends AnyFunction>(func: T): T;
|
|
980
|
+
|
|
981
|
+
/**
|
|
982
|
+
* Logical OR
|
|
983
|
+
*/
|
|
984
|
+
export function or<T, U>(a: T, b: U): T | U;
|
|
985
|
+
export function or<T>(a: T): <U>(b: U) => T | U;
|
|
986
|
+
|
|
987
|
+
/**
|
|
988
|
+
* It returns a copied **Object** or **Array** with modified value received by applying function `fn` to `lens` focus.
|
|
989
|
+
*/
|
|
990
|
+
export function over<T>(lens: Lens, fn: Arity1Fn, value: T): T;
|
|
991
|
+
export function over<T>(lens: Lens, fn: Arity1Fn, value: T[]): T[];
|
|
992
|
+
export function over(lens: Lens, fn: Arity1Fn): <T>(value: T) => T;
|
|
993
|
+
export function over(lens: Lens, fn: Arity1Fn): <T>(value: T[]) => T[];
|
|
994
|
+
export function over(lens: Lens): <T>(fn: Arity1Fn, value: T) => T;
|
|
995
|
+
export function over(lens: Lens): <T>(fn: Arity1Fn, value: T[]) => T[];
|
|
891
996
|
|
|
892
997
|
/**
|
|
893
998
|
* It is very similar to `R.curry`, but you can pass initial arguments when you create the curried function.
|
|
@@ -903,6 +1008,16 @@ export function partial<V0, V1, V2, V3, T>(fn: (x0: V0, x1: V1, x2: V2, x3: V3)
|
|
|
903
1008
|
export function partial<V0, V1, V2, V3, T>(fn: (x0: V0, x1: V1, x2: V2, x3: V3) => T, args: [V0]): (x1: V1, x2: V2, x3: V3) => T;
|
|
904
1009
|
export function partial<T>(fn: (...a: any[]) => T, args: any[]): (...x: any[]) => T;
|
|
905
1010
|
|
|
1011
|
+
/**
|
|
1012
|
+
* `R.partialObject` is a curry helper designed specifically for functions accepting object as a single argument.
|
|
1013
|
+
*
|
|
1014
|
+
* Initially the function knows only a part from the whole input object and then `R.partialObject` helps in preparing the function for the second part, when it receives the rest of the input.
|
|
1015
|
+
*/
|
|
1016
|
+
export function partialObject<Input, PartialInput, Output>(
|
|
1017
|
+
fn: (input: Input) => Output,
|
|
1018
|
+
partialInput: PartialInput,
|
|
1019
|
+
): (input: Pick<Input, Exclude<keyof Input, keyof PartialInput>>) => Output;
|
|
1020
|
+
|
|
906
1021
|
/**
|
|
907
1022
|
* It will return array of two objects/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.
|
|
908
1023
|
*/
|
|
@@ -926,10 +1041,41 @@ export function partition<T>(
|
|
|
926
1041
|
*
|
|
927
1042
|
* It will return `undefined`, if such path is not found.
|
|
928
1043
|
*/
|
|
929
|
-
export function path<
|
|
930
|
-
export function path<
|
|
931
|
-
export function path<
|
|
932
|
-
|
|
1044
|
+
export function path<S, K0 extends keyof S = keyof S>(path: [K0], obj: S): S[K0];
|
|
1045
|
+
export function path<S, K0 extends keyof S = keyof S, K1 extends keyof S[K0] = keyof S[K0]>(path: [K0, K1], obj: S): S[K0][K1];
|
|
1046
|
+
export function path<
|
|
1047
|
+
S,
|
|
1048
|
+
K0 extends keyof S = keyof S,
|
|
1049
|
+
K1 extends keyof S[K0] = keyof S[K0],
|
|
1050
|
+
K2 extends keyof S[K0][K1] = keyof S[K0][K1]
|
|
1051
|
+
>(path: [K0, K1, K2], obj: S): S[K0][K1][K2];
|
|
1052
|
+
export function path<
|
|
1053
|
+
S,
|
|
1054
|
+
K0 extends keyof S = keyof S,
|
|
1055
|
+
K1 extends keyof S[K0] = keyof S[K0],
|
|
1056
|
+
K2 extends keyof S[K0][K1] = keyof S[K0][K1],
|
|
1057
|
+
K3 extends keyof S[K0][K1][K2] = keyof S[K0][K1][K2],
|
|
1058
|
+
>(path: [K0, K1, K2, K3], obj: S): S[K0][K1][K2][K3];
|
|
1059
|
+
export function path<
|
|
1060
|
+
S,
|
|
1061
|
+
K0 extends keyof S = keyof S,
|
|
1062
|
+
K1 extends keyof S[K0] = keyof S[K0],
|
|
1063
|
+
K2 extends keyof S[K0][K1] = keyof S[K0][K1],
|
|
1064
|
+
K3 extends keyof S[K0][K1][K2] = keyof S[K0][K1][K2],
|
|
1065
|
+
K4 extends keyof S[K0][K1][K2][K3] = keyof S[K0][K1][K2][K3],
|
|
1066
|
+
>(path: [K0, K1, K2, K3, K4], obj: S): S[K0][K1][K2][K3][K4];
|
|
1067
|
+
export function path<
|
|
1068
|
+
S,
|
|
1069
|
+
K0 extends keyof S = keyof S,
|
|
1070
|
+
K1 extends keyof S[K0] = keyof S[K0],
|
|
1071
|
+
K2 extends keyof S[K0][K1] = keyof S[K0][K1],
|
|
1072
|
+
K3 extends keyof S[K0][K1][K2] = keyof S[K0][K1][K2],
|
|
1073
|
+
K4 extends keyof S[K0][K1][K2][K3] = keyof S[K0][K1][K2][K3],
|
|
1074
|
+
K5 extends keyof S[K0][K1][K2][K3][K4] = keyof S[K0][K1][K2][K3][K4],
|
|
1075
|
+
>(path: [K0, K1, K2, K3, K4, K5], obj: S): S[K0][K1][K2][K3][K4][K5];
|
|
1076
|
+
export function path<T>(pathToSearch: string, obj: any): T | undefined;
|
|
1077
|
+
export function path<T>(pathToSearch: string): (obj: any) => T | undefined;
|
|
1078
|
+
export function path<T>(pathToSearch: RamdaPath): (obj: any) => T | undefined;
|
|
933
1079
|
|
|
934
1080
|
/**
|
|
935
1081
|
* It returns `true` if `pathToSearch` of `input` object is equal to `target` value.
|
|
@@ -940,6 +1086,13 @@ export function pathEq(pathToSearch: Path, target: any, input: any): boolean;
|
|
|
940
1086
|
export function pathEq(pathToSearch: Path, target: any): (input: any) => boolean;
|
|
941
1087
|
export function pathEq(pathToSearch: Path): (target: any) => (input: any) => boolean;
|
|
942
1088
|
|
|
1089
|
+
/**
|
|
1090
|
+
* It reads `obj` input and returns either `R.path(pathToSearch, Record<string, unknown>)` result or `defaultValue` input.
|
|
1091
|
+
*/
|
|
1092
|
+
export function pathOr<T>(defaultValue: T, pathToSearch: Path, obj: any): T;
|
|
1093
|
+
export function pathOr<T>(defaultValue: T, pathToSearch: Path): (obj: any) => T;
|
|
1094
|
+
export function pathOr<T>(defaultValue: T): (pathToSearch: Path) => (obj: any) => T;
|
|
1095
|
+
|
|
943
1096
|
/**
|
|
944
1097
|
* It loops over members of `pathsToSearch` as `singlePath` and returns the array produced by `R.path(singlePath, Record<string, unknown>)`.
|
|
945
1098
|
*
|
|
@@ -950,13 +1103,6 @@ export function paths<Input, T>(pathsToSearch: Path[]): (obj: Input) => (T | und
|
|
|
950
1103
|
export function paths<T>(pathsToSearch: Path[], obj: any): (T | undefined)[];
|
|
951
1104
|
export function paths<T>(pathsToSearch: Path[]): (obj: any) => (T | undefined)[];
|
|
952
1105
|
|
|
953
|
-
/**
|
|
954
|
-
* It reads `obj` input and returns either `R.path(pathToSearch, Record<string, unknown>)` result or `defaultValue` input.
|
|
955
|
-
*/
|
|
956
|
-
export function pathOr<T>(defaultValue: T, pathToSearch: Path, obj: any): T;
|
|
957
|
-
export function pathOr<T>(defaultValue: T, pathToSearch: Path): (obj: any) => T;
|
|
958
|
-
export function pathOr<T>(defaultValue: T): (pathToSearch: Path) => (obj: any) => T;
|
|
959
|
-
|
|
960
1106
|
/**
|
|
961
1107
|
* It returns a partial copy of an `input` containing only `propsToPick` properties.
|
|
962
1108
|
*
|
|
@@ -974,8 +1120,9 @@ export function pick<T>(propsToPick: string): (input: object) => T;
|
|
|
974
1120
|
/**
|
|
975
1121
|
* Same as `R.pick` but it won't skip the missing props, i.e. it will assign them to `undefined`.
|
|
976
1122
|
*/
|
|
977
|
-
export function pickAll<T,
|
|
978
|
-
export function pickAll<T, U>(
|
|
1123
|
+
export function pickAll<T, K extends keyof T>(propsToPicks: K[], input: T): Pick<T, K>;
|
|
1124
|
+
export function pickAll<T, U>(propsToPicks: string[], input: T): U;
|
|
1125
|
+
export function pickAll(propsToPicks: string[]): <T, U>(input: T) => U;
|
|
979
1126
|
export function pickAll<T, U>(propsToPick: string, input: T): U;
|
|
980
1127
|
export function pickAll<T, U>(propsToPick: string): (input: T) => U;
|
|
981
1128
|
|
|
@@ -1059,10 +1206,17 @@ export function product(list: number[]): number;
|
|
|
1059
1206
|
*
|
|
1060
1207
|
* If there is no such property, it returns `undefined`.
|
|
1061
1208
|
*/
|
|
1062
|
-
export function prop<P extends keyof
|
|
1063
|
-
export function prop<P extends keyof
|
|
1064
|
-
|
|
1065
|
-
|
|
1209
|
+
export function prop<P extends keyof never, T>(propToFind: P, value: T): Prop<T, P>;
|
|
1210
|
+
export function prop<P extends keyof never>(propToFind: P): {
|
|
1211
|
+
<T>(value: Record<P, T>): T;
|
|
1212
|
+
<T>(value: T): Prop<T, P>;
|
|
1213
|
+
};
|
|
1214
|
+
export function prop<P extends keyof T, T>(propToFind: P): {
|
|
1215
|
+
(value: T): Prop<T, P>;
|
|
1216
|
+
};
|
|
1217
|
+
export function prop<P extends keyof never, T>(propToFind: P): {
|
|
1218
|
+
(value: Record<P, T>): T;
|
|
1219
|
+
};
|
|
1066
1220
|
|
|
1067
1221
|
/**
|
|
1068
1222
|
* It returns true if `obj` has property `propToFind` and its value is equal to `valueToMatch`.
|
|
@@ -1102,6 +1256,13 @@ export function propOr<T>(defaultValue: T): {
|
|
|
1102
1256
|
export function propSatisfies<T>(predicate: Predicate<T>, property: string, obj: Record<string, T>): boolean;
|
|
1103
1257
|
export function propSatisfies<T>(predicate: Predicate<T>, property: string): (obj: Record<string, T>) => boolean;
|
|
1104
1258
|
|
|
1259
|
+
/**
|
|
1260
|
+
* It takes list with properties `propsToPick` and returns a list with property values in `obj`.
|
|
1261
|
+
*/
|
|
1262
|
+
export function props<P extends string, T>(propsToPick: P[], obj: Record<P, T>): T[];
|
|
1263
|
+
export function props<P extends string>(propsToPick: P[]): <T>(obj: Record<P, T>) => T[];
|
|
1264
|
+
export function props<P extends string, T>(propsToPick: P[]): (obj: Record<P, T>) => T[];
|
|
1265
|
+
|
|
1105
1266
|
/**
|
|
1106
1267
|
* It returns list of numbers between `startInclusive` to `endExclusive` markers.
|
|
1107
1268
|
*/
|
|
@@ -1137,6 +1298,13 @@ export function replace(strOrRegex: RegExp | string): (replacer: string) => (str
|
|
|
1137
1298
|
export function reverse<T>(input: T[]): T[];
|
|
1138
1299
|
export function reverse(input: string): string;
|
|
1139
1300
|
|
|
1301
|
+
/**
|
|
1302
|
+
* It returns a copied **Object** or **Array** with modified `lens` focus set to `replacer` value.
|
|
1303
|
+
*/
|
|
1304
|
+
export function set<T, U>(lens: Lens, replacer: U, obj: T): T;
|
|
1305
|
+
export function set<U>(lens: Lens, replacer: U): <T>(obj: T) => T;
|
|
1306
|
+
export function set(lens: Lens): <T, U>(replacer: U, obj: T) => T;
|
|
1307
|
+
|
|
1140
1308
|
export function slice(from: number, to: number, input: string): string;
|
|
1141
1309
|
export function slice<T>(from: number, to: number, input: T[]): T[];
|
|
1142
1310
|
export function slice(from: number, to: number): {
|
|
@@ -1167,6 +1335,16 @@ export function sortBy(sortFn: (a: any) => Ord): <T>(list: T[]) => T[];
|
|
|
1167
1335
|
export function split(separator: string | RegExp): (str: string) => string[];
|
|
1168
1336
|
export function split(separator: string | RegExp, str: string): string[];
|
|
1169
1337
|
|
|
1338
|
+
/**
|
|
1339
|
+
* It splits string or array at a given index.
|
|
1340
|
+
*/
|
|
1341
|
+
export function splitAt<T>(index: number, input: T[]): [T[], T[]];
|
|
1342
|
+
export function splitAt(index: number, input: string): [string, string];
|
|
1343
|
+
export function splitAt(index: number): {
|
|
1344
|
+
<T>(input: T[]): [T[], T[]];
|
|
1345
|
+
(input: string): [string, string];
|
|
1346
|
+
};
|
|
1347
|
+
|
|
1170
1348
|
/**
|
|
1171
1349
|
* It splits `input` into slices of `sliceLength`.
|
|
1172
1350
|
*/
|
|
@@ -1177,6 +1355,14 @@ export function splitEvery(sliceLength: number): {
|
|
|
1177
1355
|
<T>(input: T[]): (T[])[];
|
|
1178
1356
|
};
|
|
1179
1357
|
|
|
1358
|
+
/**
|
|
1359
|
+
* It splits `list` to two arrays according to a `predicate` function.
|
|
1360
|
+
*
|
|
1361
|
+
* The first array contains all members of `list` before `predicate` returns `true`.
|
|
1362
|
+
*/
|
|
1363
|
+
export function splitWhen<T, U>(predicate: Predicate<T>, list: U[]): (U[])[];
|
|
1364
|
+
export function splitWhen<T>(predicate: Predicate<T>): <U>(list: U[]) => (U[])[];
|
|
1365
|
+
|
|
1180
1366
|
/**
|
|
1181
1367
|
* When iterable is a string, then it behaves as `String.prototype.startsWith`.
|
|
1182
1368
|
* When iterable is a list, then it uses R.equals to determine if the target list starts in the same way as the given target.
|
|
@@ -1202,8 +1388,6 @@ export function sum(list: number[]): number;
|
|
|
1202
1388
|
export function symmetricDifference<T>(x: T[], y: T[]): T[];
|
|
1203
1389
|
export function symmetricDifference<T>(x: T[]): <T>(y: T[]) => T[];
|
|
1204
1390
|
|
|
1205
|
-
export function T(): boolean;
|
|
1206
|
-
|
|
1207
1391
|
/**
|
|
1208
1392
|
* It returns all but the first element of `input`.
|
|
1209
1393
|
*/
|
|
@@ -1230,6 +1414,16 @@ export function takeLast<T>(howMany: number): {
|
|
|
1230
1414
|
(input: string): string;
|
|
1231
1415
|
};
|
|
1232
1416
|
|
|
1417
|
+
export function takeLastWhile(predicate: (x: string) => boolean, input: string): string;
|
|
1418
|
+
export function takeLastWhile(predicate: (x: string) => boolean): (input: string) => string;
|
|
1419
|
+
export function takeLastWhile<T>(predicate: (x: T) => boolean, input: T[]): T[];
|
|
1420
|
+
export function takeLastWhile<T>(predicate: (x: T) => boolean): <T>(input: T[]) => T[];
|
|
1421
|
+
|
|
1422
|
+
export function takeWhile(fn: Predicate<string>, iterable: string): string;
|
|
1423
|
+
export function takeWhile(fn: Predicate<string>): (iterable: string) => string;
|
|
1424
|
+
export function takeWhile<T>(fn: Predicate<T>, iterable: T[]): T[];
|
|
1425
|
+
export function takeWhile<T>(fn: Predicate<T>): (iterable: T[]) => T[];
|
|
1426
|
+
|
|
1233
1427
|
/**
|
|
1234
1428
|
* It applies function `fn` to input `x` and returns `x`.
|
|
1235
1429
|
*
|
|
@@ -1255,9 +1449,6 @@ export function times<T>(fn: (i: number) => T): (howMany: number) => T[];
|
|
|
1255
1449
|
export function toLower<S extends string>(str: S): Lowercase<S>;
|
|
1256
1450
|
export function toLower(str: string): string;
|
|
1257
1451
|
|
|
1258
|
-
export function toUpper<S extends string>(str: S): Uppercase<S>;
|
|
1259
|
-
export function toUpper(str: string): string;
|
|
1260
|
-
|
|
1261
1452
|
/**
|
|
1262
1453
|
* It transforms an object to a list.
|
|
1263
1454
|
*/
|
|
@@ -1266,6 +1457,9 @@ export function toPairs<S>(obj: Record<string | number, S>): Array<[string, S]>;
|
|
|
1266
1457
|
|
|
1267
1458
|
export function toString(x: unknown): string;
|
|
1268
1459
|
|
|
1460
|
+
export function toUpper<S extends string>(str: S): Uppercase<S>;
|
|
1461
|
+
export function toUpper(str: string): string;
|
|
1462
|
+
|
|
1269
1463
|
export function transpose<T>(list: (T[])[]): (T[])[];
|
|
1270
1464
|
|
|
1271
1465
|
export function trim(str: string): string;
|
|
@@ -1295,6 +1489,13 @@ export function tryCatch<T>(
|
|
|
1295
1489
|
*/
|
|
1296
1490
|
export function type(x: any): RambdaTypes;
|
|
1297
1491
|
|
|
1492
|
+
/**
|
|
1493
|
+
* It calls a function `fn` with the list of values of the returned function.
|
|
1494
|
+
*
|
|
1495
|
+
* `R.unapply` is the opposite of `R.apply` method.
|
|
1496
|
+
*/
|
|
1497
|
+
export function unapply<T = any>(fn: (args: any[]) => T): (...args: any[]) => T;
|
|
1498
|
+
|
|
1298
1499
|
/**
|
|
1299
1500
|
* It takes two lists and return a new list containing a merger of both list with removed duplicates.
|
|
1300
1501
|
*
|
|
@@ -1310,6 +1511,9 @@ export function union<T>(x: T[]): (y: T[]) => T[];
|
|
|
1310
1511
|
*/
|
|
1311
1512
|
export function uniq<T>(list: T[]): T[];
|
|
1312
1513
|
|
|
1514
|
+
export function uniqBy<T, U>(fn: (a: T) => U, list: T[]): T[];
|
|
1515
|
+
export function uniqBy<T, U>(fn: (a: T) => U): (list: T[]) => T[];
|
|
1516
|
+
|
|
1313
1517
|
/**
|
|
1314
1518
|
* It returns a new array containing only one copy of each element in `list` according to `predicate` function.
|
|
1315
1519
|
*
|
|
@@ -1330,6 +1534,9 @@ export function unless<T, U>(predicate: (x: T) => boolean, whenFalseFn: (x: T) =
|
|
|
1330
1534
|
export function unless<T>(predicate: (x: T) => boolean, whenFalseFn: (x: T) => T, x: T): T;
|
|
1331
1535
|
export function unless<T>(predicate: (x: T) => boolean, whenFalseFn: (x: T) => T): (x: T) => T;
|
|
1332
1536
|
|
|
1537
|
+
export function unwind<T, U>(prop: keyof T, obj: T): U[];
|
|
1538
|
+
export function unwind<T, U>(prop: keyof T): (obj: T) => U[];
|
|
1539
|
+
|
|
1333
1540
|
/**
|
|
1334
1541
|
* It returns a copy of `list` with updated element at `index` with `newValue`.
|
|
1335
1542
|
*/
|
|
@@ -1341,6 +1548,12 @@ export function update<T>(index: number, newValue: T): (list: T[]) => T[];
|
|
|
1341
1548
|
*/
|
|
1342
1549
|
export function values<T extends object, K extends keyof T>(obj: T): T[K][];
|
|
1343
1550
|
|
|
1551
|
+
/**
|
|
1552
|
+
* It returns the value of `lens` focus over `target` object.
|
|
1553
|
+
*/
|
|
1554
|
+
export function view<T, U>(lens: Lens): (target: T) => U;
|
|
1555
|
+
export function view<T, U>(lens: Lens, target: T): U;
|
|
1556
|
+
|
|
1344
1557
|
export function when<T, U>(predicate: (x: T) => boolean, whenTrueFn: (a: T) => U, input: T): T | U;
|
|
1345
1558
|
export function when<T, U>(predicate: (x: T) => boolean, whenTrueFn: (a: T) => U): (input: T) => T | U;
|
|
1346
1559
|
export function when<T, U>(predicate: (x: T) => boolean): ((whenTrueFn: (a: T) => U) => (input: T) => T | U);
|
|
@@ -1353,6 +1566,14 @@ export function where<T>(conditions: T): <U>(input: U) => boolean;
|
|
|
1353
1566
|
export function where<ObjFunc2, U>(conditions: ObjFunc2, input: U): boolean;
|
|
1354
1567
|
export function where<ObjFunc2>(conditions: ObjFunc2): <U>(input: U) => boolean;
|
|
1355
1568
|
|
|
1569
|
+
/**
|
|
1570
|
+
* Same as `R.where`, but it will return `true` if at least one condition check returns `true`.
|
|
1571
|
+
*/
|
|
1572
|
+
export function whereAny<T, U>(conditions: T, input: U): boolean;
|
|
1573
|
+
export function whereAny<T>(conditions: T): <U>(input: U) => boolean;
|
|
1574
|
+
export function whereAny<ObjFunc2, U>(conditions: ObjFunc2, input: U): boolean;
|
|
1575
|
+
export function whereAny<ObjFunc2>(conditions: ObjFunc2): <U>(input: U) => boolean;
|
|
1576
|
+
|
|
1356
1577
|
/**
|
|
1357
1578
|
* It will return `true` if all of `input` object fully or partially include `rule` object.
|
|
1358
1579
|
*
|
|
@@ -1391,180 +1612,6 @@ export function zipObj<K extends string>(keys: K[]): <T>(values: T[]) => { [P in
|
|
|
1391
1612
|
export function zipObj<T, K extends number>(keys: K[], values: T[]): { [P in K]: T };
|
|
1392
1613
|
export function zipObj<K extends number>(keys: K[]): <T>(values: T[]) => { [P in K]: T };
|
|
1393
1614
|
|
|
1394
|
-
/**
|
|
1395
|
-
* It takes list with properties `propsToPick` and returns a list with property values in `obj`.
|
|
1396
|
-
*/
|
|
1397
|
-
export function props<P extends string, T>(propsToPick: P[], obj: Record<P, T>): T[];
|
|
1398
|
-
export function props<P extends string>(propsToPick: P[]): <T>(obj: Record<P, T>) => T[];
|
|
1399
|
-
export function props<P extends string, T>(propsToPick: P[]): (obj: Record<P, T>) => T[];
|
|
1400
|
-
|
|
1401
1615
|
export function zipWith<T, U, TResult>(fn: (x: T, y: U) => TResult, list1: T[], list2: U[]): TResult[];
|
|
1402
1616
|
export function zipWith<T, U, TResult>(fn: (x: T, y: U) => TResult, list1: T[]): (list2: U[]) => TResult[];
|
|
1403
1617
|
export function zipWith<T, U, TResult>(fn: (x: T, y: U) => TResult): (list1: T[], list2: U[]) => TResult[];
|
|
1404
|
-
|
|
1405
|
-
/**
|
|
1406
|
-
* It splits string or array at a given index.
|
|
1407
|
-
*/
|
|
1408
|
-
export function splitAt<T>(index: number, input: T[]): [T[], T[]];
|
|
1409
|
-
export function splitAt(index: number, input: string): [string, string];
|
|
1410
|
-
export function splitAt(index: number): {
|
|
1411
|
-
<T>(input: T[]): [T[], T[]];
|
|
1412
|
-
(input: string): [string, string];
|
|
1413
|
-
};
|
|
1414
|
-
|
|
1415
|
-
/**
|
|
1416
|
-
* It splits `list` to two arrays according to a `predicate` function.
|
|
1417
|
-
*
|
|
1418
|
-
* The first array contains all members of `list` before `predicate` returns `true`.
|
|
1419
|
-
*/
|
|
1420
|
-
export function splitWhen<T, U>(predicate: Predicate<T>, list: U[]): (U[])[];
|
|
1421
|
-
export function splitWhen<T>(predicate: Predicate<T>): <U>(list: U[]) => (U[])[];
|
|
1422
|
-
|
|
1423
|
-
export function takeLastWhile(predicate: (x: string) => boolean, input: string): string;
|
|
1424
|
-
export function takeLastWhile(predicate: (x: string) => boolean): (input: string) => string;
|
|
1425
|
-
export function takeLastWhile<T>(predicate: (x: T) => boolean, input: T[]): T[];
|
|
1426
|
-
export function takeLastWhile<T>(predicate: (x: T) => boolean): <T>(input: T[]) => T[];
|
|
1427
|
-
|
|
1428
|
-
/**
|
|
1429
|
-
* It takes object or array of functions as set of rules. These `rules` are applied to the `iterable` input to produce the result.
|
|
1430
|
-
*/
|
|
1431
|
-
export function evolve<T, U>(rules: ((x: T) => U)[], list: T[]): U[];
|
|
1432
|
-
export function evolve<T, U>(rules: ((x: T) => U)[]) : (list: T[]) => U[];
|
|
1433
|
-
export function evolve<E extends Evolver, V extends Evolvable<E>>(rules: E, obj: V): Evolve<V, E>;
|
|
1434
|
-
export function evolve<E extends Evolver>(rules: E): <V extends Evolvable<E>>(obj: V) => Evolve<V, E>;
|
|
1435
|
-
|
|
1436
|
-
export function dropLastWhile(predicate: (x: string) => boolean, iterable: string): string;
|
|
1437
|
-
export function dropLastWhile(predicate: (x: string) => boolean): (iterable: string) => string;
|
|
1438
|
-
export function dropLastWhile<T>(predicate: (x: T) => boolean, iterable: T[]): T[];
|
|
1439
|
-
export function dropLastWhile<T>(predicate: (x: T) => boolean): <T>(iterable: T[]) => T[];
|
|
1440
|
-
|
|
1441
|
-
/**
|
|
1442
|
-
* It removes any successive duplicates according to `R.equals`.
|
|
1443
|
-
*/
|
|
1444
|
-
export function dropRepeats<T>(list: T[]): T[];
|
|
1445
|
-
|
|
1446
|
-
export function dropRepeatsWith<T>(predicate: (x: T, y: T) => boolean, list: T[]): T[];
|
|
1447
|
-
export function dropRepeatsWith<T>(predicate: (x: T, y: T) => boolean): (list: T[]) => T[];
|
|
1448
|
-
|
|
1449
|
-
export function dropWhile(fn: Predicate<string>, iterable: string): string;
|
|
1450
|
-
export function dropWhile(fn: Predicate<string>): (iterable: string) => string;
|
|
1451
|
-
export function dropWhile<T>(fn: Predicate<T>, iterable: T[]): T[];
|
|
1452
|
-
export function dropWhile<T>(fn: Predicate<T>): (iterable: T[]) => T[];
|
|
1453
|
-
|
|
1454
|
-
export function takeWhile(fn: Predicate<string>, iterable: string): string;
|
|
1455
|
-
export function takeWhile(fn: Predicate<string>): (iterable: string) => string;
|
|
1456
|
-
export function takeWhile<T>(fn: Predicate<T>, iterable: T[]): T[];
|
|
1457
|
-
export function takeWhile<T>(fn: Predicate<T>): (iterable: T[]) => T[];
|
|
1458
|
-
|
|
1459
|
-
/**
|
|
1460
|
-
* It returns `true` if property `prop` in `obj1` is equal to property `prop` in `obj2` according to `R.equals`.
|
|
1461
|
-
*/
|
|
1462
|
-
export function eqProps<T, U>(prop: string, obj1: T, obj2: U): boolean;
|
|
1463
|
-
export function eqProps<P extends string>(prop: P): <T, U>(obj1: Record<P, T>, obj2: Record<P, U>) => boolean;
|
|
1464
|
-
export function eqProps<T>(prop: string, obj1: T): <U>(obj2: U) => boolean;
|
|
1465
|
-
|
|
1466
|
-
/**
|
|
1467
|
-
* It calls a function `fn` with the list of values of the returned function.
|
|
1468
|
-
*
|
|
1469
|
-
* `R.unapply` is the opposite of `R.apply` method.
|
|
1470
|
-
*/
|
|
1471
|
-
export function unapply<T = any>(fn: (args: any[]) => T): (...args: any[]) => T;
|
|
1472
|
-
|
|
1473
|
-
/**
|
|
1474
|
-
* It applies function `fn` to the list of arguments.
|
|
1475
|
-
*
|
|
1476
|
-
* This is useful for creating a fixed-arity function from a variadic function. `fn` should be a bound function if context is significant.
|
|
1477
|
-
*/
|
|
1478
|
-
export function apply<T = any>(fn: (...args: any[]) => T, args: any[]): T;
|
|
1479
|
-
export function apply<T = any>(fn: (...args: any[]) => T): (args: any[]) => T;
|
|
1480
|
-
|
|
1481
|
-
/**
|
|
1482
|
-
* Creates a function that is bound to a context.
|
|
1483
|
-
*/
|
|
1484
|
-
export function bind<F extends AnyFunction, T>(fn: F, thisObj: T): (...args: Parameters<F>) => ReturnType<F>;
|
|
1485
|
-
export function bind<F extends AnyFunction, T>(fn: F): (thisObj: T) => (...args: Parameters<F>) => ReturnType<F>;
|
|
1486
|
-
|
|
1487
|
-
/**
|
|
1488
|
-
* It takes two objects and a function, which will be used when there is an overlap between the keys.
|
|
1489
|
-
*/
|
|
1490
|
-
export function mergeWith(fn: (x: any, z: any) => any, a: Record<string, unknown>, b: Record<string, unknown>): Record<string, unknown>;
|
|
1491
|
-
export function mergeWith<Output>(fn: (x: any, z: any) => any, a: Record<string, unknown>, b: Record<string, unknown>): Output;
|
|
1492
|
-
export function mergeWith(fn: (x: any, z: any) => any, a: Record<string, unknown>): (b: Record<string, unknown>) => Record<string, unknown>;
|
|
1493
|
-
export function mergeWith<Output>(fn: (x: any, z: any) => any, a: Record<string, unknown>): (b: Record<string, unknown>) => Output;
|
|
1494
|
-
export function mergeWith(fn: (x: any, z: any) => any): <U, V>(a: U, b: V) => Record<string, unknown>;
|
|
1495
|
-
export function mergeWith<Output>(fn: (x: any, z: any) => any): <U, V>(a: U, b: V) => Output;
|
|
1496
|
-
|
|
1497
|
-
/**
|
|
1498
|
-
* It applies list of function to a list of inputs.
|
|
1499
|
-
*/
|
|
1500
|
-
export function juxt<A extends any[], R1>(fns: [(...a: A) => R1]): (...a: A) => [R1];
|
|
1501
|
-
export function juxt<A extends any[], R1, R2>(fns: [(...a: A) => R1, (...a: A) => R2]): (...a: A) => [R1, R2];
|
|
1502
|
-
export function juxt<A extends any[], R1, R2, R3>(fns: [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3]): (...a: A) => [R1, R2, R3];
|
|
1503
|
-
export function juxt<A extends any[], R1, R2, R3, R4>(fns: [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3, (...a: A) => R4]): (...a: A) => [R1, R2, R3, R4];
|
|
1504
|
-
export function juxt<A extends any[], R1, R2, R3, R4, R5>(fns: [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3, (...a: A) => R4, (...a: A) => R5]): (...a: A) => [R1, R2, R3, R4, R5];
|
|
1505
|
-
export function juxt<A extends any[], U>(fns: Array<(...args: A) => U>): (...args: A) => U[];
|
|
1506
|
-
|
|
1507
|
-
/**
|
|
1508
|
-
* It counts how many times `predicate` function returns `true`, when supplied with iteration of `list`.
|
|
1509
|
-
*/
|
|
1510
|
-
export function count<T>(predicate: (x: T) => boolean, list: T[]): number;
|
|
1511
|
-
export function count<T>(predicate: (x: T) => boolean): (list: T[]) => number;
|
|
1512
|
-
|
|
1513
|
-
/**
|
|
1514
|
-
* It counts elements in a list after each instance of the input list is passed through `transformFn` function.
|
|
1515
|
-
*/
|
|
1516
|
-
export function countBy<T extends unknown>(transformFn: (x: T) => any, list: T[]): Record<string, number>;
|
|
1517
|
-
export function countBy<T extends unknown>(transformFn: (x: T) => any): (list: T[]) => Record<string, number>;
|
|
1518
|
-
|
|
1519
|
-
export function unwind<T, U>(prop: keyof T, obj: T): U[];
|
|
1520
|
-
export function unwind<T, U>(prop: keyof T): (obj: T) => U[];
|
|
1521
|
-
|
|
1522
|
-
/**
|
|
1523
|
-
* It passes the two inputs through `unaryFn` and then the results are passed as inputs the the `binaryFn` to receive the final result(`binaryFn(unaryFn(FIRST_INPUT), unaryFn(SECOND_INPUT))`).
|
|
1524
|
-
*
|
|
1525
|
-
* This method is also known as P combinator.
|
|
1526
|
-
*/
|
|
1527
|
-
export function on<T, U, R>(binaryFn: (a: U, b: U) => R, unaryFn: (value: T) => U, a: T, b: T): R;
|
|
1528
|
-
export function on<T, U, R>(binaryFn: (a: U, b: U) => R, unaryFn: (value: T) => U, a: T): (b: T) => R;
|
|
1529
|
-
export function on<T, U, R>(binaryFn: (a: U, b: U) => R, unaryFn: (value: T) => U): {
|
|
1530
|
-
(a: T, b: T): R;
|
|
1531
|
-
(a: T): (b: T) => R;
|
|
1532
|
-
};
|
|
1533
|
-
|
|
1534
|
-
/**
|
|
1535
|
-
* Same as `R.where`, but it will return `true` if at least one condition check returns `true`.
|
|
1536
|
-
*/
|
|
1537
|
-
export function whereAny<T, U>(conditions: T, input: U): boolean;
|
|
1538
|
-
export function whereAny<T>(conditions: T): <U>(input: U) => boolean;
|
|
1539
|
-
export function whereAny<ObjFunc2, U>(conditions: ObjFunc2, input: U): boolean;
|
|
1540
|
-
export function whereAny<ObjFunc2>(conditions: ObjFunc2): <U>(input: U) => boolean;
|
|
1541
|
-
|
|
1542
|
-
/**
|
|
1543
|
-
* `R.partialObject` is a curry helper designed specifically for functions accepting object as a single argument.
|
|
1544
|
-
*
|
|
1545
|
-
* Initially the function knows only a part from the whole input object and then `R.partialObject` helps in preparing the function for the second part, when it receives the rest of the input.
|
|
1546
|
-
*/
|
|
1547
|
-
export function partialObject<Input, PartialInput, Output>(
|
|
1548
|
-
fn: (input: Input) => Output,
|
|
1549
|
-
partialInput: PartialInput,
|
|
1550
|
-
): (input: Pick<Input, Exclude<keyof Input, keyof PartialInput>>) => Output;
|
|
1551
|
-
|
|
1552
|
-
export function uniqBy<T, U>(fn: (a: T) => U, list: T[]): T[];
|
|
1553
|
-
export function uniqBy<T, U>(fn: (a: T) => U): (list: T[]) => T[];
|
|
1554
|
-
|
|
1555
|
-
/**
|
|
1556
|
-
* It changes a property of object on the base of provided path and transformer function.
|
|
1557
|
-
*/
|
|
1558
|
-
export function modifyPath<T extends Record<string, unknown>>(path: Path, fn: (x: any) => unknown, object: Record<string, unknown>): T;
|
|
1559
|
-
export function modifyPath<T extends Record<string, unknown>>(path: Path, fn: (x: any) => unknown): (object: Record<string, unknown>) => T;
|
|
1560
|
-
export function modifyPath<T extends Record<string, unknown>>(path: Path): (fn: (x: any) => unknown) => (object: Record<string, unknown>) => T;
|
|
1561
|
-
|
|
1562
|
-
export function modify<T extends object, K extends keyof T, P>(
|
|
1563
|
-
prop: K,
|
|
1564
|
-
fn: (a: T[K]) => P,
|
|
1565
|
-
obj: T,
|
|
1566
|
-
): Omit<T, K> & Record<K, P>;
|
|
1567
|
-
export function modify<K extends string, A, P>(
|
|
1568
|
-
prop: K,
|
|
1569
|
-
fn: (a: A) => P,
|
|
1570
|
-
): <T extends Record<K, A>>(target: T) => Omit<T, K> & Record<K, P>;
|