rambda 7.2.1 → 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 +22 -0
- package/README.md +1431 -3264
- package/dist/rambda.js +83 -422
- package/dist/rambda.mjs +89 -433
- package/dist/rambda.umd.js +1 -1
- package/immutable.d.ts +290 -229
- package/index.d.ts +290 -229
- package/package.json +38 -33
- package/rambda.js +187 -0
- package/src/_internals/constants.js +1 -0
- package/src/_internals/isArray.js +1 -0
- package/src/_internals/isFalsy.js +2 -2
- package/src/_internals/isInteger.js +5 -0
- package/src/_internals/isIterable.js +5 -0
- package/src/_internals/isObject.js +1 -1
- package/src/_internals/isTruthy.js +2 -2
- package/src/_internals/keys.js +1 -0
- package/src/_internals/{_objectIs.js → objectIs.js} +2 -2
- package/src/applySpec.js +3 -3
- package/src/assocPath.js +7 -7
- package/src/clone.js +2 -2
- package/src/count.js +2 -2
- package/src/dropLastWhile.js +2 -2
- package/src/dropRepeats.js +2 -2
- package/src/dropRepeatsWith.js +2 -2
- package/src/dropWhile.js +2 -2
- package/src/endsWith.js +2 -2
- package/src/equals.js +3 -15
- package/src/evolve.js +1 -1
- package/src/filter.js +2 -2
- package/src/flatten.js +2 -2
- package/src/forEach.js +6 -6
- package/src/groupWith.js +2 -2
- package/src/identical.js +2 -2
- package/src/includes.js +2 -2
- package/src/isPromise.js +1 -1
- package/src/length.js +2 -2
- package/src/map.js +8 -7
- package/src/mathMod.js +2 -2
- package/src/merge.js +1 -1
- package/src/mergeDeepRight.js +2 -1
- package/src/mergeRight.js +2 -1
- package/src/modify.js +23 -0
- package/src/modifyPath.js +2 -2
- package/src/nop.js +1 -0
- package/src/partialObject.js +1 -11
- package/src/partition.js +2 -2
- package/src/props.js +2 -2
- package/src/reduce.js +2 -3
- package/src/splitAt.js +2 -2
- package/src/startsWith.js +2 -2
- package/src/takeLastWhile.js +2 -2
- package/src/takeWhile.js +2 -2
- package/src/test.js +1 -1
- package/src/times.js +2 -1
- package/src/transpose.js +2 -2
- package/src/unwind.js +4 -3
- package/src/update.js +1 -1
- package/src/where.js +1 -0
- package/src/_internals/_isArray.js +0 -1
- package/src/_internals/_isInteger.js +0 -5
- package/src/_internals/_keys.js +0 -1
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
|
+
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>
|
|
@@ -133,6 +136,12 @@ type ApplyDiffAdd = {readonly op:'add', readonly path: string, readonly value: a
|
|
|
133
136
|
type ApplyDiffRemove = {readonly op:'remove', readonly path: string};
|
|
134
137
|
type ApplyDiffRule = ApplyDiffUpdate | ApplyDiffAdd | ApplyDiffRemove;
|
|
135
138
|
|
|
139
|
+
type Resolved<T> = {readonly status: 'fulfilled', readonly value: T} | {readonly status: 'rejected', readonly reason: string|Error}
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
export function F(): boolean;
|
|
143
|
+
|
|
144
|
+
export function T(): boolean;
|
|
136
145
|
|
|
137
146
|
/**
|
|
138
147
|
* It adds `a` and `b`.
|
|
@@ -156,6 +165,7 @@ export function all<T>(predicate: (x: T) => boolean): (list: readonly T[]) => bo
|
|
|
156
165
|
* It returns `true`, if all functions of `predicates` return `true`, when `input` is their argument.
|
|
157
166
|
*/
|
|
158
167
|
export function allPass<T>(predicates: readonly ((x: T) => boolean)[]): (input: T) => boolean;
|
|
168
|
+
export function allPass<T>(predicates: readonly ((...inputs: readonly T[]) => boolean)[]): (...inputs: readonly T[]) => boolean;
|
|
159
169
|
|
|
160
170
|
/**
|
|
161
171
|
* It returns function that always returns `x`.
|
|
@@ -168,12 +178,6 @@ export function always<T>(x: T): (...args: readonly unknown[]) => T;
|
|
|
168
178
|
export function and<T, U>(x: T, y: U): T | U;
|
|
169
179
|
export function and<T>(x: T): <U>(y: U) => T | U;
|
|
170
180
|
|
|
171
|
-
/**
|
|
172
|
-
* Logical OR
|
|
173
|
-
*/
|
|
174
|
-
export function or<T, U>(a: T, b: U): T | U;
|
|
175
|
-
export function or<T>(a: T): <U>(b: U) => T | U;
|
|
176
|
-
|
|
177
181
|
/**
|
|
178
182
|
* It returns `true`, if at least one member of `list` returns true, when passed to a `predicate` function.
|
|
179
183
|
*/
|
|
@@ -184,6 +188,7 @@ export function any<T>(predicate: (x: T) => boolean): (list: readonly T[]) => bo
|
|
|
184
188
|
* It accepts list of `predicates` and returns a function. This function with its `input` will return `true`, if any of `predicates` returns `true` for this `input`.
|
|
185
189
|
*/
|
|
186
190
|
export function anyPass<T>(predicates: readonly ((x: T) => boolean)[]): (input: T) => boolean;
|
|
191
|
+
export function anyPass<T>(predicates: readonly ((...inputs: readonly T[]) => boolean)[]): (...inputs: readonly T[]) => boolean;
|
|
187
192
|
|
|
188
193
|
/**
|
|
189
194
|
* It adds element `x` at the end of `list`.
|
|
@@ -191,6 +196,14 @@ export function anyPass<T>(predicates: readonly ((x: T) => boolean)[]): (input:
|
|
|
191
196
|
export function append<T>(x: T, list: readonly T[]): readonly T[];
|
|
192
197
|
export function append<T>(x: T): <T>(list: readonly T[]) => readonly T[];
|
|
193
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
|
+
|
|
194
207
|
export function applySpec<Spec extends Record<string, AnyFunction>>(
|
|
195
208
|
spec: Spec
|
|
196
209
|
): (
|
|
@@ -212,6 +225,12 @@ export function assocPath<Output>(path: Path, newValue: any, obj: object): Outpu
|
|
|
212
225
|
export function assocPath<Output>(path: Path, newValue: any): (obj: object) => Output;
|
|
213
226
|
export function assocPath<Output>(path: Path): (newValue: any) => (obj: object) => Output;
|
|
214
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
|
+
|
|
215
234
|
/**
|
|
216
235
|
* It returns a function with `input` argument.
|
|
217
236
|
*
|
|
@@ -343,6 +362,18 @@ export function cond<T extends readonly any[], R>(conditions: ReadonlyArray<Cond
|
|
|
343
362
|
*/
|
|
344
363
|
export function converge(after: ((...a: readonly any[]) => any), fns: readonly ((...x: readonly any[]) => any)[]): (...y: readonly any[]) => any;
|
|
345
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
|
+
|
|
346
377
|
/**
|
|
347
378
|
* It expects a function as input and returns its curried version.
|
|
348
379
|
*/
|
|
@@ -403,6 +434,24 @@ export function dropLast<T>(howMany: number): {
|
|
|
403
434
|
(input: string): string;
|
|
404
435
|
};
|
|
405
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
|
+
|
|
406
455
|
/**
|
|
407
456
|
* It returns a new `predicate` function from `firstPredicate` and `secondPredicate` inputs.
|
|
408
457
|
*
|
|
@@ -422,13 +471,26 @@ export function endsWith(target: string): (iterable: string) => boolean;
|
|
|
422
471
|
export function endsWith<T>(target: readonly T[], list: readonly T[]): boolean;
|
|
423
472
|
export function endsWith<T>(target: readonly T[]): (list: readonly T[]) => boolean;
|
|
424
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
|
+
|
|
425
481
|
/**
|
|
426
482
|
* It deeply compares `x` and `y` and returns `true` if they are equal.
|
|
427
483
|
*/
|
|
428
484
|
export function equals<T>(x: T, y: T): boolean;
|
|
429
485
|
export function equals<T>(x: T): (y: T) => boolean;
|
|
430
486
|
|
|
431
|
-
|
|
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>;
|
|
432
494
|
|
|
433
495
|
/**
|
|
434
496
|
* It filters list or object `input` using a `predicate` function.
|
|
@@ -602,7 +664,7 @@ export function init<T extends readonly unknown[]>(input: T): T extends readonly
|
|
|
602
664
|
export function init(input: string): string;
|
|
603
665
|
|
|
604
666
|
/**
|
|
605
|
-
* It loops
|
|
667
|
+
* It loops through `listA` and `listB` and returns the intersection of the two according to `R.equals`.
|
|
606
668
|
*/
|
|
607
669
|
export function intersection<T>(listA: readonly T[], listB: readonly T[]): readonly T[];
|
|
608
670
|
export function intersection<T>(listA: readonly T[]): (listB: readonly T[]) => readonly T[];
|
|
@@ -637,6 +699,16 @@ export function isNil(x: any): x is null | undefined;
|
|
|
637
699
|
export function join<T>(glue: string, list: readonly T[]): string;
|
|
638
700
|
export function join<T>(glue: string): (list: readonly T[]) => string;
|
|
639
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
|
+
|
|
640
712
|
/**
|
|
641
713
|
* It applies `Object.keys` over `x` and returns its keys.
|
|
642
714
|
*/
|
|
@@ -693,29 +765,6 @@ export function lensProp(prop: string): {
|
|
|
693
765
|
set<T, U, V>(val: T, obj: U): V;
|
|
694
766
|
};
|
|
695
767
|
|
|
696
|
-
/**
|
|
697
|
-
* It returns a copied **Object** or **Array** with modified value received by applying function `fn` to `lens` focus.
|
|
698
|
-
*/
|
|
699
|
-
export function over<T>(lens: Lens, fn: Arity1Fn, value: T): T;
|
|
700
|
-
export function over<T>(lens: Lens, fn: Arity1Fn, value: readonly T[]): readonly T[];
|
|
701
|
-
export function over(lens: Lens, fn: Arity1Fn): <T>(value: T) => T;
|
|
702
|
-
export function over(lens: Lens, fn: Arity1Fn): <T>(value: readonly T[]) => readonly T[];
|
|
703
|
-
export function over(lens: Lens): <T>(fn: Arity1Fn, value: T) => T;
|
|
704
|
-
export function over(lens: Lens): <T>(fn: Arity1Fn, value: readonly T[]) => readonly T[];
|
|
705
|
-
|
|
706
|
-
/**
|
|
707
|
-
* It returns a copied **Object** or **Array** with modified `lens` focus set to `replacer` value.
|
|
708
|
-
*/
|
|
709
|
-
export function set<T, U>(lens: Lens, replacer: U, obj: T): T;
|
|
710
|
-
export function set<U>(lens: Lens, replacer: U): <T>(obj: T) => T;
|
|
711
|
-
export function set(lens: Lens): <T, U>(replacer: U, obj: T) => T;
|
|
712
|
-
|
|
713
|
-
/**
|
|
714
|
-
* It returns the value of `lens` focus over `target` object.
|
|
715
|
-
*/
|
|
716
|
-
export function view<T, U>(lens: Lens): (target: T) => U;
|
|
717
|
-
export function view<T, U>(lens: Lens, target: T): U;
|
|
718
|
-
|
|
719
768
|
/**
|
|
720
769
|
* It returns the result of looping through `iterable` with `fn`.
|
|
721
770
|
*
|
|
@@ -777,12 +826,6 @@ export function median(list: readonly number[]): number;
|
|
|
777
826
|
export function merge<A, B>(target: A, newProps: B): A & B
|
|
778
827
|
export function merge<Output>(target: any): (newProps: any) => Output;
|
|
779
828
|
|
|
780
|
-
/**
|
|
781
|
-
* It creates a copy of `target` object with overidden `newProps` properties. Previously known as `R.merge` but renamed after Ramda did the same.
|
|
782
|
-
*/
|
|
783
|
-
export function mergeRight<A, B>(target: A, newProps: B): A & B
|
|
784
|
-
export function mergeRight<Output>(target: any): (newProps: any) => Output;
|
|
785
|
-
|
|
786
829
|
/**
|
|
787
830
|
* It merges all objects of `list` array sequentially and returns the result.
|
|
788
831
|
*/
|
|
@@ -804,6 +847,22 @@ export function mergeDeepRight<Output>(target: object): (newProps: object) => Ou
|
|
|
804
847
|
export function mergeLeft<Output>(newProps: object, target: object): Output;
|
|
805
848
|
export function mergeLeft<Output>(newProps: object): (target: object) => Output;
|
|
806
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
|
+
|
|
807
866
|
/**
|
|
808
867
|
* It returns the lesser value between `x` and `y`.
|
|
809
868
|
*/
|
|
@@ -817,6 +876,23 @@ export function minBy<T>(compareFn: (input: T) => Ord, x: T, y: T): T;
|
|
|
817
876
|
export function minBy<T>(compareFn: (input: T) => Ord, x: T): (y: T) => T;
|
|
818
877
|
export function minBy<T>(compareFn: (input: T) => Ord): (x: T) => (y: T) => T;
|
|
819
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
|
+
|
|
820
896
|
/**
|
|
821
897
|
* Curried version of `x%y`.
|
|
822
898
|
*/
|
|
@@ -847,6 +923,11 @@ export function negate(x: number): number;
|
|
|
847
923
|
export function none<T>(predicate: (x: T) => boolean, list: readonly T[]): boolean;
|
|
848
924
|
export function none<T>(predicate: (x: T) => boolean): (list: readonly T[]) => boolean;
|
|
849
925
|
|
|
926
|
+
/**
|
|
927
|
+
* It returns `undefined`.
|
|
928
|
+
*/
|
|
929
|
+
export function nop(): void;
|
|
930
|
+
|
|
850
931
|
/**
|
|
851
932
|
* It returns a boolean negated version of `input`.
|
|
852
933
|
*/
|
|
@@ -868,10 +949,7 @@ export function nth(n: number): {
|
|
|
868
949
|
export function objOf<T, K extends string>(key: K, value: T): Record<K, T>;
|
|
869
950
|
export function objOf<K extends string>(key: K): <T>(value: T) => Record<K, T>;
|
|
870
951
|
|
|
871
|
-
|
|
872
|
-
* It returns a function, which invokes only once `fn` function.
|
|
873
|
-
*/
|
|
874
|
-
export function once<T extends AnyFunction>(func: T): T;
|
|
952
|
+
export function of<T>(x: T): readonly T[];
|
|
875
953
|
|
|
876
954
|
/**
|
|
877
955
|
* It returns a partial copy of an `obj` without `propsToOmit` properties.
|
|
@@ -883,7 +961,38 @@ export function omit<T, U>(propsToOmit: string): (obj: T) => U;
|
|
|
883
961
|
export function omit<T>(propsToOmit: string, obj: object): T;
|
|
884
962
|
export function omit<T>(propsToOmit: string): (obj: object) => T;
|
|
885
963
|
|
|
886
|
-
|
|
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[];
|
|
887
996
|
|
|
888
997
|
/**
|
|
889
998
|
* It is very similar to `R.curry`, but you can pass initial arguments when you create the curried function.
|
|
@@ -899,6 +1008,16 @@ export function partial<V0, V1, V2, V3, T>(fn: (x0: V0, x1: V1, x2: V2, x3: V3)
|
|
|
899
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;
|
|
900
1009
|
export function partial<T>(fn: (...a: readonly any[]) => T, args: readonly any[]): (...x: readonly any[]) => T;
|
|
901
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
|
+
|
|
902
1021
|
/**
|
|
903
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.
|
|
904
1023
|
*/
|
|
@@ -922,10 +1041,41 @@ export function partition<T>(
|
|
|
922
1041
|
*
|
|
923
1042
|
* It will return `undefined`, if such path is not found.
|
|
924
1043
|
*/
|
|
925
|
-
export function path<
|
|
926
|
-
export function path<
|
|
927
|
-
export function path<
|
|
928
|
-
|
|
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;
|
|
929
1079
|
|
|
930
1080
|
/**
|
|
931
1081
|
* It returns `true` if `pathToSearch` of `input` object is equal to `target` value.
|
|
@@ -936,6 +1086,13 @@ export function pathEq(pathToSearch: Path, target: any, input: any): boolean;
|
|
|
936
1086
|
export function pathEq(pathToSearch: Path, target: any): (input: any) => boolean;
|
|
937
1087
|
export function pathEq(pathToSearch: Path): (target: any) => (input: any) => boolean;
|
|
938
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
|
+
|
|
939
1096
|
/**
|
|
940
1097
|
* It loops over members of `pathsToSearch` as `singlePath` and returns the array produced by `R.path(singlePath, Record<string, unknown>)`.
|
|
941
1098
|
*
|
|
@@ -946,13 +1103,6 @@ export function paths<Input, T>(pathsToSearch: readonly Path[]): (obj: Input) =>
|
|
|
946
1103
|
export function paths<T>(pathsToSearch: readonly Path[], obj: any): readonly (T | undefined)[];
|
|
947
1104
|
export function paths<T>(pathsToSearch: readonly Path[]): (obj: any) => readonly (T | undefined)[];
|
|
948
1105
|
|
|
949
|
-
/**
|
|
950
|
-
* It reads `obj` input and returns either `R.path(pathToSearch, Record<string, unknown>)` result or `defaultValue` input.
|
|
951
|
-
*/
|
|
952
|
-
export function pathOr<T>(defaultValue: T, pathToSearch: Path, obj: any): T;
|
|
953
|
-
export function pathOr<T>(defaultValue: T, pathToSearch: Path): (obj: any) => T;
|
|
954
|
-
export function pathOr<T>(defaultValue: T): (pathToSearch: Path) => (obj: any) => T;
|
|
955
|
-
|
|
956
1106
|
/**
|
|
957
1107
|
* It returns a partial copy of an `input` containing only `propsToPick` properties.
|
|
958
1108
|
*
|
|
@@ -970,8 +1120,9 @@ export function pick<T>(propsToPick: string): (input: object) => T;
|
|
|
970
1120
|
/**
|
|
971
1121
|
* Same as `R.pick` but it won't skip the missing props, i.e. it will assign them to `undefined`.
|
|
972
1122
|
*/
|
|
973
|
-
export function pickAll<T,
|
|
974
|
-
export function pickAll<T, U>(
|
|
1123
|
+
export function pickAll<T, K extends keyof T>(propsToPicks: readonly K[], input: T): Pick<T, K>;
|
|
1124
|
+
export function pickAll<T, U>(propsToPicks: readonly string[], input: T): U;
|
|
1125
|
+
export function pickAll(propsToPicks: readonly string[]): <T, U>(input: T) => U;
|
|
975
1126
|
export function pickAll<T, U>(propsToPick: string, input: T): U;
|
|
976
1127
|
export function pickAll<T, U>(propsToPick: string): (input: T) => U;
|
|
977
1128
|
|
|
@@ -1055,10 +1206,17 @@ export function product(list: readonly number[]): number;
|
|
|
1055
1206
|
*
|
|
1056
1207
|
* If there is no such property, it returns `undefined`.
|
|
1057
1208
|
*/
|
|
1058
|
-
export function prop<P extends keyof
|
|
1059
|
-
export function prop<P extends keyof
|
|
1060
|
-
|
|
1061
|
-
|
|
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
|
+
};
|
|
1062
1220
|
|
|
1063
1221
|
/**
|
|
1064
1222
|
* It returns true if `obj` has property `propToFind` and its value is equal to `valueToMatch`.
|
|
@@ -1098,6 +1256,13 @@ export function propOr<T>(defaultValue: T): {
|
|
|
1098
1256
|
export function propSatisfies<T>(predicate: Predicate<T>, property: string, obj: Record<string, T>): boolean;
|
|
1099
1257
|
export function propSatisfies<T>(predicate: Predicate<T>, property: string): (obj: Record<string, T>) => boolean;
|
|
1100
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: readonly P[], obj: Record<P, T>): readonly T[];
|
|
1263
|
+
export function props<P extends string>(propsToPick: readonly P[]): <T>(obj: Record<P, T>) => readonly T[];
|
|
1264
|
+
export function props<P extends string, T>(propsToPick: readonly P[]): (obj: Record<P, T>) => readonly T[];
|
|
1265
|
+
|
|
1101
1266
|
/**
|
|
1102
1267
|
* It returns list of numbers between `startInclusive` to `endExclusive` markers.
|
|
1103
1268
|
*/
|
|
@@ -1133,6 +1298,13 @@ export function replace(strOrRegex: RegExp | string): (replacer: string) => (str
|
|
|
1133
1298
|
export function reverse<T>(input: readonly T[]): readonly T[];
|
|
1134
1299
|
export function reverse(input: string): string;
|
|
1135
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
|
+
|
|
1136
1308
|
export function slice(from: number, to: number, input: string): string;
|
|
1137
1309
|
export function slice<T>(from: number, to: number, input: readonly T[]): readonly T[];
|
|
1138
1310
|
export function slice(from: number, to: number): {
|
|
@@ -1163,6 +1335,16 @@ export function sortBy(sortFn: (a: any) => Ord): <T>(list: readonly T[]) => read
|
|
|
1163
1335
|
export function split(separator: string | RegExp): (str: string) => readonly string[];
|
|
1164
1336
|
export function split(separator: string | RegExp, str: string): readonly string[];
|
|
1165
1337
|
|
|
1338
|
+
/**
|
|
1339
|
+
* It splits string or array at a given index.
|
|
1340
|
+
*/
|
|
1341
|
+
export function splitAt<T>(index: number, input: readonly T[]): readonly [readonly T[], readonly T[]];
|
|
1342
|
+
export function splitAt(index: number, input: string): readonly [string, string];
|
|
1343
|
+
export function splitAt(index: number): {
|
|
1344
|
+
<T>(input: readonly T[]): readonly [readonly T[], readonly T[]];
|
|
1345
|
+
(input: string): readonly [string, string];
|
|
1346
|
+
};
|
|
1347
|
+
|
|
1166
1348
|
/**
|
|
1167
1349
|
* It splits `input` into slices of `sliceLength`.
|
|
1168
1350
|
*/
|
|
@@ -1173,6 +1355,14 @@ export function splitEvery(sliceLength: number): {
|
|
|
1173
1355
|
<T>(input: readonly T[]): readonly ((readonly T[]))[];
|
|
1174
1356
|
};
|
|
1175
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: readonly U[]): readonly ((readonly U[]))[];
|
|
1364
|
+
export function splitWhen<T>(predicate: Predicate<T>): <U>(list: readonly U[]) => readonly ((readonly U[]))[];
|
|
1365
|
+
|
|
1176
1366
|
/**
|
|
1177
1367
|
* When iterable is a string, then it behaves as `String.prototype.startsWith`.
|
|
1178
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.
|
|
@@ -1198,8 +1388,6 @@ export function sum(list: readonly number[]): number;
|
|
|
1198
1388
|
export function symmetricDifference<T>(x: readonly T[], y: readonly T[]): readonly T[];
|
|
1199
1389
|
export function symmetricDifference<T>(x: readonly T[]): <T>(y: readonly T[]) => readonly T[];
|
|
1200
1390
|
|
|
1201
|
-
export function T(): boolean;
|
|
1202
|
-
|
|
1203
1391
|
/**
|
|
1204
1392
|
* It returns all but the first element of `input`.
|
|
1205
1393
|
*/
|
|
@@ -1226,6 +1414,16 @@ export function takeLast<T>(howMany: number): {
|
|
|
1226
1414
|
(input: string): string;
|
|
1227
1415
|
};
|
|
1228
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: readonly T[]): readonly T[];
|
|
1420
|
+
export function takeLastWhile<T>(predicate: (x: T) => boolean): <T>(input: readonly T[]) => readonly 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: readonly T[]): readonly T[];
|
|
1425
|
+
export function takeWhile<T>(fn: Predicate<T>): (iterable: readonly T[]) => readonly T[];
|
|
1426
|
+
|
|
1229
1427
|
/**
|
|
1230
1428
|
* It applies function `fn` to input `x` and returns `x`.
|
|
1231
1429
|
*
|
|
@@ -1251,9 +1449,6 @@ export function times<T>(fn: (i: number) => T): (howMany: number) => readonly T[
|
|
|
1251
1449
|
export function toLower<S extends string>(str: S): Lowercase<S>;
|
|
1252
1450
|
export function toLower(str: string): string;
|
|
1253
1451
|
|
|
1254
|
-
export function toUpper<S extends string>(str: S): Uppercase<S>;
|
|
1255
|
-
export function toUpper(str: string): string;
|
|
1256
|
-
|
|
1257
1452
|
/**
|
|
1258
1453
|
* It transforms an object to a list.
|
|
1259
1454
|
*/
|
|
@@ -1262,6 +1457,9 @@ export function toPairs<S>(obj: Record<string | number, S>): ReadonlyArray<reado
|
|
|
1262
1457
|
|
|
1263
1458
|
export function toString(x: unknown): string;
|
|
1264
1459
|
|
|
1460
|
+
export function toUpper<S extends string>(str: S): Uppercase<S>;
|
|
1461
|
+
export function toUpper(str: string): string;
|
|
1462
|
+
|
|
1265
1463
|
export function transpose<T>(list: readonly ((readonly T[]))[]): readonly ((readonly T[]))[];
|
|
1266
1464
|
|
|
1267
1465
|
export function trim(str: string): string;
|
|
@@ -1291,6 +1489,13 @@ export function tryCatch<T>(
|
|
|
1291
1489
|
*/
|
|
1292
1490
|
export function type(x: any): RambdaTypes;
|
|
1293
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: readonly any[]) => T): (...args: readonly any[]) => T;
|
|
1498
|
+
|
|
1294
1499
|
/**
|
|
1295
1500
|
* It takes two lists and return a new list containing a merger of both list with removed duplicates.
|
|
1296
1501
|
*
|
|
@@ -1306,6 +1511,9 @@ export function union<T>(x: readonly T[]): (y: readonly T[]) => readonly T[];
|
|
|
1306
1511
|
*/
|
|
1307
1512
|
export function uniq<T>(list: readonly T[]): readonly T[];
|
|
1308
1513
|
|
|
1514
|
+
export function uniqBy<T, U>(fn: (a: T) => U, list: readonly T[]): readonly T[];
|
|
1515
|
+
export function uniqBy<T, U>(fn: (a: T) => U): (list: readonly T[]) => readonly T[];
|
|
1516
|
+
|
|
1309
1517
|
/**
|
|
1310
1518
|
* It returns a new array containing only one copy of each element in `list` according to `predicate` function.
|
|
1311
1519
|
*
|
|
@@ -1326,6 +1534,9 @@ export function unless<T, U>(predicate: (x: T) => boolean, whenFalseFn: (x: T) =
|
|
|
1326
1534
|
export function unless<T>(predicate: (x: T) => boolean, whenFalseFn: (x: T) => T, x: T): T;
|
|
1327
1535
|
export function unless<T>(predicate: (x: T) => boolean, whenFalseFn: (x: T) => T): (x: T) => T;
|
|
1328
1536
|
|
|
1537
|
+
export function unwind<T, U>(prop: keyof T, obj: T): readonly U[];
|
|
1538
|
+
export function unwind<T, U>(prop: keyof T): (obj: T) => readonly U[];
|
|
1539
|
+
|
|
1329
1540
|
/**
|
|
1330
1541
|
* It returns a copy of `list` with updated element at `index` with `newValue`.
|
|
1331
1542
|
*/
|
|
@@ -1337,6 +1548,12 @@ export function update<T>(index: number, newValue: T): (list: readonly T[]) => r
|
|
|
1337
1548
|
*/
|
|
1338
1549
|
export function values<T extends object, K extends keyof T>(obj: T): readonly T[K][];
|
|
1339
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
|
+
|
|
1340
1557
|
export function when<T, U>(predicate: (x: T) => boolean, whenTrueFn: (a: T) => U, input: T): T | U;
|
|
1341
1558
|
export function when<T, U>(predicate: (x: T) => boolean, whenTrueFn: (a: T) => U): (input: T) => T | U;
|
|
1342
1559
|
export function when<T, U>(predicate: (x: T) => boolean): ((whenTrueFn: (a: T) => U) => (input: T) => T | U);
|
|
@@ -1349,6 +1566,14 @@ export function where<T>(conditions: T): <U>(input: U) => boolean;
|
|
|
1349
1566
|
export function where<ObjFunc2, U>(conditions: ObjFunc2, input: U): boolean;
|
|
1350
1567
|
export function where<ObjFunc2>(conditions: ObjFunc2): <U>(input: U) => boolean;
|
|
1351
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
|
+
|
|
1352
1577
|
/**
|
|
1353
1578
|
* It will return `true` if all of `input` object fully or partially include `rule` object.
|
|
1354
1579
|
*
|
|
@@ -1387,170 +1612,6 @@ export function zipObj<K extends string>(keys: readonly K[]): <T>(values: readon
|
|
|
1387
1612
|
export function zipObj<T, K extends number>(keys: readonly K[], values: readonly T[]): { readonly [P in K]: T };
|
|
1388
1613
|
export function zipObj<K extends number>(keys: readonly K[]): <T>(values: readonly T[]) => { readonly [P in K]: T };
|
|
1389
1614
|
|
|
1390
|
-
/**
|
|
1391
|
-
* It takes list with properties `propsToPick` and returns a list with property values in `obj`.
|
|
1392
|
-
*/
|
|
1393
|
-
export function props<P extends string, T>(propsToPick: readonly P[], obj: Record<P, T>): readonly T[];
|
|
1394
|
-
export function props<P extends string>(propsToPick: readonly P[]): <T>(obj: Record<P, T>) => readonly T[];
|
|
1395
|
-
export function props<P extends string, T>(propsToPick: readonly P[]): (obj: Record<P, T>) => readonly T[];
|
|
1396
|
-
|
|
1397
1615
|
export function zipWith<T, U, TResult>(fn: (x: T, y: U) => TResult, list1: readonly T[], list2: readonly U[]): readonly TResult[];
|
|
1398
1616
|
export function zipWith<T, U, TResult>(fn: (x: T, y: U) => TResult, list1: readonly T[]): (list2: readonly U[]) => readonly TResult[];
|
|
1399
1617
|
export function zipWith<T, U, TResult>(fn: (x: T, y: U) => TResult): (list1: readonly T[], list2: readonly U[]) => readonly TResult[];
|
|
1400
|
-
|
|
1401
|
-
/**
|
|
1402
|
-
* It splits string or array at a given index.
|
|
1403
|
-
*/
|
|
1404
|
-
export function splitAt<T>(index: number, input: readonly T[]): readonly [readonly T[], readonly T[]];
|
|
1405
|
-
export function splitAt(index: number, input: string): readonly [string, string];
|
|
1406
|
-
export function splitAt(index: number): {
|
|
1407
|
-
<T>(input: readonly T[]): readonly [readonly T[], readonly T[]];
|
|
1408
|
-
(input: string): readonly [string, string];
|
|
1409
|
-
};
|
|
1410
|
-
|
|
1411
|
-
/**
|
|
1412
|
-
* It splits `list` to two arrays according to a `predicate` function.
|
|
1413
|
-
*
|
|
1414
|
-
* The first array contains all members of `list` before `predicate` returns `true`.
|
|
1415
|
-
*/
|
|
1416
|
-
export function splitWhen<T, U>(predicate: Predicate<T>, list: readonly U[]): readonly ((readonly U[]))[];
|
|
1417
|
-
export function splitWhen<T>(predicate: Predicate<T>): <U>(list: readonly U[]) => readonly ((readonly U[]))[];
|
|
1418
|
-
|
|
1419
|
-
export function takeLastWhile(predicate: (x: string) => boolean, input: string): string;
|
|
1420
|
-
export function takeLastWhile(predicate: (x: string) => boolean): (input: string) => string;
|
|
1421
|
-
export function takeLastWhile<T>(predicate: (x: T) => boolean, input: readonly T[]): readonly T[];
|
|
1422
|
-
export function takeLastWhile<T>(predicate: (x: T) => boolean): <T>(input: readonly T[]) => readonly T[];
|
|
1423
|
-
|
|
1424
|
-
/**
|
|
1425
|
-
* It takes object or array of functions as set of rules. These `rules` are applied to the `iterable` input to produce the result.
|
|
1426
|
-
*/
|
|
1427
|
-
export function evolve<T, U>(rules: readonly ((x: T) => U)[], list: readonly T[]): readonly U[];
|
|
1428
|
-
export function evolve<T, U>(rules: readonly ((x: T) => U)[]) : (list: readonly T[]) => readonly U[];
|
|
1429
|
-
export function evolve<E extends Evolver, V extends Evolvable<E>>(rules: E, obj: V): Evolve<V, E>;
|
|
1430
|
-
export function evolve<E extends Evolver>(rules: E): <V extends Evolvable<E>>(obj: V) => Evolve<V, E>;
|
|
1431
|
-
|
|
1432
|
-
export function dropLastWhile(predicate: (x: string) => boolean, iterable: string): string;
|
|
1433
|
-
export function dropLastWhile(predicate: (x: string) => boolean): (iterable: string) => string;
|
|
1434
|
-
export function dropLastWhile<T>(predicate: (x: T) => boolean, iterable: readonly T[]): readonly T[];
|
|
1435
|
-
export function dropLastWhile<T>(predicate: (x: T) => boolean): <T>(iterable: readonly T[]) => readonly T[];
|
|
1436
|
-
|
|
1437
|
-
/**
|
|
1438
|
-
* It removes any successive duplicates according to `R.equals`.
|
|
1439
|
-
*/
|
|
1440
|
-
export function dropRepeats<T>(list: readonly T[]): readonly T[];
|
|
1441
|
-
|
|
1442
|
-
export function dropRepeatsWith<T>(predicate: (x: T, y: T) => boolean, list: readonly T[]): readonly T[];
|
|
1443
|
-
export function dropRepeatsWith<T>(predicate: (x: T, y: T) => boolean): (list: readonly T[]) => readonly T[];
|
|
1444
|
-
|
|
1445
|
-
export function dropWhile(fn: Predicate<string>, iterable: string): string;
|
|
1446
|
-
export function dropWhile(fn: Predicate<string>): (iterable: string) => string;
|
|
1447
|
-
export function dropWhile<T>(fn: Predicate<T>, iterable: readonly T[]): readonly T[];
|
|
1448
|
-
export function dropWhile<T>(fn: Predicate<T>): (iterable: readonly T[]) => readonly T[];
|
|
1449
|
-
|
|
1450
|
-
export function takeWhile(fn: Predicate<string>, iterable: string): string;
|
|
1451
|
-
export function takeWhile(fn: Predicate<string>): (iterable: string) => string;
|
|
1452
|
-
export function takeWhile<T>(fn: Predicate<T>, iterable: readonly T[]): readonly T[];
|
|
1453
|
-
export function takeWhile<T>(fn: Predicate<T>): (iterable: readonly T[]) => readonly T[];
|
|
1454
|
-
|
|
1455
|
-
/**
|
|
1456
|
-
* It returns `true` if property `prop` in `obj1` is equal to property `prop` in `obj2` according to `R.equals`.
|
|
1457
|
-
*/
|
|
1458
|
-
export function eqProps<T, U>(prop: string, obj1: T, obj2: U): boolean;
|
|
1459
|
-
export function eqProps<P extends string>(prop: P): <T, U>(obj1: Record<P, T>, obj2: Record<P, U>) => boolean;
|
|
1460
|
-
export function eqProps<T>(prop: string, obj1: T): <U>(obj2: U) => boolean;
|
|
1461
|
-
|
|
1462
|
-
/**
|
|
1463
|
-
* It calls a function `fn` with the list of values of the returned function.
|
|
1464
|
-
*
|
|
1465
|
-
* `R.unapply` is the opposite of `R.apply` method.
|
|
1466
|
-
*/
|
|
1467
|
-
export function unapply<T = any>(fn: (args: readonly any[]) => T): (...args: readonly any[]) => T;
|
|
1468
|
-
|
|
1469
|
-
/**
|
|
1470
|
-
* It applies function `fn` to the list of arguments.
|
|
1471
|
-
*
|
|
1472
|
-
* This is useful for creating a fixed-arity function from a variadic function. `fn` should be a bound function if context is significant.
|
|
1473
|
-
*/
|
|
1474
|
-
export function apply<T = any>(fn: (...args: readonly any[]) => T, args: readonly any[]): T;
|
|
1475
|
-
export function apply<T = any>(fn: (...args: readonly any[]) => T): (args: readonly any[]) => T;
|
|
1476
|
-
|
|
1477
|
-
/**
|
|
1478
|
-
* Creates a function that is bound to a context.
|
|
1479
|
-
*/
|
|
1480
|
-
export function bind<F extends AnyFunction, T>(fn: F, thisObj: T): (...args: Parameters<F>) => ReturnType<F>;
|
|
1481
|
-
export function bind<F extends AnyFunction, T>(fn: F): (thisObj: T) => (...args: Parameters<F>) => ReturnType<F>;
|
|
1482
|
-
|
|
1483
|
-
/**
|
|
1484
|
-
* It takes two objects and a function, which will be used when there is an overlap between the keys.
|
|
1485
|
-
*/
|
|
1486
|
-
export function mergeWith(fn: (x: any, z: any) => any, a: Record<string, unknown>, b: Record<string, unknown>): Record<string, unknown>;
|
|
1487
|
-
export function mergeWith<Output>(fn: (x: any, z: any) => any, a: Record<string, unknown>, b: Record<string, unknown>): Output;
|
|
1488
|
-
export function mergeWith(fn: (x: any, z: any) => any, a: Record<string, unknown>): (b: Record<string, unknown>) => Record<string, unknown>;
|
|
1489
|
-
export function mergeWith<Output>(fn: (x: any, z: any) => any, a: Record<string, unknown>): (b: Record<string, unknown>) => Output;
|
|
1490
|
-
export function mergeWith(fn: (x: any, z: any) => any): <U, V>(a: U, b: V) => Record<string, unknown>;
|
|
1491
|
-
export function mergeWith<Output>(fn: (x: any, z: any) => any): <U, V>(a: U, b: V) => Output;
|
|
1492
|
-
|
|
1493
|
-
/**
|
|
1494
|
-
* It applies list of function to a list of inputs.
|
|
1495
|
-
*/
|
|
1496
|
-
export function juxt<A extends readonly any[], R1>(fns: readonly [(...a: A) => R1]): (...a: A) => readonly [R1];
|
|
1497
|
-
export function juxt<A extends readonly any[], R1, R2>(fns: readonly [(...a: A) => R1, (...a: A) => R2]): (...a: A) => readonly [R1, R2];
|
|
1498
|
-
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];
|
|
1499
|
-
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];
|
|
1500
|
-
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];
|
|
1501
|
-
export function juxt<A extends readonly any[], U>(fns: ReadonlyArray<(...args: A) => U>): (...args: A) => readonly U[];
|
|
1502
|
-
|
|
1503
|
-
/**
|
|
1504
|
-
* It counts how many times `predicate` function returns `true`, when supplied with iteration of `list`.
|
|
1505
|
-
*/
|
|
1506
|
-
export function count<T>(predicate: (x: T) => boolean, list: readonly T[]): number;
|
|
1507
|
-
export function count<T>(predicate: (x: T) => boolean): (list: readonly T[]) => number;
|
|
1508
|
-
|
|
1509
|
-
/**
|
|
1510
|
-
* It counts elements in a list after each instance of the input list is passed through `transformFn` function.
|
|
1511
|
-
*/
|
|
1512
|
-
export function countBy<T extends unknown>(transformFn: (x: T) => any, list: readonly T[]): Record<string, number>;
|
|
1513
|
-
export function countBy<T extends unknown>(transformFn: (x: T) => any): (list: readonly T[]) => Record<string, number>;
|
|
1514
|
-
|
|
1515
|
-
export function unwind<T, U>(prop: keyof T, obj: T): readonly U[];
|
|
1516
|
-
export function unwind<T, U>(prop: keyof T): (obj: T) => readonly U[];
|
|
1517
|
-
|
|
1518
|
-
/**
|
|
1519
|
-
* 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))`).
|
|
1520
|
-
*
|
|
1521
|
-
* This method is also known as P combinator.
|
|
1522
|
-
*/
|
|
1523
|
-
export function on<T, U, R>(binaryFn: (a: U, b: U) => R, unaryFn: (value: T) => U, a: T, b: T): R;
|
|
1524
|
-
export function on<T, U, R>(binaryFn: (a: U, b: U) => R, unaryFn: (value: T) => U, a: T): (b: T) => R;
|
|
1525
|
-
export function on<T, U, R>(binaryFn: (a: U, b: U) => R, unaryFn: (value: T) => U): {
|
|
1526
|
-
(a: T, b: T): R;
|
|
1527
|
-
(a: T): (b: T) => R;
|
|
1528
|
-
};
|
|
1529
|
-
|
|
1530
|
-
/**
|
|
1531
|
-
* Same as `R.where`, but it will return `true` if at least one condition check returns `true`.
|
|
1532
|
-
*/
|
|
1533
|
-
export function whereAny<T, U>(conditions: T, input: U): boolean;
|
|
1534
|
-
export function whereAny<T>(conditions: T): <U>(input: U) => boolean;
|
|
1535
|
-
export function whereAny<ObjFunc2, U>(conditions: ObjFunc2, input: U): boolean;
|
|
1536
|
-
export function whereAny<ObjFunc2>(conditions: ObjFunc2): <U>(input: U) => boolean;
|
|
1537
|
-
|
|
1538
|
-
/**
|
|
1539
|
-
* `R.partialObject` is a curry helper designed specifically for functions accepting object as a single argument.
|
|
1540
|
-
*
|
|
1541
|
-
* 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.
|
|
1542
|
-
*/
|
|
1543
|
-
export function partialObject<Input, PartialInput, Output>(
|
|
1544
|
-
fn: (input: Input) => Output,
|
|
1545
|
-
partialInput: PartialInput,
|
|
1546
|
-
): (input: Pick<Input, Exclude<keyof Input, keyof PartialInput>>) => Output;
|
|
1547
|
-
|
|
1548
|
-
export function uniqBy<T, U>(fn: (a: T) => U, list: readonly T[]): readonly T[];
|
|
1549
|
-
export function uniqBy<T, U>(fn: (a: T) => U): (list: readonly T[]) => readonly T[];
|
|
1550
|
-
|
|
1551
|
-
/**
|
|
1552
|
-
* It changes a property of object on the base of provided path and transformer function.
|
|
1553
|
-
*/
|
|
1554
|
-
export function modifyPath<T extends Record<string, unknown>>(path: Path, fn: (x: any) => unknown, object: Record<string, unknown>): T;
|
|
1555
|
-
export function modifyPath<T extends Record<string, unknown>>(path: Path, fn: (x: any) => unknown): (object: Record<string, unknown>) => T;
|
|
1556
|
-
export function modifyPath<T extends Record<string, unknown>>(path: Path): (fn: (x: any) => unknown) => (object: Record<string, unknown>) => T;
|