UNPKG

63.7 kBTypeScriptView Raw
1import { F as FunctionToolbelt, O as ObjectToolbelt, L as ListToolbelt } from "./_ts-toolbelt/src/ts-toolbelt";
2
3type RambdaTypes = "Object" | "Number" | "Boolean" | "String" | "Null" | "Array" | "RegExp" | "NaN" | "Function" | "Undefined" | "Async" | "Promise";
4
5type FilterFunctionArray<T> = (x: T) => boolean;
6type FilterPredicateIndexed<T> = (x: T, i: number) => boolean;
7type FilterFunctionObject<T> = (x: T, prop: string, inputObj: Dictionary<T>) => boolean;
8type MapFunctionObject<T, U> = (x: T, prop: string, inputObj: Dictionary<T>) => U;
9type MapFunctionArray<T, U> = (x: T) => U;
10type MapFunctionArrayIndexed<T, U> = (x: T, i: number) => U;
11type MapIterator<T, U> = (x: T) => U;
12type MapIndexedIterator<T, U> = (x: T, i: number) => U;
13
14type SimplePredicate<T> = (x: T) => boolean;
15
16type CommonKeys<T1, T2> = keyof T1 & keyof T2;
17
18type Ord = number | string | boolean | Date;
19
20type Path = string | readonly (number | string)[];
21type RamdaPath = readonly (number | string)[];
22
23type ValueOfRecord<R> =
24 R extends Record<any, infer T>
25 ? T
26 : never;
27
28interface KeyValuePair<K, V> extends Array<K | V> {
29 0: K;
30 1: V;
31}
32interface Lens {
33 <T, U>(obj: T): U;
34 set<T, U>(str: string, obj: T): U;
35}
36type Arity1Fn = (a: any) => any;
37
38type Arity2Fn = (a: any, b: any) => any;
39
40type Pred = (...x: readonly any[]) => boolean;
41type Predicate<T> = (input: T) => boolean;
42type SafePred<T> = (...x: readonly T[]) => boolean;
43
44interface Dictionary<T> {
45 [index: string]: T;
46}
47type Partial<T> = {
48 [P in keyof T]?: T[P];
49};
50
51type Evolvable<E extends Evolver> = {
52 [P in keyof E]?: Evolved<E[P]>;
53};
54
55type Evolver<T extends Evolvable<any> = any> = {
56 [key in keyof Partial<T>]: ((value: T[key]) => T[key]) | (T[key] extends Evolvable<any> ? Evolver<T[key]> : never);
57};
58
59type Evolve<O extends Evolvable<E>, E extends Evolver> = {
60 [P in keyof O]: P extends keyof E
61 ? EvolveValue<O[P], E[P]>
62 : O[P];
63};
64
65type EvolveNestedValue<O, E extends Evolver> =
66 O extends object
67 ? O extends Evolvable<E>
68 ? Evolve<O, E>
69 : never
70 : never;
71
72type EvolveValue<V, E> =
73 E extends (value: V) => any
74 ? ReturnType<E>
75 : E extends Evolver
76 ? EvolveNestedValue<V, E>
77 : never;
78
79type Merge<O1 extends object, O2 extends object, Depth extends 'flat' | 'deep'> = ObjectToolbelt.Merge<ListToolbelt.ObjectOf<O1>, ListToolbelt.ObjectOf<O2>, Depth, 1>;
80
81interface AssocPartialOne<K extends keyof any> {
82 <T>(val: T): <U>(obj: U) => Record<K, T> & U;
83 <T, U>(val: T, obj: U): Record<K, T> & U;
84}
85
86// RAMBDAX INTERFACES
87// ============================================
88type Func<T> = (input: any) => T;
89type VoidInputFunc<T> = () => T;
90type Fn<In, Out> = (x: In) => Out;
91type FnTwo<In, Out> = (x: In, y: In) => Out;
92type MapFn<In, Out> = (x: In, index: number) => Out;
93
94type FilterFunction<T> = (x: T, prop?: string, inputObj?: object) => boolean;
95type PartitionPredicate<T> = (x: T, prop?: string) => boolean;
96type MapFunction<In, Out> = (x: In, prop?: string, inputObj?: object) => Out;
97type SortObjectPredicate<T> = (aProp: string, bProp: string, aValue: T, bValue: T) => number;
98
99interface MapInterface<T> {
100 (list: T[]): T[];
101 (obj: Dictionary<T>): Dictionary<T>;
102}
103
104interface HeadObject<T> {
105 prop: string;
106 value: T;
107}
108
109type IdentityFunction<T> = (x: T) => T;
110
111interface Filter<T> {
112 (list: T[]): T[];
113 (obj: Dictionary<T>): Dictionary<T>;
114}
115
116type ArgumentTypes<T> = T extends (...args: infer U) => infer R ? U : never;
117
118type isfn<T> = (x: any, y: any) => T;
119
120interface Switchem<T> {
121 is: isfn<Switchem<T>>;
122 default: IdentityFunction<T>;
123}
124
125interface Reduced {
126 [index: number]: any;
127 [index: string]: any;
128}
129
130interface Schema {
131 [key: string]: any;
132}
133
134interface SchemaAsync {
135 [key: string]: Promise<boolean>;
136}
137
138interface IsValid {
139 input: object;
140 schema: Schema;
141}
142
143interface IsValidAsync {
144 input: object;
145 schema: Schema | SchemaAsync;
146}
147
148type ProduceRules<Output,K extends keyof Output, Input> = {
149 [P in K]: (input: Input) => Output[P];
150}
151type ProduceAsyncRules<Output,K extends keyof Output, Input> = {
152 [P in K]: (input: Input) => Promise<Output[P]>;
153}
154type ProduceAsyncRule<Input> = (input: Input) => Promise<any>
155type Async<T> = (x: any) => Promise<T>;
156type AsyncIterable<T, K> = (x: T) => Promise<K>;
157type AsyncIterableIndexed<T, K> = (x: T, i: number) => Promise<K>;
158type AsyncPredicate<T> = (x: T) => Promise<boolean>;
159type AsyncPredicateIndexed<T> = (x: T, i: number) => Promise<boolean>;
160type AsyncWithProp<T> = (x: any, prop?: string) => Promise<T>;
161
162type ApplyDiffUpdate = {op:'update', path: string, value: any}
163type ApplyDiffAdd = {op:'add', path: string, value: any}
164type ApplyDiffRemove = {op:'remove', path: string}
165type ApplyDiffRule = ApplyDiffUpdate | ApplyDiffAdd | ApplyDiffRemove
166export const DELAY: 'RAMBDAX_DELAY'
167
168
169/**
170 * It adds `a` and `b`.
171 */
172export function add(a: number, b: number): number;
173export function add(a: number): (b: number) => number;
174
175/**
176 * It replaces `index` in array `list` with the result of `replaceFn(list[i])`.
177 */
178export function adjust<T>(index: number, replaceFn: (x: T) => T, list: T[]): T[];
179export function adjust<T>(index: number, replaceFn: (x: T) => T): (list: T[]) => T[];
180
181/**
182 * It returns `true`, if all members of array `list` returns `true`, when applied as argument to `predicate` function.
183 */
184export function all<T>(predicate: (x: T) => boolean, list: T[]): boolean;
185export function all<T>(predicate: (x: T) => boolean): (list: T[]) => boolean;
186
187/**
188 * It returns `true`, if all functions of `predicates` return `true`, when `input` is their argument.
189 */
190export function allPass<T>(predicates: ((x: T) => boolean)[]): (input: T) => boolean;
191
192/**
193 * It returns function that always returns `x`.
194 */
195export function always<T>(x: T): () => T;
196
197/**
198 * Logical AND
199 */
200export function and<T, U>(x: T, y: U): T | U;
201export function and<T>(x: T): <U>(y: U) => T | U;
202
203/**
204 * Logical OR
205 */
206export function or<T, U>(a: T, b: U): T | U;
207export function or<T>(a: T): <U>(b: U) => T | U;
208
209/**
210 * It returns `true`, if at least one member of `list` returns true, when passed to a `predicate` function.
211 */
212export function any<T>(predicate: (x: T) => boolean, list: readonly T[]): boolean;
213export function any<T>(predicate: (x: T) => boolean): (list: readonly T[]) => boolean;
214
215/**
216 * 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`.
217 */
218export function anyPass<T>(predicates: SafePred<T>[]): SafePred<T>;
219
220/**
221 * It adds element `x` at the end of `list`.
222 */
223export function append<T>(x: T, list: readonly T[]): T[];
224export function append<T>(x: T): <T>(list: readonly T[]) => T[];
225
226export function applySpec<Spec extends Record<string, (...args: readonly any[]) => any>>(
227 spec: Spec
228): (
229 ...args: Parameters<ValueOfRecord<Spec>>
230) => { [Key in keyof Spec]: ReturnType<Spec[Key]> };
231export function applySpec<T>(spec: any): (...args: readonly any[]) => T;
232
233/**
234 * It makes a shallow clone of `obj` with setting or overriding the property `prop` with `newValue`.
235 */
236export function assoc<T, U, K extends string>(prop: K, val: T, obj: U): Record<K, T> & U;
237export function assoc<T, K extends string>(prop: K, val: T): <U>(obj: U) => Record<K, T> & U;
238export function assoc<K extends string>(prop: K): AssocPartialOne<K>;
239
240/**
241 * It makes a shallow clone of `obj` with setting or overriding with `newValue` the property found with `path`.
242 */
243export function assocPath<Output>(path: Path, newValue: any, obj: object): Output;
244export function assocPath<Output>(path: Path, newValue: any): (obj: object) => Output;
245export function assocPath<Output>(path: Path): FunctionToolbelt.Curry<(newValue: any, obj: object) => Output>;
246
247/**
248 * It returns a function with `input` argument.
249 *
250 * This function will return `true`, if both `firstCondition` and `secondCondition` return `true` when `input` is passed as their argument.
251 */
252export function both(pred1: Pred, pred2: Pred): Pred;
253export function both<T>(pred1: Predicate<T>, pred2: Predicate<T>): Predicate<T>;
254export function both<T>(pred1: Predicate<T>): (pred2: Predicate<T>) => Predicate<T>;
255export function both(pred1: Pred): (pred2: Pred) => Pred;
256
257/**
258 * The method is also known as `flatMap`.
259 */
260export function chain<T, U>(fn: (n: T) => U[], list: readonly T[]): U[];
261export function chain<T, U>(fn: (n: T) => U[]): (list: readonly T[]) => U[];
262export function chain<X0, X1, R>(fn: (x0: X0, x1: X1) => R, fn1: (x1: X1) => X0): (x1: X1) => R;
263
264/**
265 * Restrict a number `input` to be withing `min` and `max` limits.
266 *
267 * If `input` is bigger than `max`, then the result is `max`.
268 *
269 * If `input` is smaller than `min`, then the result is `min`.
270 */
271export function clamp(min: number, max: number, input: number): number;
272export function clamp(min: number, max: number): (input: number) => number;
273
274/**
275 * It creates a deep copy of the `input`, which may contain (nested) Arrays and Objects, Numbers, Strings, Booleans and Dates.
276 */
277export function clone<T>(input: T): T;
278export function clone<T>(input: readonly T[]): T[];
279
280/**
281 * It returns `inverted` version of `origin` function that accept `input` as argument.
282 *
283 * The return value of `inverted` is the negative boolean value of `origin(input)`.
284 */
285export function complement(pred: (...args: readonly any[]) => boolean): (...args: readonly any[]) => boolean;
286
287/**
288 * It performs right-to-left function composition.
289 */
290export function compose<T1>(fn0: () => T1): () => T1;
291export function compose<V0, T1>(fn0: (x0: V0) => T1): (x0: V0) => T1;
292export function compose<V0, V1, T1>(fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T1;
293export function compose<V0, V1, V2, T1>(fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T1;
294
295export function compose<T1, T2>(fn1: (x: T1) => T2, fn0: () => T1): () => T2;
296export function compose<V0, T1, T2>(fn1: (x: T1) => T2, fn0: (x0: V0) => T1): (x0: V0) => T2;
297export function compose<V0, V1, T1, T2>(fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T2;
298export function compose<V0, V1, V2, T1, T2>(fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T2;
299
300export function compose<T1, T2, T3>(fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: () => T1): () => T3;
301export function compose<V0, T1, T2, T3>(fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x: V0) => T1): (x: V0) => T3;
302export function compose<V0, V1, T1, T2, T3>(fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T3;
303export function compose<V0, V1, V2, T1, T2, T3>(fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T3;
304
305export function compose<T1, T2, T3, T4>(fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: () => T1): () => T4;
306export function compose<V0, T1, T2, T3, T4>(fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x: V0) => T1): (x: V0) => T4;
307export function compose<V0, V1, T1, T2, T3, T4>(fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T4;
308export function compose<V0, V1, V2, T1, T2, T3, T4>(fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T4;
309
310export function compose<T1, T2, T3, T4, T5>(fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: () => T1): () => T5;
311export function compose<V0, T1, T2, T3, T4, T5>(fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x: V0) => T1): (x: V0) => T5;
312export function compose<V0, V1, T1, T2, T3, T4, T5>(fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T5;
313export function compose<V0, V1, V2, T1, T2, T3, T4, T5>(fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T5;
314
315export function compose<T1, T2, T3, T4, T5, T6>(fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: () => T1): () => T6;
316export function compose<V0, T1, T2, T3, T4, T5, T6>(fn5: (x: T5) => T6, fn4: (x: T4) => T5, fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x: V0) => T1): (x: V0) => T6;
317export function compose<V0, V1, T1, T2, T3, T4, T5, T6>(
318 fn5: (x: T5) => T6,
319 fn4: (x: T4) => T5,
320 fn3: (x: T3) => T4,
321 fn2: (x: T2) => T3,
322 fn1: (x: T1) => T2,
323 fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T6;
324export function compose<V0, V1, V2, T1, T2, T3, T4, T5, T6>(
325 fn5: (x: T5) => T6,
326 fn4: (x: T4) => T5,
327 fn3: (x: T3) => T4,
328 fn2: (x: T2) => T3,
329 fn1: (x: T1) => T2,
330 fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T6;
331
332/**
333 * It returns a new string or array, which is the result of merging `x` and `y`.
334 */
335export function concat<T>(x: readonly T[], y: readonly T[]): T[];
336export function concat<T>(x: readonly T[]): (y: readonly T[]) => T[];
337export function concat(x: string, y: string): string;
338export function concat(x: string): (y: string) => string;
339
340/**
341 * It takes list with `conditions` and returns a new function `fn` that expects `input` as argument.
342 *
343 * This function will start evaluating the `conditions` in order to find the first winner(order of conditions matter).
344 *
345 * The winner is this condition, which left side returns `true` when `input` is its argument. Then the evaluation of the right side of the winner will be the final result.
346 *
347 * If no winner is found, then `fn` returns `undefined`.
348 */
349export function cond(conditions: [Pred, (...a: readonly any[]) => any][]): (...x: readonly any[]) => any;
350export function cond<A, B>(conditions: [SafePred<A>, (...a: readonly A[]) => B][]): (...x: readonly A[]) => B;
351
352/**
353 * Accepts a converging function and a list of branching functions and returns a new function. When invoked, this new function is applied to some arguments, each branching function is applied to those same arguments. The results of each branching function are passed as arguments to the converging function to produce the return value.
354 */
355export function converge(after: ((...a: any[]) => any), fns: Array<((...x: any[]) => any)>): (...y: any[]) => any;
356
357/**
358 * It expects a function as input and returns its curried version.
359 */
360export function curry(fn: (...args: any[]) => any): (...a: any[]) => any;
361
362/**
363 * It returns a curried equivalent of the provided function, with the specified arity.
364 */
365export function curryN(length: number, fn: (...args: readonly any[]) => any): (...a: readonly any[]) => any;
366
367/**
368 * It decrements a number.
369 */
370export function dec(x: number): number;
371
372/**
373 * It returns `defaultValue`, if all of `inputArguments` are `undefined`, `null` or `NaN`.
374 *
375 * Else, it returns the first truthy `inputArguments` instance(from left to right).
376 */
377export function defaultTo<T>(defaultValue: T): (...inputArguments: (T | null | undefined)[]) => T;
378export function defaultTo<T>(defaultValue: T, ...inputArguments: (T | null | undefined)[]): T;
379export function defaultTo<T, U>(defaultValue: T | U, ...inputArguments: (T | U | null | undefined)[]): T | U;
380
381/**
382 * It returns the uniq set of all elements in the first list `a` not contained in the second list `b`.
383 */
384export function difference<T>(a: readonly T[], b: readonly T[]): T[];
385export function difference<T>(a: readonly T[]): (b: readonly T[]) => T[];
386
387/**
388 * It returns a new object that does not contain property `prop`.
389 */
390export function dissoc<T>(prop: string, obj: any): T;
391export function dissoc<T>(prop: string): (obj: any) => T;
392
393export function divide(x: number, y: number): number;
394export function divide(x: number): (y: number) => number;
395
396/**
397 * It returns `howMany` items dropped from beginning of list or string `input`.
398 */
399export function drop<T>(howMany: number, input: readonly T[]): T[];
400export function drop(howMany: number, input: string): string;
401export function drop<T>(howMany: number): {
402 <T>(input: readonly T[]): T[];
403 (input: string): string;
404};
405
406/**
407 * It returns `howMany` items dropped from the end of list or string `input`.
408 */
409export function dropLast<T>(howMany: number, input: readonly T[]): T[];
410export function dropLast(howMany: number, input: string): string;
411export function dropLast<T>(howMany: number): {
412 <T>(input: readonly T[]): T[];
413 (input: string): string;
414};
415
416/**
417 * It returns a new `predicate` function from `firstPredicate` and `secondPredicate` inputs.
418 *
419 * This `predicate` function will return `true`, if any of the two input predicates return `true`.
420 */
421export function either(firstPredicate: Pred, secondPredicate: Pred): Pred;
422export function either<T>(firstPredicate: Predicate<T>, secondPredicate: Predicate<T>): Predicate<T>;
423export function either<T>(firstPredicate: Predicate<T>): (secondPredicate: Predicate<T>) => Predicate<T>;
424export function either(firstPredicate: Pred): (secondPredicate: Pred) => Pred;
425
426/**
427 * Curried version of `String.prototype.endsWith`
428 */
429export function endsWith(target: string, str: string): boolean;
430export function endsWith(target: string): (str: string) => boolean;
431
432/**
433 * It deeply compares `x` and `y` and returns `true` if they are equal.
434 */
435export function equals<T>(x: T, y: T): boolean;
436export function equals<T>(x: T): (y: T) => boolean;
437
438export function F(): boolean;
439
440/**
441 * It filters list or object `input` using a `predicate` function.
442 */
443export function filter<T>(predicate: FilterFunctionArray<T>): (input: readonly T[]) => T[];
444export function filter<T>(predicate: FilterFunctionArray<T>, input: readonly T[]): T[];
445export function filter<T, U>(predicate: FilterFunctionObject<T>): (x: Dictionary<T>) => Dictionary<T>;
446export function filter<T>(predicate: FilterFunctionObject<T>, x: Dictionary<T>): Dictionary<T>;
447
448/**
449 * It returns the first element of `list` that satisfy the `predicate`.
450 *
451 * If there is no such element, it returns `undefined`.
452 */
453export function find<T>(predicate: (x: T) => boolean, list: readonly T[]): T | undefined;
454export function find<T>(predicate: (x: T) => boolean): (list: readonly T[]) => T | undefined;
455
456/**
457 * It returns the index of the first element of `list` satisfying the `predicate` function.
458 *
459 * If there is no such element, then `-1` is returned.
460 */
461export function findIndex<T>(predicate: (x: T) => boolean, list: readonly T[]): number;
462export function findIndex<T>(predicate: (x: T) => boolean): (list: readonly T[]) => number;
463
464/**
465 * It returns the last element of `list` satisfying the `predicate` function.
466 *
467 * If there is no such element, then `undefined` is returned.
468 */
469export function findLast<T>(fn: (x: T) => boolean, list: readonly T[]): T | undefined;
470export function findLast<T>(fn: (x: T) => boolean): (list: readonly T[]) => T | undefined;
471
472/**
473 * It returns the index of the last element of `list` satisfying the `predicate` function.
474 *
475 * If there is no such element, then `-1` is returned.
476 */
477export function findLastIndex<T>(predicate: (x: T) => boolean, list: readonly T[]): number;
478export function findLastIndex<T>(predicate: (x: T) => boolean): (list: readonly T[]) => number;
479
480/**
481 * It deeply flattens an array.
482 */
483export function flatten<T>(list: readonly any[]): T[];
484
485/**
486 * It returns function which calls `fn` with exchanged first and second argument.
487 */
488export function flip<T, U, TResult>(fn: (arg0: T, arg1: U) => TResult): (arg1: U, arg0?: T) => TResult;
489export function flip<F extends (...args: any) => any, P extends FunctionToolbelt.Parameters<F>>(fn: F): FunctionToolbelt.Curry<(...args: ListToolbelt.Merge<[P[1], P[0]], P>) => FunctionToolbelt.Return<F>>;
490
491/**
492 * It applies `iterable` function over all members of `list` and returns `list`.
493 */
494export function forEach<T>(fn: MapFunctionArray<T, void>, list: readonly T[]): T[];
495export function forEach<T>(fn: MapFunctionArray<T, void>): (list: readonly T[]) => T[];
496export function forEach<T>(fn: MapFunctionObject<T, void>, list: Dictionary<T>): Dictionary<T>;
497export function forEach<T, U>(fn: MapFunctionObject<T, void>): (list: Dictionary<T>) => Dictionary<T>;
498
499/**
500 * It transforms a `listOfPairs` to an object.
501 */
502export function fromPairs<V>(listOfPairs: KeyValuePair<string, V>[]): { [index: string]: V };
503export function fromPairs<V>(listOfPairs: KeyValuePair<number, V>[]): { [index: number]: V };
504
505/**
506 * It splits `list` according to a provided `groupFn` function and returns an object.
507 */
508export function groupBy<T>(groupFn: (x: T) => string, list: readonly T[]): { [index: string]: T[] };
509export function groupBy<T>(groupFn: (x: T) => string): (list: readonly T[]) => { [index: string]: T[] };
510
511/**
512 * It returns separated version of list or string `input`, where separation is done with equality `compareFn` function.
513 */
514export function groupWith<T>(compareFn: (x: T, y: T) => boolean): (input: readonly T[]) => T[][];
515export function groupWith<T>(compareFn: (x: T, y: T) => boolean, input: readonly T[]): T[][];
516export function groupWith<T>(compareFn: (x: T, y: T) => boolean, input: string): string[];
517
518/**
519 * It returns `true` if `obj` has property `prop`.
520 */
521export function has<T>(prop: string, obj: T): boolean;
522export function has(prop: string): <T>(obj: T) => boolean;
523
524/**
525 * It will return true, if `input` object has truthy `path`(calculated with `R.path`).
526 */
527export function hasPath<T>(
528 path: string | readonly string[],
529 input: object
530): boolean;
531export function hasPath<T>(
532 path: string | readonly string[]
533): (input: object) => boolean;
534
535/**
536 * It returns the first element of list or string `input`.
537 */
538export function head<T>(input: readonly T[]): T | undefined;
539export function head(input: string): string;
540
541/**
542 * It returns `true` if its arguments `a` and `b` are identical.
543 *
544 * Otherwise, it returns `false`.
545 */
546export function identical<T>(x: T, y: T): boolean;
547export function identical<T>(x: T): (y: T) => boolean;
548
549/**
550 * It just passes back the supplied `input` argument.
551 */
552export function identity<T>(input: T): T;
553
554/**
555 * It expects `condition`, `onTrue` and `onFalse` functions as inputs and it returns a new function with example name of `fn`.
556 *
557 * When `fn`` is called with `input` argument, it will return either `onTrue(input)` or `onFalse(input)` depending on `condition(input)` evaluation.
558 */
559export function ifElse<T, U>(
560 condition: (x: T) => boolean,
561 onTrue: (x: T) => U,
562 onFalse: (x: T) => U,
563): (x: T) => U;
564export function ifElse<T, K, U>(
565 condition: (x: T, y: K) => boolean,
566 onTrue: (x: T, y: K) => U,
567 onFalse: (x: T, y: K) => U,
568): (x: T, y: K) => U;
569
570/**
571 * It increments a number.
572 */
573export function inc(x: number): number;
574
575/**
576 * If `input` is string, then this method work as native `String.includes`.
577 *
578 * If `input` is array, then `R.equals` is used to define if `valueToFind` belongs to the list.
579 */
580export function includes(valueToFind: string, input: readonly string[] | string): boolean;
581export function includes(valueToFind: string): (input: readonly string[] | string) => boolean;
582export function includes<T>(valueToFind: T, input: readonly T[]): boolean;
583export function includes<T>(valueToFind: T): (input: readonly T[]) => boolean;
584
585/**
586 * It generates object with properties provided by `condition` and values provided by `list` array.
587 *
588 * If `condition` is a function, then all list members are passed through it.
589 *
590 * If `condition` is a string, then all list members are passed through `R.path(condition)`.
591 */
592export function indexBy<T>(condition: (x: T) => string, list: readonly T[]): { [key: string]: T };
593export function indexBy<T>(condition: string, list: readonly T[]): { [key: string]: T };
594export function indexBy<T>(condition: (x: T) => string): (list: readonly T[]) => { [key: string]: T };
595export function indexBy<T>(condition: string): (list: readonly T[]) => { [key: string]: T };
596
597/**
598 * It returns the index of the first element of `list` equals to `valueToFind`.
599 *
600 * If there is no such element, it returns `-1`.
601 */
602export function indexOf<T>(valueToFind: T, list: readonly T[]): number;
603export function indexOf<T>(valueToFind: T): (list: readonly T[]) => number;
604
605/**
606 * It returns all but the last element of list or string `input`.
607 */
608export function init<T>(input: readonly T[]): T[];
609export function init(input: string): string;
610
611/**
612 * It loops throw `listA` and `listB` and returns the intersection of the two according to `R.equals`.
613 */
614export function intersection<T>(listA: readonly T[], listB: readonly T[]): T[];
615export function intersection<T>(listA: readonly T[]): (listB: readonly T[]) => T[];
616
617/**
618 * It adds a `separator` between members of `list`.
619 */
620export function intersperse<T>(separator: T, list: readonly T[]): T[];
621export function intersperse<T>(separator: T): (list: readonly T[]) => T[];
622
623/**
624 * It returns `true` if `x` is instance of `targetPrototype`.
625 */
626export function is(targetPrototype: any, x: any): boolean;
627export function is(targetPrototype: any): (x: any) => boolean;
628
629/**
630 * It returns `true` if `x` is `empty`.
631 */
632export function isEmpty<T>(x: T): boolean;
633
634/**
635 * It returns `true` if `x` is either `null` or `undefined`.
636 */
637export function isNil(x: any): x is null | undefined;
638
639/**
640 * It returns a string of all `list` instances joined with a `glue`.
641 */
642export function join<T>(glue: string, list: readonly T[]): string;
643export function join<T>(glue: string): (list: readonly T[]) => string;
644
645/**
646 * It applies `Object.keys` over `x` and returns its keys.
647 */
648export function keys<T extends object>(x: T): (keyof T)[];
649export function keys<T>(x: T): string[];
650
651/**
652 * It returns the last element of `input`, as the `input` can be either a string or an array.
653 */
654export function last(str: string): string;
655export function last(emptyList: []): undefined;
656export function last<T extends any>(list: readonly T[]): T | undefined;
657
658/**
659 * It returns the last index of `target` in `list` array.
660 *
661 * `R.equals` is used to determine equality between `target` and members of `list`.
662 *
663 * If there is no such index, then `-1` is returned.
664 */
665export function lastIndexOf<T>(target: T, list: readonly T[]): number;
666export function lastIndexOf<T>(target: T): (list: readonly T[]) => number;
667
668/**
669 * It returns the `length` property of list or string `input`.
670 */
671export function length<T>(input: readonly T[]): number;
672
673/**
674 * It returns a `lens` for the given `getter` and `setter` functions.
675 *
676 * The `getter` **gets** the value of the focus; the `setter` **sets** the value of the focus.
677 *
678 * The setter should not mutate the data structure.
679 */
680export function lens<T, U, V>(getter: (s: T) => U, setter: (a: U, s: T) => V): Lens;
681
682/**
683 * It returns a lens that focuses on specified `index`.
684 */
685export function lensIndex(index: number): Lens;
686
687/**
688 * It returns a lens that focuses on specified `path`.
689 */
690export function lensPath(path: RamdaPath): Lens;
691export function lensPath(path: string): Lens;
692
693/**
694 * It returns a lens that focuses on specified property `prop`.
695 */
696export function lensProp(prop: string): {
697 <T, U>(obj: T): U;
698 set<T, U, V>(val: T, obj: U): V;
699};
700
701/**
702 * It returns a copied **Object** or **Array** with modified value received by applying function `fn` to `lens` focus.
703 */
704export function over<T>(lens: Lens, fn: Arity1Fn, value: T): T;
705export function over<T>(lens: Lens, fn: Arity1Fn, value: readonly T[]): T[];
706export function over(lens: Lens, fn: Arity1Fn): <T>(value: T) => T;
707export function over(lens: Lens, fn: Arity1Fn): <T>(value: readonly T[]) => T[];
708export function over(lens: Lens): <T>(fn: Arity1Fn, value: T) => T;
709export function over(lens: Lens): <T>(fn: Arity1Fn, value: readonly T[]) => T[];
710
711/**
712 * It returns a copied **Object** or **Array** with modified `lens` focus set to `replacer` value.
713 */
714export function set<T, U>(lens: Lens, replacer: U, obj: T): T;
715export function set<U>(lens: Lens, replacer: U): <T>(obj: T) => T;
716export function set(lens: Lens): <T, U>(replacer: U, obj: T) => T;
717
718/**
719 * It returns the value of `lens` focus over `target` object.
720 */
721export function view<T, U>(lens: Lens): (target: T) => U;
722export function view<T, U>(lens: Lens, target: T): U;
723
724/**
725 * It returns the result of looping through `iterable` with `fn`.
726 *
727 * It works with both array and object.
728 */
729export function map<T, U>(fn: MapFunctionObject<T, U>, iterable: Dictionary<T>): Dictionary<U>;
730export function map<T, U>(fn: MapIterator<T, U>, iterable: readonly T[]): U[];
731export function map<T, U>(fn: MapIterator<T, U>): (iterable: readonly T[]) => U[];
732export function map<T, U, S>(fn: MapFunctionObject<T, U>): (iterable: Dictionary<T>) => Dictionary<U>;
733export function map<T>(fn: MapIterator<T, T>): (iterable: readonly T[]) => T[];
734export function map<T>(fn: MapIterator<T, T>, iterable: readonly T[]): T[];
735
736/**
737 * Curried version of `String.prototype.match` which returns empty array, when there is no match.
738 */
739export function match(regExpression: RegExp, str: string): string[];
740export function match(regExpression: RegExp): (str: string) => string[];
741
742/**
743 * `R.mathMod` behaves like the modulo operator should mathematically, unlike the `%` operator (and by extension, `R.modulo`). So while `-17 % 5` is `-2`, `mathMod(-17, 5)` is `3`.
744 */
745export function mathMod(x: number, y: number): number;
746export function mathMod(x: number): (y: number) => number;
747
748/**
749 * It returns the greater value between `x` and `y`.
750 */
751export function max<T extends Ord>(x: T, y: T): T;
752export function max<T extends Ord>(x: T): (y: T) => T;
753
754/**
755 * It returns the greater value between `x` and `y` according to `compareFn` function.
756 */
757export function maxBy<T>(compareFn: (input: T) => Ord, x: T, y: T): T;
758export function maxBy<T>(compareFn: (input: T) => Ord, x: T): (y: T) => T;
759export function maxBy<T>(compareFn: (input: T) => Ord): FunctionToolbelt.Curry<(x: T, y: T) => T>;
760
761/**
762 * It returns the mean value of `list` input.
763 */
764export function mean(list: readonly number[]): number;
765
766/**
767 * It returns the median value of `list` input.
768 */
769export function median(list: readonly number[]): number;
770
771/**
772 * It creates a copy of `target` object with overidden `newProps` properties.
773 */
774export function merge<O1 extends object, O2 extends object>(target: O1, newProps: O2): Merge<O2, O1, 'flat'>;
775export function merge<O1 extends object>(target: O1): <O2 extends object>(newProps: O2) => Merge<O2, O1, 'flat'>;
776
777/**
778 * It merges all objects of `list` array sequentially and returns the result.
779 */
780export function mergeAll<T>(list: object[]): T;
781export function mergeAll(list: object[]): object;
782
783/**
784 * Creates a new object with the own properties of the first object merged with the own properties of the second object. If a key exists in both objects:
785 *
786 * - and both values are objects, the two values will be recursively merged
787 * - otherwise the value from the second object will be used.
788 */
789export function mergeDeepRight<O1 extends object, O2 extends object>(x: O1, y: O2): Merge<O2, O1, 'deep'>;
790export function mergeDeepRight<O1 extends object>(x: O1): <O2 extends object>(y: O2) => Merge<O2, O1, 'deep'>;
791
792/**
793 * Same as `R.merge`, but in opposite direction.
794 */
795export function mergeLeft<O1 extends object, O2 extends object>(target: O1, newProps: O2): Merge<O2, O1, 'flat'>;
796export function mergeLeft<O1 extends object>(target: O1): <O2 extends object>(newProps: O2) => Merge<O2, O1, 'flat'>;
797
798/**
799 * It returns the lesser value between `x` and `y`.
800 */
801export function min<T extends Ord>(x: T, y: T): T;
802export function min<T extends Ord>(x: T): (y: T) => T;
803
804/**
805 * It returns the lesser value between `x` and `y` according to `compareFn` function.
806 */
807export function minBy<T>(compareFn: (input: T) => Ord, x: T, y: T): T;
808export function minBy<T>(compareFn: (input: T) => Ord, x: T): (y: T) => T;
809export function minBy<T>(compareFn: (input: T) => Ord): FunctionToolbelt.Curry<(x: T, y: T) => T>;
810
811/**
812 * Curried version of `x%y`.
813 */
814export function modulo(x: number, y: number): number;
815export function modulo(x: number): (y: number) => number;
816
817/**
818 * It returns a copy of `list` with exchanged `fromIndex` and `toIndex` elements.
819 */
820export function move<T>(fromIndex: number, toIndex: number, list: readonly T[]): T[];
821export function move(fromIndex: number, toIndex: number): <T>(list: readonly T[]) => T[];
822export function move(fromIndex: number): {
823 <T>(toIndex: number, list: readonly T[]): T[];
824 (toIndex: number): <T>(list: readonly T[]) => T[];
825};
826
827/**
828 * Curried version of `x*y`.
829 */
830export function multiply(x: number, y: number): number;
831export function multiply(x: number): (y: number) => number;
832
833export function negate(x: number): number;
834
835/**
836 * It returns `true`, if all members of array `list` returns `false`, when applied as argument to `predicate` function.
837 */
838export function none<T>(predicate: (x: T) => boolean, list: readonly T[]): boolean;
839export function none<T>(predicate: (x: T) => boolean): (list: readonly T[]) => boolean;
840
841/**
842 * It returns a boolean negated version of `input`.
843 */
844export function not(input: any): boolean;
845
846/**
847 * Curried version of `list[index]`.
848 */
849export function nth<T>(index: number, list: readonly T[]): T | undefined;
850export function nth(index: number): <T>(list: readonly T[]) => T | undefined;
851
852/**
853 * It returns a function, which invokes only once `fn` function.
854 */
855export function once<T extends (...args: any[]) => any>(func: T): T;
856
857/**
858 * It returns a partial copy of an `obj` without `propsToOmit` properties.
859 */
860export function omit<T, K extends string>(propsToOmit: readonly K[], obj: T): Omit<T, K>;
861export function omit<K extends string>(propsToOmit: readonly K[]): <T>(obj: T) => Omit<T, K>;
862export function omit<T, U>(propsToOmit: string, obj: T): U;
863export function omit<T, U>(propsToOmit: string): (obj: T) => U;
864export function omit<T>(propsToOmit: string, obj: object): T;
865export function omit<T>(propsToOmit: string): (obj: object) => T;
866
867export function of<T>(x: T): T[];
868
869/**
870 * It is very similar to `R.curry`, but you can pass initial arguments when you create the curried function.
871 *
872 * `R.partial` will keep returning a function until all the arguments that the function `fn` expects are passed.
873 * The name comes from the fact that you partially inject the inputs.
874 */
875export function partial<V0, V1, T>(fn: (x0: V0, x1: V1) => T, args: [V0]): (x1: V1) => T;
876export function partial<V0, V1, V2, T>(fn: (x0: V0, x1: V1, x2: V2) => T, args: [V0, V1]): (x2: V2) => T;
877export function partial<V0, V1, V2, T>(fn: (x0: V0, x1: V1, x2: V2) => T, args: [V0]): (x1: V1, x2: V2) => T;
878export function partial<V0, V1, V2, V3, T>(fn: (x0: V0, x1: V1, x2: V2, x3: V3) => T, args: [V0, V1, V2]): (x2: V3) => T;
879export function partial<V0, V1, V2, V3, T>(fn: (x0: V0, x1: V1, x2: V2, x3: V3) => T, args: [V0, V1]): (x2: V2, x3: V3) => T;
880export function partial<V0, V1, V2, V3, T>(fn: (x0: V0, x1: V1, x2: V2, x3: V3) => T, args: [V0]): (x1: V1, x2: V2, x3: V3) => T;
881export function partial<T>(fn: (...a: any[]) => T, args: any[]): (...x: any[]) => T;
882
883/**
884 * It will return array of two objects/arrays according to `predicate` function. The first member holds all instanses of `input` that pass the `predicate` function, while the second member - those who doesn't.
885 */
886export function partition<T>(
887 predicate: Predicate<T>,
888 input: readonly T[]
889): [T[], T[]];
890export function partition<T>(
891 predicate: Predicate<T>
892): (input: readonly T[]) => [T[], T[]];
893export function partition<T>(
894 predicate: (x: T, prop?: string) => boolean,
895 input: { [key: string]: T}
896): [{ [key: string]: T}, { [key: string]: T}];
897export function partition<T>(
898 predicate: (x: T, prop?: string) => boolean
899): (input: { [key: string]: T}) => [{ [key: string]: T}, { [key: string]: T}];
900
901/**
902 * If `pathToSearch` is `'a.b'` then it will return `1` if `obj` is `{a:{b:1}}`.
903 *
904 * It will return `undefined`, if such path is not found.
905 */
906export function path<Input, T>(pathToSearch: Path, obj: Input): T | undefined;
907export function path<T>(pathToSearch: Path, obj: any): T | undefined;
908export function path<T>(pathToSearch: Path): (obj: any) => T | undefined;
909export function path<Input, T>(pathToSearch: Path): (obj: Input) => T | undefined;
910
911/**
912 * It returns `true` if `pathToSearch` of `input` object is equal to `target` value.
913 *
914 * `pathToSearch` is passed to `R.path`, which means that it can be either a string or an array. Also equality between `target` and the found value is determined by `R.equals`.
915 */
916export function pathEq(pathToSearch: Path, target: any, input: any): boolean;
917export function pathEq(pathToSearch: Path, target: any): (input: any) => boolean;
918export function pathEq(pathToSearch: Path): FunctionToolbelt.Curry<(a: any, b: any) => boolean>;
919
920/**
921 * It loops over members of `pathsToSearch` as `singlePath` and returns the array produced by `R.path(singlePath, obj)`.
922 *
923 * Because it calls `R.path`, then `singlePath` can be either string or a list.
924 */
925export function paths<Input, T>(pathsToSearch: Path[], obj: Input): (T | undefined)[];
926export function paths<Input, T>(pathsToSearch: Path[]): (obj: Input) => (T | undefined)[];
927export function paths<T>(pathsToSearch: Path[], obj: any): (T | undefined)[];
928export function paths<T>(pathsToSearch: Path[]): (obj: any) => (T | undefined)[];
929
930/**
931 * It reads `obj` input and returns either `R.path(pathToSearch, obj)` result or `defaultValue` input.
932 */
933export function pathOr<T>(defaultValue: T, pathToSearch: Path, obj: any): T;
934export function pathOr<T>(defaultValue: T, pathToSearch: Path): (obj: any) => T;
935export function pathOr<T>(defaultValue: T): FunctionToolbelt.Curry<(a: Path, b: any) => T>;
936
937/**
938 * It returns a partial copy of an `input` containing only `propsToPick` properties.
939 *
940 * `input` can be either an object or an array.
941 *
942 * String anotation of `propsToPick` is one of the differences between `Rambda` and `Ramda`.
943 */
944export function pick<T, K extends string | number | symbol>(propsToPick: readonly K[], input: T): Pick<T, Exclude<keyof T, Exclude<keyof T, K>>>;
945export function pick<K extends string | number | symbol>(propsToPick: readonly K[]): <T>(input: T) => Pick<T, Exclude<keyof T, Exclude<keyof T, K>>>;
946export function pick<T, U>(propsToPick: string, input: T): U;
947export function pick<T, U>(propsToPick: string): (input: T) => U;
948export function pick<T>(propsToPick: string, input: object): T;
949export function pick<T>(propsToPick: string): (input: object) => T;
950
951/**
952 * Same as `R.pick` but it won't skip the missing props, i.e. it will assign them to `undefined`.
953 */
954export function pickAll<T, U>(propsToPick: readonly string[], input: T): U;
955export function pickAll<T, U>(propsToPick: readonly string[]): (input: T) => U;
956export function pickAll<T, U>(propsToPick: string, input: T): U;
957export function pickAll<T, U>(propsToPick: string): (input: T) => U;
958
959/**
960 * It performs left-to-right function composition.
961 */
962export function pipe<T1>(fn0: () => T1): () => T1;
963export function pipe<V0, T1>(fn0: (x0: V0) => T1): (x0: V0) => T1;
964export function pipe<V0, V1, T1>(fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T1;
965export function pipe<V0, V1, V2, T1>(fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T1;
966
967export function pipe<T1, T2>(fn0: () => T1, fn1: (x: T1) => T2): () => T2;
968export function pipe<V0, T1, T2>(fn0: (x0: V0) => T1, fn1: (x: T1) => T2): (x0: V0) => T2;
969export function pipe<V0, V1, T1, T2>(fn0: (x0: V0, x1: V1) => T1, fn1: (x: T1) => T2): (x0: V0, x1: V1) => T2;
970export function pipe<V0, V1, V2, T1, T2>(fn0: (x0: V0, x1: V1, x2: V2) => T1, fn1: (x: T1) => T2): (x0: V0, x1: V1, x2: V2) => T2;
971
972export function pipe<T1, T2, T3>(fn0: () => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3): () => T3;
973export function pipe<V0, T1, T2, T3>(fn0: (x: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3): (x: V0) => T3;
974export function pipe<V0, V1, T1, T2, T3>(fn0: (x0: V0, x1: V1) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3): (x0: V0, x1: V1) => T3;
975export function pipe<V0, V1, V2, T1, T2, T3>(fn0: (x0: V0, x1: V1, x2: V2) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3): (x0: V0, x1: V1, x2: V2) => T3;
976
977export function pipe<T1, T2, T3, T4>(fn0: () => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4): () => T4;
978export function pipe<V0, T1, T2, T3, T4>(fn0: (x: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4): (x: V0) => T4;
979export function pipe<V0, V1, T1, T2, T3, T4>(fn0: (x0: V0, x1: V1) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4): (x0: V0, x1: V1) => T4;
980export function pipe<V0, V1, V2, T1, T2, T3, T4>(fn0: (x0: V0, x1: V1, x2: V2) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4): (x0: V0, x1: V1, x2: V2) => T4;
981
982export function pipe<T1, T2, T3, T4, T5>(fn0: () => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5): () => T5;
983export function pipe<V0, T1, T2, T3, T4, T5>(fn0: (x: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5): (x: V0) => T5;
984export function pipe<V0, V1, T1, T2, T3, T4, T5>(fn0: (x0: V0, x1: V1) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5): (x0: V0, x1: V1) => T5;
985export function pipe<V0, V1, V2, T1, T2, T3, T4, T5>(fn0: (x0: V0, x1: V1, x2: V2) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5): (x0: V0, x1: V1, x2: V2) => T5;
986
987export function pipe<T1, T2, T3, T4, T5, T6>(fn0: () => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6): () => T6;
988export function pipe<V0, T1, T2, T3, T4, T5, T6>(fn0: (x: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6): (x: V0) => T6;
989export function pipe<V0, V1, T1, T2, T3, T4, T5, T6>(fn0: (x0: V0, x1: V1) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6): (x0: V0, x1: V1) => T6;
990export function pipe<V0, V1, V2, T1, T2, T3, T4, T5, T6>(
991 fn0: (x0: V0, x1: V1, x2: V2) => T1,
992 fn1: (x: T1) => T2,
993 fn2: (x: T2) => T3,
994 fn3: (x: T3) => T4,
995 fn4: (x: T4) => T5,
996 fn5: (x: T5) => T6): (x0: V0, x1: V1, x2: V2) => T6;
997
998export function pipe<T1, T2, T3, T4, T5, T6, T7>(
999 fn0: () => T1,
1000 fn1: (x: T1) => T2,
1001 fn2: (x: T2) => T3,
1002 fn3: (x: T3) => T4,
1003 fn4: (x: T4) => T5,
1004 fn5: (x: T5) => T6,
1005 fn: (x: T6) => T7): () => T7;
1006export function pipe<V0, T1, T2, T3, T4, T5, T6, T7>(
1007 fn0: (x: V0) => T1,
1008 fn1: (x: T1) => T2,
1009 fn2: (x: T2) => T3,
1010 fn3: (x: T3) => T4,
1011 fn4: (x: T4) => T5,
1012 fn5: (x: T5) => T6,
1013 fn: (x: T6) => T7): (x: V0) => T7;
1014export function pipe<V0, V1, T1, T2, T3, T4, T5, T6, T7>(
1015 fn0: (x0: V0, x1: V1) => T1,
1016 fn1: (x: T1) => T2,
1017 fn2: (x: T2) => T3,
1018 fn3: (x: T3) => T4,
1019 fn4: (x: T4) => T5,
1020 fn5: (x: T5) => T6,
1021 fn6: (x: T6) => T7): (x0: V0, x1: V1) => T7;
1022export function pipe<V0, V1, V2, T1, T2, T3, T4, T5, T6, T7>(
1023 fn0: (x0: V0, x1: V1, x2: V2) => T1,
1024 fn1: (x: T1) => T2,
1025 fn2: (x: T2) => T3,
1026 fn3: (x: T3) => T4,
1027 fn4: (x: T4) => T5,
1028 fn5: (x: T5) => T6,
1029 fn6: (x: T6) => T7): (x0: V0, x1: V1, x2: V2) => T7;
1030
1031export function pipe<T1, T2, T3, T4, T5, T6, T7, T8>(
1032 fn0: () => T1,
1033 fn1: (x: T1) => T2,
1034 fn2: (x: T2) => T3,
1035 fn3: (x: T3) => T4,
1036 fn4: (x: T4) => T5,
1037 fn5: (x: T5) => T6,
1038 fn6: (x: T6) => T7,
1039 fn: (x: T7) => T8): () => T8;
1040export function pipe<V0, T1, T2, T3, T4, T5, T6, T7, T8>(
1041 fn0: (x: V0) => T1,
1042 fn1: (x: T1) => T2,
1043 fn2: (x: T2) => T3,
1044 fn3: (x: T3) => T4,
1045 fn4: (x: T4) => T5,
1046 fn5: (x: T5) => T6,
1047 fn6: (x: T6) => T7,
1048 fn: (x: T7) => T8): (x: V0) => T8;
1049export function pipe<V0, V1, T1, T2, T3, T4, T5, T6, T7, T8>(
1050 fn0: (x0: V0, x1: V1) => T1,
1051 fn1: (x: T1) => T2,
1052 fn2: (x: T2) => T3,
1053 fn3: (x: T3) => T4,
1054 fn4: (x: T4) => T5,
1055 fn5: (x: T5) => T6,
1056 fn6: (x: T6) => T7,
1057 fn7: (x: T7) => T8): (x0: V0, x1: V1) => T8;
1058export function pipe<V0, V1, V2, T1, T2, T3, T4, T5, T6, T7, T8>(
1059 fn0: (x0: V0, x1: V1, x2: V2) => T1,
1060 fn1: (x: T1) => T2,
1061 fn2: (x: T2) => T3,
1062 fn3: (x: T3) => T4,
1063 fn4: (x: T4) => T5,
1064 fn5: (x: T5) => T6,
1065 fn6: (x: T6) => T7,
1066 fn7: (x: T7) => T8): (x0: V0, x1: V1, x2: V2) => T8;
1067
1068export function pipe<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
1069 fn0: () => T1,
1070 fn1: (x: T1) => T2,
1071 fn2: (x: T2) => T3,
1072 fn3: (x: T3) => T4,
1073 fn4: (x: T4) => T5,
1074 fn5: (x: T5) => T6,
1075 fn6: (x: T6) => T7,
1076 fn7: (x: T7) => T8,
1077 fn8: (x: T8) => T9): () => T9;
1078export function pipe<V0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(
1079 fn0: (x0: V0) => T1,
1080 fn1: (x: T1) => T2,
1081 fn2: (x: T2) => T3,
1082 fn3: (x: T3) => T4,
1083 fn4: (x: T4) => T5,
1084 fn5: (x: T5) => T6,
1085 fn6: (x: T6) => T7,
1086 fn7: (x: T7) => T8,
1087 fn8: (x: T8) => T9): (x0: V0) => T9;
1088export function pipe<V0, V1, T1, T2, T3, T4, T5, T6, T7, T8, T9>(
1089 fn0: (x0: V0, x1: V1) => T1,
1090 fn1: (x: T1) => T2,
1091 fn2: (x: T2) => T3,
1092 fn3: (x: T3) => T4,
1093 fn4: (x: T4) => T5,
1094 fn5: (x: T5) => T6,
1095 fn6: (x: T6) => T7,
1096 fn7: (x: T7) => T8,
1097 fn8: (x: T8) => T9): (x0: V0, x1: V1) => T9;
1098export function pipe<V0, V1, V2, T1, T2, T3, T4, T5, T6, T7, T8, T9>(
1099 fn0: (x0: V0, x1: V1, x2: V2) => T1,
1100 fn1: (x: T1) => T2,
1101 fn2: (x: T2) => T3,
1102 fn3: (x: T3) => T4,
1103 fn4: (x: T4) => T5,
1104 fn5: (x: T5) => T6,
1105 fn6: (x: T6) => T7,
1106 fn7: (x: T7) => T8,
1107 fn8: (x: T8) => T9): (x0: V0, x1: V1, x2: V2) => T9;
1108
1109export function pipe<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
1110 fn0: () => T1,
1111 fn1: (x: T1) => T2,
1112 fn2: (x: T2) => T3,
1113 fn3: (x: T3) => T4,
1114 fn4: (x: T4) => T5,
1115 fn5: (x: T5) => T6,
1116 fn6: (x: T6) => T7,
1117 fn7: (x: T7) => T8,
1118 fn8: (x: T8) => T9,
1119 fn9: (x: T9) => T10): () => T10;
1120export function pipe<V0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
1121 fn0: (x0: V0) => T1,
1122 fn1: (x: T1) => T2,
1123 fn2: (x: T2) => T3,
1124 fn3: (x: T3) => T4,
1125 fn4: (x: T4) => T5,
1126 fn5: (x: T5) => T6,
1127 fn6: (x: T6) => T7,
1128 fn7: (x: T7) => T8,
1129 fn8: (x: T8) => T9,
1130 fn9: (x: T9) => T10): (x0: V0) => T10;
1131export function pipe<V0, V1, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
1132 fn0: (x0: V0, x1: V1) => T1,
1133 fn1: (x: T1) => T2,
1134 fn2: (x: T2) => T3,
1135 fn3: (x: T3) => T4,
1136 fn4: (x: T4) => T5,
1137 fn5: (x: T5) => T6,
1138 fn6: (x: T6) => T7,
1139 fn7: (x: T7) => T8,
1140 fn8: (x: T8) => T9,
1141 fn9: (x: T9) => T10): (x0: V0, x1: V1) => T10;
1142export function pipe<V0, V1, V2, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
1143 fn0: (x0: V0, x1: V1, x2: V2) => T1,
1144 fn1: (x: T1) => T2,
1145 fn2: (x: T2) => T3,
1146 fn3: (x: T3) => T4,
1147 fn4: (x: T4) => T5,
1148 fn5: (x: T5) => T6,
1149 fn6: (x: T6) => T7,
1150 fn7: (x: T7) => T8,
1151 fn8: (x: T8) => T9,
1152 fn9: (x: T9) => T10): (x0: V0, x1: V1, x2: V2) => T10;
1153
1154/**
1155 * It returns list of the values of `property` taken from the all objects inside `list`.
1156 */
1157export function pluck<K extends keyof T, T>(property: K, list: readonly T[]): Array<T[K]>;
1158export function pluck<T>(property: number, list: ReadonlyArray<{ [k: number]: T }>): T[];
1159export function pluck<P extends string>(property: P): <T>(list: ReadonlyArray<Record<P, T>>) => T[];
1160export function pluck(property: number): <T>(list: ReadonlyArray<{ [k: number]: T }>) => T[];
1161
1162/**
1163 * It adds element `x` at the beginning of `list`.
1164 */
1165export function prepend<T>(x: T, input: T[]): T[];
1166export function prepend<T>(x: T): (input: T[]) => T[];
1167
1168export function product(list: readonly number[]): number;
1169
1170/**
1171 * It returns the value of property `propToFind` in `obj`.
1172 *
1173 * If there is no such property, it returns `undefined`.
1174 */
1175export function prop<P extends keyof T, T>(propToFind: P, obj: T): T[P];
1176export function prop<P extends string>(p: P): <T>(propToFind: Record<P, T>) => T;
1177export function prop<P extends string, T>(p: P): (propToFind: Record<P, T>) => T;
1178
1179/**
1180 * It returns true if `obj` has property `propToFind` and its value is equal to `valueToMatch`.
1181 */
1182export function propEq<T, K extends keyof T>(propToFind: K, valueToMatch: T[K], obj: T): boolean;
1183export function propEq<T, K extends keyof T>(propToFind: K, valueToMatch: T[K]): (obj: T) => boolean;
1184export function propEq<T, K extends keyof T>(propToFind: K): {
1185 (valueToMatch: T[K], obj: T): boolean;
1186 (valueToMatch: T[K]): (obj: T) => boolean;
1187};
1188
1189/**
1190 * It returns `true` if `property` of `obj` is from `target` type.
1191 */
1192export function propIs(type: any, name: string, obj: any): boolean;
1193export function propIs(type: any, name: string): (obj: any) => boolean;
1194export function propIs(type: any): {
1195 (name: string, obj: any): boolean;
1196 (name: string): (obj: any) => boolean;
1197};
1198
1199/**
1200 * It returns either `defaultValue` or the value of `property` in `obj`.
1201 */
1202export function propOr<T>(defaultValue: T, property: string, obj: { [key: string]: T}): T;
1203export function propOr<T>(defaultValue: T, property: string): (obj: { [key: string]: T}) => T;
1204export function propOr<T>(defaultValue: T): FunctionToolbelt.Curry<(property: string, obj: { [key: string]: T}) => T>;
1205
1206/**
1207 * It returns list of numbers between `startInclusive` to `endExclusive` markers.
1208 */
1209export function range(startInclusive: number, endExclusive: number): number[];
1210export function range(startInclusive: number): (endExclusive: number) => number[];
1211
1212export function reduce<T, TResult>(reducer: (prev: TResult, current: T, i: number) => TResult, initialValue: TResult, list: readonly T[]): TResult;
1213export function reduce<T, TResult>(reducer: (prev: TResult, current: T) => TResult, initialValue: TResult, list: readonly T[]): TResult;
1214export function reduce<T, TResult>(reducer: (prev: TResult, current: T, i?: number) => TResult): (initialValue: TResult, list: readonly T[]) => TResult;
1215export function reduce<T, TResult>(reducer: (prev: TResult, current: T, i?: number) => TResult, initialValue: TResult): (list: readonly T[]) => TResult;
1216
1217/**
1218 * It has the opposite effect of `R.filter`.
1219 */
1220export function reject<T>(predicate: FilterFunctionArray<T>, list: readonly T[]): T[];
1221export function reject<T>(predicate: FilterFunctionArray<T>): (list: readonly T[]) => T[];
1222export function reject<T>(predicate: FilterFunctionArray<T>, obj: Dictionary<T>): Dictionary<T>;
1223export function reject<T, U>(predicate: FilterFunctionArray<T>): (obj: Dictionary<T>) => Dictionary<T>;
1224
1225export function repeat<T>(x: T): (timesToRepeat: number) => T[];
1226export function repeat<T>(x: T, timesToRepeat: number): T[];
1227
1228/**
1229 * It replaces `strOrRegex` found in `str` with `replacer`.
1230 */
1231export function replace(strOrRegex: RegExp | string, replacer: string, str: string): string;
1232export function replace(strOrRegex: RegExp | string, replacer: string): (str: string) => string;
1233export function replace(strOrRegex: RegExp | string): (replacer: string) => (str: string) => string;
1234
1235/**
1236 * It returns a reversed copy of list or string `input`.
1237 */
1238export function reverse<T>(input: readonly T[]): T[];
1239export function reverse(input: string): string;
1240
1241export function slice(from: number, to: number, input: string): string;
1242export function slice<T>(from: number, to: number, input: readonly T[]): T[];
1243export function slice(from: number, to: number): {
1244 (input: string): string;
1245 <T>(input: readonly T[]): T[];
1246};
1247export function slice(from: number): {
1248 (to: number, input: string): string;
1249 <T>(to: number, input: readonly T[]): T[];
1250};
1251
1252/**
1253 * It returns copy of `list` sorted by `sortFn` function.
1254 */
1255export function sort<T>(sortFn: (a: T, b: T) => number, list: readonly T[]): T[];
1256export function sort<T>(sortFn: (a: T, b: T) => number): (list: readonly T[]) => T[];
1257
1258/**
1259 * It returns copy of `list` sorted by `sortFn` function.
1260 */
1261export function sortBy<T>(sortFn: (a: T) => Ord, list: readonly T[]): T[];
1262export function sortBy(sortFn: (a: any) => Ord): <T>(list: readonly T[]) => T[];
1263
1264/**
1265 * Curried version of `String.prototype.split`
1266 */
1267export function split(separator: string | RegExp): (str: string) => string[];
1268export function split(separator: string | RegExp, str: string): string[];
1269
1270/**
1271 * It splits `input` into slices of `sliceLength`.
1272 */
1273export function splitEvery<T>(sliceLength: number, input: readonly T[]): T[][];
1274export function splitEvery(sliceLength: number, input: string): string[];
1275export function splitEvery(sliceLength: number): {
1276 (input: string): string[];
1277 <T>(input: readonly T[]): T[][];
1278};
1279
1280/**
1281 * Curried version of `String.prototype.startsWith`
1282 */
1283export function startsWith(target: string, str: string): boolean;
1284export function startsWith(target: string): (str: string) => boolean;
1285
1286/**
1287 * Curried version of `x - y`
1288 */
1289export function subtract(x: number, y: number): number;
1290export function subtract(x: number): (y: number) => number;
1291
1292export function sum(list: readonly number[]): number;
1293
1294/**
1295 * It returns a merged list of `x` and `y` with all equal elements removed.
1296 */
1297export function symmetricDifference<T>(x: readonly T[], y: readonly T[]): T[];
1298export function symmetricDifference<T>(x: readonly T[]): <T>(y: readonly T[]) => T[];
1299
1300export function T(): boolean;
1301
1302/**
1303 * It returns all but the first element of `input`.
1304 */
1305export function tail<T>(input: readonly T[]): T[];
1306export function tail(input: string): string;
1307
1308/**
1309 * It returns the first `howMany` elements of `input`.
1310 */
1311export function take<T>(howMany: number, input: readonly T[]): T[];
1312export function take(howMany: number, input: string): string;
1313export function take<T>(howMany: number): {
1314 <T>(input: readonly T[]): T[];
1315 (input: string): string;
1316};
1317
1318/**
1319 * It returns the last `howMany` elements of `input`.
1320 */
1321export function takeLast<T>(howMany: number, input: readonly T[]): T[];
1322export function takeLast(howMany: number, input: string): string;
1323export function takeLast<T>(howMany: number): {
1324 <T>(input: readonly T[]): T[];
1325 (input: string): string;
1326};
1327
1328/**
1329 * It applies function `fn` to input `x` and returns `x`.
1330 *
1331 * One use case is debuging in the middle of `R.compose`.
1332 */
1333export function tap<T>(fn: (x: T) => void, input: T): T;
1334export function tap<T>(fn: (x: T) => void): (input: T) => T;
1335
1336/**
1337 * It determines whether `str` matches `regExpression`.
1338 */
1339export function test(regExpression: RegExp): (str: string) => boolean;
1340export function test(regExpression: RegExp, str: string): boolean;
1341
1342/**
1343 * It returns the result of applying function `fn` over members of range array.
1344 *
1345 * The range array includes numbers between `0` and `howMany`(exclusive).
1346 */
1347export function times<T>(fn: (i: number) => T, howMany: number): T[];
1348export function times<T>(fn: (i: number) => T): (howMany: number) => T[];
1349
1350export function toLower(str: string): string;
1351
1352export function toUpper(str: string): string;
1353
1354/**
1355 * It transforms an object to a list.
1356 */
1357export function toPairs<S>(obj: { [k: string]: S } | { [k: number]: S }): [string, S][];
1358
1359export function toString<T>(x: T): string;
1360
1361export function transpose<T>(list: readonly T[][]): T[][];
1362
1363export function trim(str: string): string;
1364
1365/**
1366 * It returns function that runs `fn` in `try/catch` block. If there was an error, then `fallback` is used to return the result. Note that `fn` can be value or asynchronous/synchronous function(unlike `Ramda` where fallback can only be a synchronous function).
1367 */
1368export function tryCatch<T, U>(
1369 fn: (input: T) => U,
1370 fallback: U
1371): (input: T) => U;
1372export function tryCatch<T, U>(
1373 fn: (input: T) => U,
1374 fallback: (input: T) => U
1375): (input: T) => U;
1376export function tryCatch<T>(
1377 fn: (input: any) => Promise<any>,
1378 fallback: T
1379): (input: any) => Promise<T>;
1380export function tryCatch<T>(
1381 fn: (input: any) => Promise<any>,
1382 fallback: (input: any) => Promise<any>,
1383): (input: any) => Promise<T>;
1384
1385/**
1386 * It accepts any input and it returns its type.
1387 */
1388export function type(x: any): "Object" | "Number" | "Boolean" | "String" | "Null" | "Array" | "Function" | "Undefined" | "Async" | "Promise" | "RegExp" | "NaN";
1389
1390/**
1391 * It takes two lists and return a new list containing a merger of both list with removed duplicates.
1392 *
1393 * `R.equals` is used to compare for duplication, which means that it can be safely used with array of objects.
1394 */
1395export function union<T>(x: readonly T[], y: readonly T[]): T[];
1396export function union<T>(x: readonly T[]): (y: readonly T[]) => T[];
1397
1398/**
1399 * It returns a new array containing only one copy of each element of `list`.
1400 */
1401export function uniq<T>(list: readonly T[]): T[];
1402
1403/**
1404 * It returns a new array containing only one copy of each element in `list` according to boolean returning function `uniqFn`.
1405 */
1406export function uniqWith<T, U>(uniqFn: (x: T, y: T) => boolean, list: readonly T[]): T[];
1407export function uniqWith<T, U>(uniqFn: (x: T, y: T) => boolean): (list: readonly T[]) => T[];
1408
1409/**
1410 * The method returns function that will be called with argument `input`.
1411 *
1412 * If `predicate(input)` returns `false`, then the end result will be the outcome of `whenFalse(input)`.
1413 *
1414 * In the other case, the final output will be the `input` itself.
1415 */
1416export function unless<T, U>(predicate: (x: T) => boolean, whenFalseFn: (x: T) => U, obj: T): U;
1417export function unless<T, U>(predicate: (x: T) => boolean, whenFalseFn: (x: T) => U): (obj: T) => U;
1418
1419/**
1420 * It returns a copy of `list` with updated element at `index` with `newValue`.
1421 */
1422export function update<T>(index: number, newValue: T, list: readonly T[]): T[];
1423export function update<T>(index: number, newValue: T): (list: readonly T[]) => T[];
1424
1425/**
1426 * With correct input, this is nothing more than `Object.values(obj)`. If `obj` is not an object, then it returns an empty array.
1427 */
1428export function values<T extends object, K extends keyof T>(obj: T): T[K][];
1429
1430export function when<T, U>(predicate: (x: T) => boolean, whenTrueFn: (a: T) => U, input: T): U;
1431export function when<T, U>(predicate: (x: T) => boolean, whenTrueFn: (a: T) => U): (input: T) => U;
1432export function when<T, U>(predicate: (x: T) => boolean): FunctionToolbelt.Curry<(whenTrueFn: (a: T) => U, input: T) => U>;
1433
1434/**
1435 * It returns `true` if all each property in `conditions` returns `true` when applied to corresponding property in `input` object.
1436 */
1437export function where<T, U>(conditions: T, input: U): boolean;
1438export function where<T>(conditions: T): <U>(input: U) => boolean;
1439export function where<ObjFunc2, U>(conditions: ObjFunc2, input: U): boolean;
1440export function where<ObjFunc2>(conditions: ObjFunc2): <U>(input: U) => boolean;
1441
1442/**
1443 * It will return `true` if all of `input` object fully or partially include `rule` object.
1444 */
1445export function whereEq<T, U>(condition: T, input: U): boolean;
1446export function whereEq<T>(condition: T): <U>(input: U) => boolean;
1447
1448/**
1449 * It will return a new array, based on all members of `source` list that are not part of `matchAgainst` list.
1450 */
1451export function without<T>(matchAgainst: readonly T[], source: readonly T[]): T[];
1452export function without<T>(matchAgainst: readonly T[]): (source: readonly T[]) => T[];
1453
1454export function xor(x: boolean, y: boolean): boolean;
1455export function xor(y: boolean): (y: boolean) => boolean;
1456
1457/**
1458 * It will return a new array containing tuples of equally positions items from both `x` and `y` lists.
1459 *
1460 * The returned list will be truncated to match the length of the shortest supplied list.
1461 */
1462export function zip<K, V>(x: readonly K[], y: readonly V[]): KeyValuePair<K, V>[];
1463export function zip<K>(x: readonly K[]): <V>(y: readonly V[]) => KeyValuePair<K, V>[];
1464
1465/**
1466 * It will return a new object with keys of `keys` array and values of `values` array.
1467 */
1468export function zipObj<T>(keys: string[], values: T[]): { [index: string]: T };
1469export function zipObj(keys: string[]): <T>(values: T[]) => { [index: string]: T };
1470
1471/**
1472 * It takes list with properties `propsToPick` and returns a list with property values in `obj`.
1473 */
1474export function props<P extends string, T>(propsToPick: P[], obj: Record<P, T>): T[];
1475export function props<P extends string>(propsToPick: P[]): <T>(obj: Record<P, T>) => T[];
1476export function props<P extends string, T>(propsToPick: P[]): (obj: Record<P, T>) => T[];
1477
1478export function zipWith<T, U, TResult>(fn: (x: T, y: U) => TResult, list1: readonly T[], list2: readonly U[]): TResult[];
1479export function zipWith<T, U, TResult>(fn: (x: T, y: U) => TResult, list1: readonly T[]): (list2: readonly U[]) => TResult[];
1480export function zipWith<T, U, TResult>(fn: (x: T, y: U) => TResult): (list1: readonly T[], list2: readonly U[]) => TResult[];
1481
1482/**
1483 * It splits string or array at a given index.
1484 */
1485export function splitAt<T>(index: number, input: T[]): [T[], T[]];
1486export function splitAt(index: number, input: string): [string, string];
1487export function splitAt(index: number): {
1488 <T>(input: T[]): [T[], T[]];
1489 (input: string): [string, string];
1490};
1491
1492/**
1493 * It splits `list` to two arrays according to a `predicate` function.
1494 *
1495 * The first array contains all members of `list` before `predicate` returns `true`.
1496 */
1497export function splitWhen<T, U>(predicate: Predicate<T>, list: U[]): U[][];
1498export function splitWhen<T>(predicate: Predicate<T>): <U>(list: U[]) => U[][];
1499
1500export function takeLastWhile(predicate: (x: string) => boolean, input: string): string;
1501export function takeLastWhile(predicate: (x: string) => boolean): (input: string) => string;
1502export function takeLastWhile<T>(predicate: (x: T) => boolean, input: readonly T[]): T[];
1503export function takeLastWhile<T>(predicate: (x: T) => boolean): <T>(input: readonly T[]) => T[];
1504
1505/**
1506 * It takes object or array of functions as set of rules. These `rules` are applied to the `iterable` input to produce the result.
1507 */
1508export function evolve<T, U>(rules: Array<(x: T) => U>, list: T[]): U[];
1509export function evolve<T, U>(rules: Array<(x: T) => U>) : (list: T[]) => U[];
1510export function evolve<E extends Evolver, V extends Evolvable<E>>(rules: E, obj: V): Evolve<V, E>;
1511export function evolve<E extends Evolver>(rules: E): <V extends Evolvable<E>>(obj: V) => Evolve<V, E>;
1512
1513export function dropLastWhile(predicate: (x: string) => boolean, iterable: string): string;
1514export function dropLastWhile(predicate: (x: string) => boolean): (iterable: string) => string;
1515export function dropLastWhile<T>(predicate: (x: T) => boolean, iterable: readonly T[]): T[];
1516export function dropLastWhile<T>(predicate: (x: T) => boolean): <T>(iterable: readonly T[]) => T[];
1517
1518/**
1519 * It removes any successive duplicates according to `R.equals`.
1520 */
1521export function dropRepeats<T>(list: readonly T[]): T[];
1522
1523export function dropRepeatsWith<T>(predicate: (x: T, y: T) => boolean, list: readonly T[]): T[];
1524export function dropRepeatsWith<T>(predicate: (x: T, y: T) => boolean): (list: readonly T[]) => T[];
1525
1526export function dropWhile(fn: Predicate<string>, iterable: string): string;
1527export function dropWhile(fn: Predicate<string>): (iterable: string) => string;
1528export function dropWhile<T>(fn: Predicate<T>, iterable: readonly T[]): T[];
1529export function dropWhile<T>(fn: Predicate<T>): (iterable: readonly T[]) => T[];
1530
1531export function takeWhile(fn: Predicate<string>, iterable: string): string;
1532export function takeWhile(fn: Predicate<string>): (iterable: string) => string;
1533export function takeWhile<T>(fn: Predicate<T>, iterable: readonly T[]): T[];
1534export function takeWhile<T>(fn: Predicate<T>): (iterable: readonly T[]) => T[];
1535
1536/**
1537 * It returns `true` if property `prop` in `obj1` is equal to property `prop` in `obj2` according to `R.equals`.
1538 */
1539export function eqProps<T, U>(prop: string, obj1: T, obj2: U): boolean;
1540export function eqProps<P extends string>(prop: P): <T, U>(obj1: Record<P, T>, obj2: Record<P, U>) => boolean;
1541export function eqProps<T>(prop: string, obj1: T): <U>(obj2: U) => boolean;