rambda 7.3.0 → 7.5.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 +20 -0
- package/README.md +387 -2308
- package/dist/rambda.js +50 -399
- package/dist/rambda.umd.js +1 -1
- package/immutable.d.ts +296 -240
- package/index.d.ts +296 -240
- package/package.json +21 -33
- package/rambda.js +188 -0
- package/src/dropLastWhile.js +9 -8
- package/src/dropWhile.js +12 -10
- package/src/equals.js +0 -12
- package/src/map.js +1 -0
- package/src/nop.js +1 -0
- package/src/takeLastWhile.js +6 -7
- package/src/takeWhile.js +9 -10
- package/src/test.js +1 -1
- package/src/uniqBy.js +4 -7
- package/src/unnest.js +9 -0
- package/dist/rambda.mjs +0 -2549
package/immutable.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 | readonly (number | string)[];
|
|
10
|
+
export type RamdaPath = readonly (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 = readonly (number | string)[];
|
|
14
14
|
type CondPair<T extends readonly any[], R> = readonly [(...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> = {readonly status: 'fulfilled', readonly value: T} | {readonly status: 'rejected', readonly 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: readonly 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: readonly ((...inputs: readonly T[]) => bo
|
|
|
195
196
|
export function append<T>(x: T, list: readonly T[]): readonly T[];
|
|
196
197
|
export function append<T>(x: T): <T>(list: readonly T[]) => readonly 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: readonly any[]) => T, args: readonly any[]): T;
|
|
205
|
+
export function apply<T = any>(fn: (...args: readonly any[]) => T): (args: readonly 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 readonly any[], R>(conditions: ReadonlyArray<Cond
|
|
|
347
362
|
*/
|
|
348
363
|
export function converge(after: ((...a: readonly any[]) => any), fns: readonly ((...x: readonly any[]) => any)[]): (...y: readonly 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: readonly T[]): number;
|
|
369
|
+
export function count<T>(predicate: (x: T) => boolean): (list: readonly 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: readonly T[]): Record<string, number>;
|
|
375
|
+
export function countBy<T extends unknown>(transformFn: (x: T) => any): (list: readonly 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: readonly T[]): readonly T[];
|
|
440
|
+
export function dropLastWhile<T>(predicate: (x: T) => boolean): <T>(iterable: readonly T[]) => readonly T[];
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* It removes any successive duplicates according to `R.equals`.
|
|
444
|
+
*/
|
|
445
|
+
export function dropRepeats<T>(list: readonly T[]): readonly T[];
|
|
446
|
+
|
|
447
|
+
export function dropRepeatsWith<T>(predicate: (x: T, y: T) => boolean, list: readonly T[]): readonly T[];
|
|
448
|
+
export function dropRepeatsWith<T>(predicate: (x: T, y: T) => boolean): (list: readonly T[]) => readonly 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: readonly T[]): readonly T[];
|
|
453
|
+
export function dropWhile<T>(fn: Predicate<T>): (iterable: readonly T[]) => readonly 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: readonly T[], list: readonly T[]): boolean;
|
|
427
472
|
export function endsWith<T>(target: readonly T[]): (list: readonly 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: readonly ((x: T) => U)[], list: readonly T[]): readonly U[];
|
|
491
|
+
export function evolve<T, U>(rules: readonly ((x: T) => U)[]) : (list: readonly T[]) => readonly 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: readonly T[]): string;
|
|
642
700
|
export function join<T>(glue: string): (list: readonly T[]) => string;
|
|
643
701
|
|
|
702
|
+
/**
|
|
703
|
+
* It applies list of function to a list of inputs.
|
|
704
|
+
*/
|
|
705
|
+
export function juxt<A extends readonly any[], R1>(fns: readonly [(...a: A) => R1]): (...a: A) => readonly [R1];
|
|
706
|
+
export function juxt<A extends readonly any[], R1, R2>(fns: readonly [(...a: A) => R1, (...a: A) => R2]): (...a: A) => readonly [R1, R2];
|
|
707
|
+
export function juxt<A extends readonly any[], R1, R2, R3>(fns: readonly [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3]): (...a: A) => readonly [R1, R2, R3];
|
|
708
|
+
export function juxt<A extends readonly any[], R1, R2, R3, R4>(fns: readonly [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3, (...a: A) => R4]): (...a: A) => readonly [R1, R2, R3, R4];
|
|
709
|
+
export function juxt<A extends readonly any[], R1, R2, R3, R4, R5>(fns: readonly [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3, (...a: A) => R4, (...a: A) => R5]): (...a: A) => readonly [R1, R2, R3, R4, R5];
|
|
710
|
+
export function juxt<A extends readonly any[], U>(fns: ReadonlyArray<(...args: A) => U>): (...args: A) => readonly 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: readonly T[]): readonly T[];
|
|
705
|
-
export function over(lens: Lens, fn: Arity1Fn): <T>(value: T) => T;
|
|
706
|
-
export function over(lens: Lens, fn: Arity1Fn): <T>(value: readonly T[]) => readonly T[];
|
|
707
|
-
export function over(lens: Lens): <T>(fn: Arity1Fn, value: T) => T;
|
|
708
|
-
export function over(lens: Lens): <T>(fn: Arity1Fn, value: readonly T[]) => readonly 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: readonly 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 overwritten `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: readonly T[]): boolean;
|
|
852
924
|
export function none<T>(predicate: (x: T) => boolean): (list: readonly 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): readonly 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: readonly T[]): readonly T[];
|
|
992
|
+
export function over(lens: Lens, fn: Arity1Fn): <T>(value: T) => T;
|
|
993
|
+
export function over(lens: Lens, fn: Arity1Fn): <T>(value: readonly T[]) => readonly T[];
|
|
994
|
+
export function over(lens: Lens): <T>(fn: Arity1Fn, value: T) => T;
|
|
995
|
+
export function over(lens: Lens): <T>(fn: Arity1Fn, value: readonly T[]) => readonly 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: readonly [V0]): (x1: V1, x2: V2, x3: V3) => T;
|
|
904
1009
|
export function partial<T>(fn: (...a: readonly any[]) => T, args: readonly any[]): (...x: readonly 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,42 @@ 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: readonly [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: readonly [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: readonly [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: readonly [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: readonly [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: readonly [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;
|
|
1079
|
+
export function path<T>(pathToSearch: RamdaPath, obj: any): T | undefined;
|
|
933
1080
|
|
|
934
1081
|
/**
|
|
935
1082
|
* It returns `true` if `pathToSearch` of `input` object is equal to `target` value.
|
|
@@ -940,6 +1087,13 @@ export function pathEq(pathToSearch: Path, target: any, input: any): boolean;
|
|
|
940
1087
|
export function pathEq(pathToSearch: Path, target: any): (input: any) => boolean;
|
|
941
1088
|
export function pathEq(pathToSearch: Path): (target: any) => (input: any) => boolean;
|
|
942
1089
|
|
|
1090
|
+
/**
|
|
1091
|
+
* It reads `obj` input and returns either `R.path(pathToSearch, Record<string, unknown>)` result or `defaultValue` input.
|
|
1092
|
+
*/
|
|
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
|
+
export function pathOr<T>(defaultValue: T): (pathToSearch: Path) => (obj: any) => T;
|
|
1096
|
+
|
|
943
1097
|
/**
|
|
944
1098
|
* It loops over members of `pathsToSearch` as `singlePath` and returns the array produced by `R.path(singlePath, Record<string, unknown>)`.
|
|
945
1099
|
*
|
|
@@ -950,19 +1104,12 @@ export function paths<Input, T>(pathsToSearch: readonly Path[]): (obj: Input) =>
|
|
|
950
1104
|
export function paths<T>(pathsToSearch: readonly Path[], obj: any): readonly (T | undefined)[];
|
|
951
1105
|
export function paths<T>(pathsToSearch: readonly Path[]): (obj: any) => readonly (T | undefined)[];
|
|
952
1106
|
|
|
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
1107
|
/**
|
|
961
1108
|
* It returns a partial copy of an `input` containing only `propsToPick` properties.
|
|
962
1109
|
*
|
|
963
1110
|
* `input` can be either an object or an array.
|
|
964
1111
|
*
|
|
965
|
-
* String
|
|
1112
|
+
* String annotation of `propsToPick` is one of the differences between `Rambda` and `Ramda`.
|
|
966
1113
|
*/
|
|
967
1114
|
export function pick<T, K extends string | number | symbol>(propsToPick: readonly K[], input: T): Pick<T, Exclude<keyof T, Exclude<keyof T, K>>>;
|
|
968
1115
|
export function pick<K extends string | number | symbol>(propsToPick: readonly K[]): <T>(input: T) => Pick<T, Exclude<keyof T, Exclude<keyof T, K>>>;
|
|
@@ -974,8 +1121,9 @@ export function pick<T>(propsToPick: string): (input: object) => T;
|
|
|
974
1121
|
/**
|
|
975
1122
|
* Same as `R.pick` but it won't skip the missing props, i.e. it will assign them to `undefined`.
|
|
976
1123
|
*/
|
|
977
|
-
export function pickAll<T,
|
|
978
|
-
export function pickAll<T, U>(
|
|
1124
|
+
export function pickAll<T, K extends keyof T>(propsToPicks: readonly K[], input: T): Pick<T, K>;
|
|
1125
|
+
export function pickAll<T, U>(propsToPicks: readonly string[], input: T): U;
|
|
1126
|
+
export function pickAll(propsToPicks: readonly string[]): <T, U>(input: T) => U;
|
|
979
1127
|
export function pickAll<T, U>(propsToPick: string, input: T): U;
|
|
980
1128
|
export function pickAll<T, U>(propsToPick: string): (input: T) => U;
|
|
981
1129
|
|
|
@@ -1059,10 +1207,17 @@ export function product(list: readonly number[]): number;
|
|
|
1059
1207
|
*
|
|
1060
1208
|
* If there is no such property, it returns `undefined`.
|
|
1061
1209
|
*/
|
|
1062
|
-
export function prop<P extends keyof
|
|
1063
|
-
export function prop<P extends keyof
|
|
1064
|
-
|
|
1065
|
-
|
|
1210
|
+
export function prop<P extends keyof never, T>(propToFind: P, value: T): Prop<T, P>;
|
|
1211
|
+
export function prop<P extends keyof never>(propToFind: P): {
|
|
1212
|
+
<T>(value: Record<P, T>): T;
|
|
1213
|
+
<T>(value: T): Prop<T, P>;
|
|
1214
|
+
};
|
|
1215
|
+
export function prop<P extends keyof T, T>(propToFind: P): {
|
|
1216
|
+
(value: T): Prop<T, P>;
|
|
1217
|
+
};
|
|
1218
|
+
export function prop<P extends keyof never, T>(propToFind: P): {
|
|
1219
|
+
(value: Record<P, T>): T;
|
|
1220
|
+
};
|
|
1066
1221
|
|
|
1067
1222
|
/**
|
|
1068
1223
|
* It returns true if `obj` has property `propToFind` and its value is equal to `valueToMatch`.
|
|
@@ -1102,6 +1257,13 @@ export function propOr<T>(defaultValue: T): {
|
|
|
1102
1257
|
export function propSatisfies<T>(predicate: Predicate<T>, property: string, obj: Record<string, T>): boolean;
|
|
1103
1258
|
export function propSatisfies<T>(predicate: Predicate<T>, property: string): (obj: Record<string, T>) => boolean;
|
|
1104
1259
|
|
|
1260
|
+
/**
|
|
1261
|
+
* It takes list with properties `propsToPick` and returns a list with property values in `obj`.
|
|
1262
|
+
*/
|
|
1263
|
+
export function props<P extends string, T>(propsToPick: readonly P[], obj: Record<P, T>): readonly T[];
|
|
1264
|
+
export function props<P extends string>(propsToPick: readonly P[]): <T>(obj: Record<P, T>) => readonly T[];
|
|
1265
|
+
export function props<P extends string, T>(propsToPick: readonly P[]): (obj: Record<P, T>) => readonly T[];
|
|
1266
|
+
|
|
1105
1267
|
/**
|
|
1106
1268
|
* It returns list of numbers between `startInclusive` to `endExclusive` markers.
|
|
1107
1269
|
*/
|
|
@@ -1137,6 +1299,13 @@ export function replace(strOrRegex: RegExp | string): (replacer: string) => (str
|
|
|
1137
1299
|
export function reverse<T>(input: readonly T[]): readonly T[];
|
|
1138
1300
|
export function reverse(input: string): string;
|
|
1139
1301
|
|
|
1302
|
+
/**
|
|
1303
|
+
* It returns a copied **Object** or **Array** with modified `lens` focus set to `replacer` value.
|
|
1304
|
+
*/
|
|
1305
|
+
export function set<T, U>(lens: Lens, replacer: U, obj: T): T;
|
|
1306
|
+
export function set<U>(lens: Lens, replacer: U): <T>(obj: T) => T;
|
|
1307
|
+
export function set(lens: Lens): <T, U>(replacer: U, obj: T) => T;
|
|
1308
|
+
|
|
1140
1309
|
export function slice(from: number, to: number, input: string): string;
|
|
1141
1310
|
export function slice<T>(from: number, to: number, input: readonly T[]): readonly T[];
|
|
1142
1311
|
export function slice(from: number, to: number): {
|
|
@@ -1167,6 +1336,16 @@ export function sortBy(sortFn: (a: any) => Ord): <T>(list: readonly T[]) => read
|
|
|
1167
1336
|
export function split(separator: string | RegExp): (str: string) => readonly string[];
|
|
1168
1337
|
export function split(separator: string | RegExp, str: string): readonly string[];
|
|
1169
1338
|
|
|
1339
|
+
/**
|
|
1340
|
+
* It splits string or array at a given index.
|
|
1341
|
+
*/
|
|
1342
|
+
export function splitAt<T>(index: number, input: readonly T[]): readonly [readonly T[], readonly T[]];
|
|
1343
|
+
export function splitAt(index: number, input: string): readonly [string, string];
|
|
1344
|
+
export function splitAt(index: number): {
|
|
1345
|
+
<T>(input: readonly T[]): readonly [readonly T[], readonly T[]];
|
|
1346
|
+
(input: string): readonly [string, string];
|
|
1347
|
+
};
|
|
1348
|
+
|
|
1170
1349
|
/**
|
|
1171
1350
|
* It splits `input` into slices of `sliceLength`.
|
|
1172
1351
|
*/
|
|
@@ -1177,6 +1356,14 @@ export function splitEvery(sliceLength: number): {
|
|
|
1177
1356
|
<T>(input: readonly T[]): readonly ((readonly T[]))[];
|
|
1178
1357
|
};
|
|
1179
1358
|
|
|
1359
|
+
/**
|
|
1360
|
+
* It splits `list` to two arrays according to a `predicate` function.
|
|
1361
|
+
*
|
|
1362
|
+
* The first array contains all members of `list` before `predicate` returns `true`.
|
|
1363
|
+
*/
|
|
1364
|
+
export function splitWhen<T, U>(predicate: Predicate<T>, list: readonly U[]): readonly ((readonly U[]))[];
|
|
1365
|
+
export function splitWhen<T>(predicate: Predicate<T>): <U>(list: readonly U[]) => readonly ((readonly U[]))[];
|
|
1366
|
+
|
|
1180
1367
|
/**
|
|
1181
1368
|
* When iterable is a string, then it behaves as `String.prototype.startsWith`.
|
|
1182
1369
|
* 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 +1389,6 @@ export function sum(list: readonly number[]): number;
|
|
|
1202
1389
|
export function symmetricDifference<T>(x: readonly T[], y: readonly T[]): readonly T[];
|
|
1203
1390
|
export function symmetricDifference<T>(x: readonly T[]): <T>(y: readonly T[]) => readonly T[];
|
|
1204
1391
|
|
|
1205
|
-
export function T(): boolean;
|
|
1206
|
-
|
|
1207
1392
|
/**
|
|
1208
1393
|
* It returns all but the first element of `input`.
|
|
1209
1394
|
*/
|
|
@@ -1230,10 +1415,20 @@ export function takeLast<T>(howMany: number): {
|
|
|
1230
1415
|
(input: string): string;
|
|
1231
1416
|
};
|
|
1232
1417
|
|
|
1418
|
+
export function takeLastWhile(predicate: (x: string) => boolean, input: string): string;
|
|
1419
|
+
export function takeLastWhile(predicate: (x: string) => boolean): (input: string) => string;
|
|
1420
|
+
export function takeLastWhile<T>(predicate: (x: T) => boolean, input: readonly T[]): readonly T[];
|
|
1421
|
+
export function takeLastWhile<T>(predicate: (x: T) => boolean): <T>(input: readonly T[]) => readonly T[];
|
|
1422
|
+
|
|
1423
|
+
export function takeWhile(fn: Predicate<string>, iterable: string): string;
|
|
1424
|
+
export function takeWhile(fn: Predicate<string>): (iterable: string) => string;
|
|
1425
|
+
export function takeWhile<T>(fn: Predicate<T>, iterable: readonly T[]): readonly T[];
|
|
1426
|
+
export function takeWhile<T>(fn: Predicate<T>): (iterable: readonly T[]) => readonly T[];
|
|
1427
|
+
|
|
1233
1428
|
/**
|
|
1234
1429
|
* It applies function `fn` to input `x` and returns `x`.
|
|
1235
1430
|
*
|
|
1236
|
-
* One use case is
|
|
1431
|
+
* One use case is debugging in the middle of `R.compose`.
|
|
1237
1432
|
*/
|
|
1238
1433
|
export function tap<T>(fn: (x: T) => void, input: T): T;
|
|
1239
1434
|
export function tap<T>(fn: (x: T) => void): (input: T) => T;
|
|
@@ -1255,9 +1450,6 @@ export function times<T>(fn: (i: number) => T): (howMany: number) => readonly T[
|
|
|
1255
1450
|
export function toLower<S extends string>(str: S): Lowercase<S>;
|
|
1256
1451
|
export function toLower(str: string): string;
|
|
1257
1452
|
|
|
1258
|
-
export function toUpper<S extends string>(str: S): Uppercase<S>;
|
|
1259
|
-
export function toUpper(str: string): string;
|
|
1260
|
-
|
|
1261
1453
|
/**
|
|
1262
1454
|
* It transforms an object to a list.
|
|
1263
1455
|
*/
|
|
@@ -1266,6 +1458,9 @@ export function toPairs<S>(obj: Record<string | number, S>): ReadonlyArray<reado
|
|
|
1266
1458
|
|
|
1267
1459
|
export function toString(x: unknown): string;
|
|
1268
1460
|
|
|
1461
|
+
export function toUpper<S extends string>(str: S): Uppercase<S>;
|
|
1462
|
+
export function toUpper(str: string): string;
|
|
1463
|
+
|
|
1269
1464
|
export function transpose<T>(list: readonly ((readonly T[]))[]): readonly ((readonly T[]))[];
|
|
1270
1465
|
|
|
1271
1466
|
export function trim(str: string): string;
|
|
@@ -1295,6 +1490,13 @@ export function tryCatch<T>(
|
|
|
1295
1490
|
*/
|
|
1296
1491
|
export function type(x: any): RambdaTypes;
|
|
1297
1492
|
|
|
1493
|
+
/**
|
|
1494
|
+
* It calls a function `fn` with the list of values of the returned function.
|
|
1495
|
+
*
|
|
1496
|
+
* `R.unapply` is the opposite of `R.apply` method.
|
|
1497
|
+
*/
|
|
1498
|
+
export function unapply<T = any>(fn: (args: readonly any[]) => T): (...args: readonly any[]) => T;
|
|
1499
|
+
|
|
1298
1500
|
/**
|
|
1299
1501
|
* It takes two lists and return a new list containing a merger of both list with removed duplicates.
|
|
1300
1502
|
*
|
|
@@ -1310,6 +1512,14 @@ export function union<T>(x: readonly T[]): (y: readonly T[]) => readonly T[];
|
|
|
1310
1512
|
*/
|
|
1311
1513
|
export function uniq<T>(list: readonly T[]): readonly T[];
|
|
1312
1514
|
|
|
1515
|
+
/**
|
|
1516
|
+
* It applies uniqueness to input list based on function that defines what to be used for comparison between elements.
|
|
1517
|
+
*
|
|
1518
|
+
* `R.equals` is used to determine equality.
|
|
1519
|
+
*/
|
|
1520
|
+
export function uniqBy<T, U>(fn: (a: T) => U, list: readonly T[]): readonly T[];
|
|
1521
|
+
export function uniqBy<T, U>(fn: (a: T) => U): (list: readonly T[]) => readonly T[];
|
|
1522
|
+
|
|
1313
1523
|
/**
|
|
1314
1524
|
* It returns a new array containing only one copy of each element in `list` according to `predicate` function.
|
|
1315
1525
|
*
|
|
@@ -1330,6 +1540,12 @@ export function unless<T, U>(predicate: (x: T) => boolean, whenFalseFn: (x: T) =
|
|
|
1330
1540
|
export function unless<T>(predicate: (x: T) => boolean, whenFalseFn: (x: T) => T, x: T): T;
|
|
1331
1541
|
export function unless<T>(predicate: (x: T) => boolean, whenFalseFn: (x: T) => T): (x: T) => T;
|
|
1332
1542
|
|
|
1543
|
+
export function unnest(list: readonly unknown[]): readonly unknown[];
|
|
1544
|
+
export function unnest<T>(list: readonly unknown[]): T;
|
|
1545
|
+
|
|
1546
|
+
export function unwind<T, U>(prop: keyof T, obj: T): readonly U[];
|
|
1547
|
+
export function unwind<T, U>(prop: keyof T): (obj: T) => readonly U[];
|
|
1548
|
+
|
|
1333
1549
|
/**
|
|
1334
1550
|
* It returns a copy of `list` with updated element at `index` with `newValue`.
|
|
1335
1551
|
*/
|
|
@@ -1341,6 +1557,12 @@ export function update<T>(index: number, newValue: T): (list: readonly T[]) => r
|
|
|
1341
1557
|
*/
|
|
1342
1558
|
export function values<T extends object, K extends keyof T>(obj: T): readonly T[K][];
|
|
1343
1559
|
|
|
1560
|
+
/**
|
|
1561
|
+
* It returns the value of `lens` focus over `target` object.
|
|
1562
|
+
*/
|
|
1563
|
+
export function view<T, U>(lens: Lens): (target: T) => U;
|
|
1564
|
+
export function view<T, U>(lens: Lens, target: T): U;
|
|
1565
|
+
|
|
1344
1566
|
export function when<T, U>(predicate: (x: T) => boolean, whenTrueFn: (a: T) => U, input: T): T | U;
|
|
1345
1567
|
export function when<T, U>(predicate: (x: T) => boolean, whenTrueFn: (a: T) => U): (input: T) => T | U;
|
|
1346
1568
|
export function when<T, U>(predicate: (x: T) => boolean): ((whenTrueFn: (a: T) => U) => (input: T) => T | U);
|
|
@@ -1353,6 +1575,14 @@ export function where<T>(conditions: T): <U>(input: U) => boolean;
|
|
|
1353
1575
|
export function where<ObjFunc2, U>(conditions: ObjFunc2, input: U): boolean;
|
|
1354
1576
|
export function where<ObjFunc2>(conditions: ObjFunc2): <U>(input: U) => boolean;
|
|
1355
1577
|
|
|
1578
|
+
/**
|
|
1579
|
+
* Same as `R.where`, but it will return `true` if at least one condition check returns `true`.
|
|
1580
|
+
*/
|
|
1581
|
+
export function whereAny<T, U>(conditions: T, input: U): boolean;
|
|
1582
|
+
export function whereAny<T>(conditions: T): <U>(input: U) => boolean;
|
|
1583
|
+
export function whereAny<ObjFunc2, U>(conditions: ObjFunc2, input: U): boolean;
|
|
1584
|
+
export function whereAny<ObjFunc2>(conditions: ObjFunc2): <U>(input: U) => boolean;
|
|
1585
|
+
|
|
1356
1586
|
/**
|
|
1357
1587
|
* It will return `true` if all of `input` object fully or partially include `rule` object.
|
|
1358
1588
|
*
|
|
@@ -1391,180 +1621,6 @@ export function zipObj<K extends string>(keys: readonly K[]): <T>(values: readon
|
|
|
1391
1621
|
export function zipObj<T, K extends number>(keys: readonly K[], values: readonly T[]): { readonly [P in K]: T };
|
|
1392
1622
|
export function zipObj<K extends number>(keys: readonly K[]): <T>(values: readonly T[]) => { readonly [P in K]: T };
|
|
1393
1623
|
|
|
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: readonly P[], obj: Record<P, T>): readonly T[];
|
|
1398
|
-
export function props<P extends string>(propsToPick: readonly P[]): <T>(obj: Record<P, T>) => readonly T[];
|
|
1399
|
-
export function props<P extends string, T>(propsToPick: readonly P[]): (obj: Record<P, T>) => readonly T[];
|
|
1400
|
-
|
|
1401
1624
|
export function zipWith<T, U, TResult>(fn: (x: T, y: U) => TResult, list1: readonly T[], list2: readonly U[]): readonly TResult[];
|
|
1402
1625
|
export function zipWith<T, U, TResult>(fn: (x: T, y: U) => TResult, list1: readonly T[]): (list2: readonly U[]) => readonly TResult[];
|
|
1403
1626
|
export function zipWith<T, U, TResult>(fn: (x: T, y: U) => TResult): (list1: readonly T[], list2: readonly U[]) => readonly TResult[];
|
|
1404
|
-
|
|
1405
|
-
/**
|
|
1406
|
-
* It splits string or array at a given index.
|
|
1407
|
-
*/
|
|
1408
|
-
export function splitAt<T>(index: number, input: readonly T[]): readonly [readonly T[], readonly T[]];
|
|
1409
|
-
export function splitAt(index: number, input: string): readonly [string, string];
|
|
1410
|
-
export function splitAt(index: number): {
|
|
1411
|
-
<T>(input: readonly T[]): readonly [readonly T[], readonly T[]];
|
|
1412
|
-
(input: string): readonly [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: readonly U[]): readonly ((readonly U[]))[];
|
|
1421
|
-
export function splitWhen<T>(predicate: Predicate<T>): <U>(list: readonly U[]) => readonly ((readonly 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: readonly T[]): readonly T[];
|
|
1426
|
-
export function takeLastWhile<T>(predicate: (x: T) => boolean): <T>(input: readonly T[]) => readonly 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: readonly ((x: T) => U)[], list: readonly T[]): readonly U[];
|
|
1432
|
-
export function evolve<T, U>(rules: readonly ((x: T) => U)[]) : (list: readonly T[]) => readonly 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: readonly T[]): readonly T[];
|
|
1439
|
-
export function dropLastWhile<T>(predicate: (x: T) => boolean): <T>(iterable: readonly T[]) => readonly T[];
|
|
1440
|
-
|
|
1441
|
-
/**
|
|
1442
|
-
* It removes any successive duplicates according to `R.equals`.
|
|
1443
|
-
*/
|
|
1444
|
-
export function dropRepeats<T>(list: readonly T[]): readonly T[];
|
|
1445
|
-
|
|
1446
|
-
export function dropRepeatsWith<T>(predicate: (x: T, y: T) => boolean, list: readonly T[]): readonly T[];
|
|
1447
|
-
export function dropRepeatsWith<T>(predicate: (x: T, y: T) => boolean): (list: readonly T[]) => readonly 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: readonly T[]): readonly T[];
|
|
1452
|
-
export function dropWhile<T>(fn: Predicate<T>): (iterable: readonly T[]) => readonly 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: readonly T[]): readonly T[];
|
|
1457
|
-
export function takeWhile<T>(fn: Predicate<T>): (iterable: readonly T[]) => readonly 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: readonly any[]) => T): (...args: readonly 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: readonly any[]) => T, args: readonly any[]): T;
|
|
1479
|
-
export function apply<T = any>(fn: (...args: readonly any[]) => T): (args: readonly 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 readonly any[], R1>(fns: readonly [(...a: A) => R1]): (...a: A) => readonly [R1];
|
|
1501
|
-
export function juxt<A extends readonly any[], R1, R2>(fns: readonly [(...a: A) => R1, (...a: A) => R2]): (...a: A) => readonly [R1, R2];
|
|
1502
|
-
export function juxt<A extends readonly any[], R1, R2, R3>(fns: readonly [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3]): (...a: A) => readonly [R1, R2, R3];
|
|
1503
|
-
export function juxt<A extends readonly any[], R1, R2, R3, R4>(fns: readonly [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3, (...a: A) => R4]): (...a: A) => readonly [R1, R2, R3, R4];
|
|
1504
|
-
export function juxt<A extends readonly any[], R1, R2, R3, R4, R5>(fns: readonly [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3, (...a: A) => R4, (...a: A) => R5]): (...a: A) => readonly [R1, R2, R3, R4, R5];
|
|
1505
|
-
export function juxt<A extends readonly any[], U>(fns: ReadonlyArray<(...args: A) => U>): (...args: A) => readonly 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: readonly T[]): number;
|
|
1511
|
-
export function count<T>(predicate: (x: T) => boolean): (list: readonly 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: readonly T[]): Record<string, number>;
|
|
1517
|
-
export function countBy<T extends unknown>(transformFn: (x: T) => any): (list: readonly T[]) => Record<string, number>;
|
|
1518
|
-
|
|
1519
|
-
export function unwind<T, U>(prop: keyof T, obj: T): readonly U[];
|
|
1520
|
-
export function unwind<T, U>(prop: keyof T): (obj: T) => readonly 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: readonly T[]): readonly T[];
|
|
1553
|
-
export function uniqBy<T, U>(fn: (a: T) => U): (list: readonly T[]) => readonly 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>;
|