UNPKG

112 kBTypeScriptView Raw
1// Type definitions for ramda 0.26
2// Project: https://ramdajs.com
3// Definitions by: Scott O'Malley <https://github.com/TheHandsomeCoder>
4// Erwin Poeze <https://github.com/donnut>
5// Matt DeKrey <https://github.com/mdekrey>
6// Matt Dziuban <https://github.com/mrdziuban>
7// Stephen King <https://github.com/sbking>
8// Alejandro Fernandez Haro <https://github.com/afharo>
9// Vítor Castro <https://github.com/teves-castro>
10// Jordan Quagliatini <https://github.com/1M0reBug>
11// Simon Højberg <https://github.com/hojberg>
12// Samson Keung <https://github.com/samsonkeung>
13// Angelo Ocana <https://github.com/angeloocana>
14// Rayner Pupo <https://github.com/raynerd>
15// Nikita Moshensky <https://github.com/moshensky>
16// Ethan Resnick <https://github.com/ethanresnick>
17// Tomas Szabo <https://github.com/deftomat>
18// Maciek Blim <https://github.com/blimusiek>
19// Marcin Biernat <https://github.com/biern>
20// Rayhaneh Banyassady <https://github.com/rayhaneh>
21// Ryan McCuaig <https://github.com/rgm>
22// Drew Wyatt <https://github.com/drewwyatt>
23// John Ottenlips <https://github.com/jottenlips>
24// Nitesh Phadatare <https://github.com/minitesh>
25// Krantisinh Deshmukh <https://github.com/krantisinh>
26// Pierre-Antoine Mills <https://github.com/pirix-gh>
27// Brekk Bockrath <https://github.com/brekk>
28// Aram Kharazyan <https://github.com/nemo108>
29// Jituan Lin <https://github.com/jituanlin>
30// Philippe Mills <https://github.com/Philippe-mills>
31// Saul Mirone <https://github.com/Saul-Mirone>
32// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
33// TypeScript Version: 3.5
34
35import * as _ from "ts-toolbelt";
36import {
37 Arity0Fn,
38 Arity1Fn,
39 Arity2Fn,
40 AssocPartialOne,
41 ComposeWithFns,
42 Dictionary,
43 Evolvable,
44 Evolve,
45 Evolver,
46 Filter,
47 Functor,
48 KeyValuePair,
49 Lens,
50 Merge,
51 MergeAll,
52 ObjPred,
53 Ord,
54 Path,
55 Placeholder,
56 Pred,
57 PipeWithFns,
58 Reduced,
59 SafePred,
60 ValueOfRecord,
61} from "./tools";
62
63export * from './tools';
64
65/**
66 * Placeholder. When used with functions like curry, or op, the second argument is applied to the second
67 * position, and it returns a function waiting for its first argument.
68 */
69export const __: Placeholder; /* This is used in examples throughout the docs, but I it only seems to be directly explained here: https://ramdajs.com/0.9/docs/#op */
70
71/**
72 * Adds two numbers (or strings). Equivalent to a + b but curried.
73 */
74export function add(a: number, b: number): number;
75export function add(a: string, b: string): string;
76export function add(a: number): (b: number) => number;
77export function add(a: string): (b: string) => string;
78
79/**
80 * Creates a new list iteration function from an existing one by adding two new parameters to its callback
81 * function: the current index, and the entire list.
82 */
83export function addIndex<T, U>(fn: (f: (item: T) => U, list: readonly T[]) => U[]): _.F.Curry<(a: (item: T, idx: number, list?: T[]) => U, b: readonly T[]) => U[]>;
84/* Special case for forEach */
85export function addIndex<T>(fn: (f: (item: T) => void, list: readonly T[]) => T[]): _.F.Curry<(a: (item: T, idx: number, list?: T[]) => void, b: readonly T[]) => T[]>;
86/* Special case for reduce */
87export function addIndex<T, U>(fn: (f: (acc: U, item: T) => U, aci: U, list: readonly T[]) => U): _.F.Curry<(a: (acc: U, item: T, idx: number, list?: T[]) => U, b: U, c: readonly T[]) => U>;
88
89/**
90 * Applies a function to the value at the given index of an array, returning a new copy of the array with the
91 * element at the given index replaced with the result of the function application.
92 */
93export function adjust<T>(index: number, fn: (a: T) => T, list: readonly T[]): T[];
94export function adjust<T>(index: number, fn: (a: T) => T): (list: readonly T[]) => T[];
95
96/**
97 * Returns true if all elements of the list match the predicate, false if there are any that don't.
98 */
99export function all<T>(fn: (a: T) => boolean, list: readonly T[]): boolean;
100export function all<T>(fn: (a: T) => boolean): (list: readonly T[]) => boolean;
101
102/**
103 * Given a list of predicates, returns a new predicate that will be true exactly when all of them are.
104 */
105export function allPass(preds: readonly Pred[]): Pred;
106
107/**
108 * Returns a function that always returns the given value.
109 */
110export function always<T>(val: T): () => T;
111
112/**
113 * A function that returns the first argument if it's falsy otherwise the second argument. Note that this is
114 * NOT short-circuited, meaning that if expressions are passed they are both evaluated.
115 */
116export function and<T extends { and?: ((...a: readonly any[]) => any); } | number | boolean | string | null>(fn1: T, val2: any): boolean;
117export function and<T extends { and?: ((...a: readonly any[]) => any); } | number | boolean | string | null>(fn1: T): (val2: any) => boolean;
118
119/**
120 * Returns true if at least one of elements of the list match the predicate, false otherwise.
121 */
122export function any<T>(fn: (a: T) => boolean, list: readonly T[]): boolean;
123export function any<T>(fn: (a: T) => boolean): (list: readonly T[]) => boolean;
124
125/**
126 * Given a list of predicates returns a new predicate that will be true exactly when any one of them is.
127 */
128export function anyPass<T>(preds: Array<SafePred<T>>): SafePred<T>;
129
130/**
131 * ap applies a list of functions to a list of values.
132 */
133export function ap<T, U>(fns: Array<((a: T) => U)>, vs: readonly T[]): U[];
134export function ap<T, U>(fns: Array<((a: T) => U)>): (vs: readonly T[]) => U[];
135export function ap<X0, X1, R>(
136 fn: (x1: X1, x0: X0) => R,
137 fn1: (x1: X1) => X0
138): (x1: X1) => R;
139
140/**
141 * Returns a new list, composed of n-tuples of consecutive elements If n is greater than the length of the list,
142 * an empty list is returned.
143 */
144export function aperture<T>(n: 1, list: readonly T[]): Array<[T]>;
145export function aperture<T>(n: 2, list: readonly T[]): Array<[T, T]>;
146export function aperture<T>(n: 3, list: readonly T[]): Array<[T, T, T]>;
147export function aperture<T>(n: 4, list: readonly T[]): Array<[T, T, T, T]>;
148export function aperture<T>(n: 5, list: readonly T[]): Array<[T, T, T, T, T]>;
149export function aperture<T>(n: 6, list: readonly T[]): Array<[T, T, T, T, T, T]>;
150export function aperture<T>(n: 7, list: readonly T[]): Array<[T, T, T, T, T, T, T]>;
151export function aperture<T>(n: 8, list: readonly T[]): Array<[T, T, T, T, T, T, T, T]>;
152export function aperture<T>(n: 9, list: readonly T[]): Array<[T, T, T, T, T, T, T, T, T]>;
153export function aperture<T>(n: 10, list: readonly T[]): Array<[T, T, T, T, T, T, T, T, T, T]>;
154export function aperture<T>(n: number, list: readonly T[]): T[][];
155export function aperture(n: number): <T>(list: readonly T[]) => T[][];
156
157/**
158 * Returns a new list containing the contents of the given list, followed by the given element.
159 */
160export function append<T>(el: T, list: readonly T[]): T[];
161export function append<T>(el: T): <T>(list: readonly T[]) => T[];
162
163/**
164 * Applies function fn to the argument list args. This is useful for creating a fixed-arity function from
165 * a variadic function. fn should be a bound function if context is significant.
166 */
167export function apply<T, U, TResult>(fn: (arg0: T, ...args: readonly T[]) => TResult, args: readonly U[]): TResult;
168export function apply<T, TResult>(fn: (arg0: T, ...args: readonly T[]) => TResult): <U>(args: readonly U[]) => TResult;
169
170/**
171 * Given a spec object recursively mapping properties to functions, creates a function producing an object
172 * of the same structure, by mapping each property to the result of calling its associated function with
173 * the supplied arguments.
174 */
175export function applySpec<Obj extends Record<string, (...args: readonly any[]) => any>>(
176 obj: Obj
177): (
178 ...args: Parameters<ValueOfRecord<Obj>>
179) => { [Key in keyof Obj]: ReturnType<Obj[Key]> };
180export function applySpec<T>(obj: any): (...args: readonly any[]) => T;
181
182/**
183 * Takes a value and applies a function to it.
184 * This function is also known as the thrush combinator.
185 */
186export function applyTo<T, U>(el: T, fn: (t: T) => U): U;
187export function applyTo<T>(el: T): <U>(fn: (t: T) => U) => U;
188
189/**
190 * Makes an ascending comparator function out of a function that returns a value that can be compared with < and >.
191 */
192export function ascend<T>(fn: (obj: T) => any, a: T, b: T): number;
193export function ascend<T>(fn: (obj: T) => any): (a: T, b: T) => number;
194
195/**
196 * Makes a shallow clone of an object, setting or overriding the specified property with the given value.
197 */
198export function assoc<T, U>(__: Placeholder, val: T, obj: U): <K extends string>(prop: K) => Record<K, T> & U;
199export function assoc<U, K extends string>(prop: K, __: Placeholder, obj: U): <T>(val: T) => Record<K, T> & U;
200export function assoc<T, U, K extends string>(prop: K, val: T, obj: U): Record<K, T> & U;
201export function assoc<T, K extends string>(prop: K, val: T): <U>(obj: U) => Record<K, T> & U;
202export function assoc<K extends string>(prop: K): AssocPartialOne<K>;
203
204/**
205 * Makes a shallow clone of an object, setting or overriding the nodes required to create the given path, and
206 * placing the specific value at the tail end of that path.
207 */
208export function assocPath<T, U>(__: Placeholder, val: T, obj: U): (path: Path) => U;
209export function assocPath<T, U>(path: Path, __: Placeholder, obj: U): (val: T) => U;
210export function assocPath<T, U>(path: Path, val: T, obj: U): U;
211export function assocPath<T, U>(path: Path, val: T): (obj: U) => U;
212export function assocPath<T, U>(path: Path): _.F.Curry<(a: T, b: U) => U>;
213
214/**
215 * Wraps a function of any arity (including nullary) in a function that accepts exactly 2
216 * parameters. Any extraneous parameters will not be passed to the supplied function.
217 */
218export function binary(fn: (...args: readonly any[]) => any): (...a: readonly any[]) => any;
219
220/**
221 * Creates a function that is bound to a context. Note: R.bind does not provide the additional argument-binding
222 * capabilities of Function.prototype.bind.
223 */
224export function bind<T>(fn: (...args: readonly any[]) => any, thisObj: T): (...args: readonly any[]) => any;
225
226/**
227 * A function wrapping calls to the two functions in an && operation, returning the result of the first function
228 * if it is false-y and the result of the second function otherwise. Note that this is short-circuited, meaning
229 * that the second function will not be invoked if the first returns a false-y value.
230 */
231export function both(pred1: Pred, pred2: Pred): Pred;
232export function both(pred1: Pred): (pred2: Pred) => Pred;
233
234/**
235 * Returns the result of calling its first argument with the remaining arguments. This is occasionally useful
236 * as a converging function for R.converge: the left branch can produce a function while the right branch
237 * produces a value to be passed to that function as an argument.
238 */
239export function call(fn: (...args: readonly any[]) => (...args: readonly any[]) => any, ...args: readonly any[]): any;
240
241/**
242 * `chain` maps a function over a list and concatenates the results.
243 * This implementation is compatible with the Fantasy-land Chain spec
244 */
245export function chain<T, U>(fn: (n: T) => readonly U[], list: readonly T[]): U[];
246export function chain<T, U>(fn: (n: T) => readonly U[]): (list: readonly T[]) => U[];
247export function chain<X0, X1, R>(fn: (x0: X0, x1: X1) => R, fn1: (x1: X1) => X0): (x1: X1) => R;
248
249/**
250 * Restricts a number to be within a range.
251 * Also works for other ordered types such as Strings and Date
252 */
253export function clamp<T>(min: T, max: T, value: T): T;
254export function clamp<T>(min: T, max: T): (value: T) => T;
255export function clamp<T>(min: T): (max: T, value: T) => T;
256export function clamp<T>(min: T): (max: T) => (value: T) => T;
257
258/**
259 * Creates a deep copy of the value which may contain (nested) Arrays and Objects, Numbers, Strings, Booleans and Dates.
260 */
261export function clone<T>(value: T): T;
262export function clone<T>(value: readonly T[]): T[];
263
264/**
265 * Makes a comparator function out of a function that reports whether the first element is less than the second.
266 */
267// comparator(pred: (a: any, b: any) => boolean): (x: number, y: number) => number;
268export function comparator<T>(pred: (a: T, b: T) => boolean): (x: T, y: T) => number;
269
270/**
271 * Takes a function f and returns a function g such that:
272 * - applying g to zero or more arguments will give true if applying the same arguments to f gives
273 * a logical false value; and
274 * - applying g to zero or more arguments will give false if applying the same arguments to f gives
275 * a logical true value.
276 */
277export function complement(pred: (...args: readonly any[]) => boolean): (...args: readonly any[]) => boolean;
278
279/**
280 * Performs right-to-left function composition. The rightmost function may have any arity; the remaining
281 * functions must be unary.
282 */
283// generic rest parameters in TS 3.0 allows writing a single variant for any number of Vx
284// compose<V extends any[], T1>(fn0: (...args: V) => T1): (...args: V) => T1;
285// compose<V extends any[], T1, T2>(fn1: (x: T1) => T2, fn0: (...args: V) => T1): (...args: V) => T2;
286// but requiring TS>=3.0 sounds like a breaking change, so just leaving a comment for the future
287// tslint:disable:max-line-length
288export function compose<T1>(fn0: () => T1): () => T1;
289export function compose<V0, T1>(fn0: (x0: V0) => T1): (x0: V0) => T1;
290export function compose<V0, V1, T1>(fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T1;
291export function compose<V0, V1, V2, T1>(fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T1;
292
293export function compose<T1, T2>(fn1: (x: T1) => T2, fn0: () => T1): () => T2;
294export function compose<V0, T1, T2>(fn1: (x: T1) => T2, fn0: (x0: V0) => T1): (x0: V0) => T2;
295export function compose<V0, V1, T1, T2>(fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T2;
296export 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;
297
298export function compose<T1, T2, T3>(fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: () => T1): () => T3;
299export function compose<V0, T1, T2, T3>(fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x: V0) => T1): (x: V0) => T3;
300export 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;
301export 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;
302
303export function compose<T1, T2, T3, T4>(fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: () => T1): () => T4;
304export 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;
305export 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;
306export 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;
307
308export 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;
309export 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;
310export 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;
311export 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;
312
313export 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;
314export 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;
315export function compose<V0, V1, 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: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T6;
316export function compose<V0, V1, V2, 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: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T6;
317// tslint:enable:max-line-length
318
319/**
320 * Returns the right-to-left Kleisli composition of the provided functions, each of which must return a value of a type supported by chain.
321 * The typings only support arrays for now.
322 * All functions must be unary.
323 * R.composeK(h, g, f) is equivalent to R.compose(R.chain(h), R.chain(g), f).
324 *
325 * @deprecated since 0.26 in favor of composeWith(chain)
326 */
327// tslint:disable:max-line-length
328export function composeK<V0, T1>(fn0: (x0: V0) => T1[]): (x0: V0) => T1[];
329export function composeK<V0, T1, T2>(fn1: (x: T1) => T2[], fn0: (x0: V0) => T1[]): (x0: V0) => T2[];
330export function composeK<V0, T1, T2, T3>(fn2: (x: T2) => T3[], fn1: (x: T1) => T2[], fn0: (x: V0) => T1[]): (x: V0) => T3[];
331export function composeK<V0, T1, T2, T3, T4>(fn3: (x: T3) => T4[], fn2: (x: T2) => T3[], fn1: (x: T1) => T2[], fn0: (x: V0) => T1[]): (x: V0) => T4[];
332export function composeK<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[];
333export function composeK<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[];
334// tslint:enable:max-line-length
335
336/**
337 * Performs right-to-left composition of one or more Promise-returning functions.
338 * All functions must be unary.
339 *
340 * @deprecated since 0.26 in favor of composeWith(then)
341 */
342// tslint:disable:max-line-length
343export function composeP<V0, T1>(fn0: (x0: V0) => Promise<T1>): (x0: V0) => Promise<T1>;
344export function composeP<V0, T1, T2>(fn1: (x: T1) => Promise<T2>, fn0: (x0: V0) => Promise<T1>): (x0: V0) => Promise<T2>;
345export function composeP<V0, T1, T2, T3>(fn2: (x: T2) => Promise<T3>, fn1: (x: T1) => Promise<T2>, fn0: (x: V0) => Promise<T1>): (x: V0) => Promise<T3>;
346export function composeP<V0, T1, T2, T3, T4>(fn3: (x: T3) => Promise<T4>, fn2: (x: T2) => Promise<T3>, fn1: (x: T1) => Promise<T2>, fn0: (x: V0) => Promise<T1>): (x: V0) => Promise<T4>;
347export function composeP<V0, T1, T2, T3, T4, T5>(fn4: (x: T4) => Promise<T5>, fn3: (x: T3) => Promise<T4>, fn2: (x: T2) => Promise<T3>, fn1: (x: T1) => Promise<T2>, fn0: (x: V0) => Promise<T1>): (x: V0) => Promise<T5>;
348export function composeP<V0, T1, T2, T3, T4, T5, T6>(fn5: (x: T5) => Promise<T6>, fn4: (x: T4) => Promise<T5>, fn3: (x: T3) => Promise<T4>, fn2: (x: T2) => Promise<T3>, fn1: (x: T1) => Promise<T2>, fn0: (x: V0) => Promise<T1>): (x: V0) => Promise<T6>;
349// tslint:enable:max-line-length
350
351/**
352 * Performs right-to-left function composition using transforming function.
353 * With the current typings, all functions must be unary.
354 */
355export function composeWith<V0, T>(composer: (a: any) => any, fns: ComposeWithFns<V0, T>): (x0: V0) => T;
356export function composeWith(composer: (a: any) => any): <V0, T>(fns: ComposeWithFns<V0, T>) => (x: V0) => T;
357
358/**
359 * Returns a new list consisting of the elements of the first list followed by the elements
360 * of the second.
361 */
362export function concat<T>(placeholder: Placeholder): (list2: readonly T[], list1: readonly T[]) => T[];
363export function concat<T>(placeholder: Placeholder, list2: readonly T[]): (list1: readonly T[]) => T[];
364export function concat<T>(list1: readonly T[], list2: readonly T[]): T[];
365export function concat<T>(list1: readonly T[]): (list2: readonly T[]) => T[];
366export function concat(list1: string, list2: string): string;
367export function concat(list1: string): (list2: string) => string;
368
369/**
370 * Returns a function, fn, which encapsulates if/else-if/else logic. R.cond takes a list of [predicate, transform] pairs.
371 * All of the arguments to fn are applied to each of the predicates in turn until one returns a "truthy" value, at which
372 * point fn returns the result of applying its arguments to the corresponding transformer. If none of the predicates
373 * matches, fn returns undefined.
374 */
375export function cond(fns: Array<[Pred, (...a: readonly any[]) => any]>): (...a: readonly any[]) => any;
376export function cond<A, B>(fns: Array<[SafePred<A>, (...a: readonly A[]) => B]>): (...a: readonly A[]) => B;
377
378/**
379 * Wraps a constructor function inside a curried function that can be called with the same arguments and returns the same type.
380 */
381export function construct<A extends any[], T>(constructor: { new(...a: A): T } | ((...a: A) => T)): (...a: A) => T;
382
383/**
384 * Wraps a constructor function inside a curried function that can be called with the same arguments and returns the same type.
385 * The arity of the function returned is specified to allow using variadic constructor functions.
386 */
387export function constructN<A extends any[], T>(n: number, constructor: { new(...a: A): T } | ((...a: A) => T)): (...a: Partial<A>) => T;
388
389/**
390 * Returns `true` if the specified item is somewhere in the list, `false` otherwise.
391 * Equivalent to `indexOf(a)(list) > -1`. Uses strict (`===`) equality checking.
392 *
393 * @deprecated since 0.26 in favor of includes
394 */
395export function contains(__: Placeholder, list: string): (a: string) => boolean;
396export function contains<T>(__: Placeholder, list: readonly T[]): (a: T) => boolean;
397export function contains(__: Placeholder): (list: string, a: string) => boolean;
398export function contains<T>(__: Placeholder): (list: readonly T[], a: T) => boolean;
399export function contains(a: string, list: string): boolean;
400export function contains<T>(a: T, list: readonly T[]): boolean;
401export function contains(a: string): (list: string) => boolean;
402export function contains<T>(a: T): (list: readonly T[]) => boolean;
403
404/**
405 * Accepts a converging function and a list of branching functions and returns a new
406 * function. When invoked, this new function is applied to some arguments, each branching
407 * function is applied to those same arguments. The results of each branching function
408 * are passed as arguments to the converging function to produce the return value.
409 */
410export function converge(after: ((...a: readonly any[]) => any), fns: Array<((...a: readonly any[]) => any)>): (...a: readonly any[]) => any;
411
412/**
413 * Counts the elements of a list according to how many match each value
414 * of a key generated by the supplied function. Returns an object
415 * mapping the keys produced by `fn` to the number of occurrences in
416 * the list. Note that all keys are coerced to strings because of how
417 * JavaScript objects work.
418 */
419export function countBy<T>(fn: (a: T) => string | number, list: readonly T[]): { [index: string]: number };
420export function countBy<T>(fn: (a: T) => string | number): (list: readonly T[]) => { [index: string]: number };
421
422/**
423 * Returns a curried equivalent of the provided function. The curried function has two unusual capabilities.
424 * First, its arguments needn't be provided one at a time.
425 */
426export function curry<F extends (...args: any) => any>(f: F): _.F.Curry<F>;
427
428/**
429 * Returns a curried equivalent of the provided function, with the specified arity. The curried function has
430 * two unusual capabilities. First, its arguments needn't be provided one at a time.
431 */
432export function curryN(length: number, fn: (...args: readonly any[]) => any): (...a: readonly any[]) => any;
433
434/**
435 * Decrements its argument.
436 */
437export function dec(n: number): number;
438
439/**
440 * Returns the second argument if it is not null or undefined. If it is null or undefined, the
441 * first (default) argument is returned.
442 */
443export function defaultTo<T, U>(a: T, b: U | null | undefined): T | U;
444export function defaultTo<T>(a: T): <U>(b: U | null | undefined) => T | U;
445
446/**
447 * Makes a descending comparator function out of a function that returns a value that can be compared with < and >.
448 */
449export function descend<T>(fn: (obj: T) => any, a: T, b: T): number;
450export function descend<T>(fn: (obj: T) => any): (a: T, b: T) => number;
451
452/**
453 * Finds the set (i.e. no duplicates) of all elements in the first list not contained in the second list.
454 */
455export function difference<T>(list1: readonly T[], list2: readonly T[]): T[];
456export function difference<T>(list1: readonly T[]): (list2: readonly T[]) => T[];
457
458/**
459 * Finds the set (i.e. no duplicates) of all elements in the first list not contained in the second list.
460 * Duplication is determined according to the value returned by applying the supplied predicate to two list
461 * elements.
462 */
463export function differenceWith<T1, T2>(pred: (a: T1, b: T2) => boolean, list1: readonly T1[], list2: readonly T2[]): T1[];
464export function differenceWith<T1, T2>(pred: (a: T1, b: T2) => boolean): (list1: readonly T1[], list2: readonly T2[]) => T1[];
465export function differenceWith<T1, T2>(pred: (a: T1, b: T2) => boolean, list1: readonly T1[]): (list2: readonly T2[]) => T1[];
466
467/*
468 * Returns a new object that does not contain a prop property.
469 */
470// It seems impossible to infer the return type, so this may to be specified explicitely
471export function dissoc<T>(prop: string, obj: any): T;
472export function dissoc(prop: string): <U>(obj: any) => U;
473
474/**
475 * Makes a shallow clone of an object, omitting the property at the given path.
476 */
477export function dissocPath<T>(path: Path, obj: any): T;
478export function dissocPath<T>(path: Path): (obj: any) => T;
479
480/**
481 * Divides two numbers. Equivalent to a / b.
482 */
483export function divide(__: Placeholder, b: number): (a: number) => number;
484export function divide(__: Placeholder): (b: number, a: number) => number;
485export function divide(a: number, b: number): number;
486export function divide(a: number): (b: number) => number;
487
488/**
489 * Returns a new list containing all but the first n elements of the given list.
490 */
491export function drop<T>(n: number, xs: readonly T[]): T[];
492export function drop(n: number, xs: string): string;
493export function drop<T>(n: number): {
494 (xs: string): string;
495 (xs: readonly T[]): T[];
496};
497
498/**
499 * Returns a list containing all but the last n elements of the given list.
500 */
501export function dropLast<T>(n: number, xs: readonly T[]): T[];
502export function dropLast(n: number, xs: string): string;
503export function dropLast<T>(n: number): {
504 (xs: readonly T[]): T[];
505 (xs: string): string;
506};
507
508/**
509 * Returns a new list containing all but last then elements of a given list, passing each value from the
510 * right to the supplied predicate function, skipping elements while the predicate function returns true.
511 */
512export function dropLastWhile<T>(fn: (a: T) => boolean, list: readonly T[]): T[];
513export function dropLastWhile<T>(fn: (a: T) => boolean): (list: readonly T[]) => T[];
514
515/**
516 * Returns a new list without any consecutively repeating elements. R.equals is used to determine equality.
517 */
518export function dropRepeats<T>(list: readonly T[]): T[];
519
520/**
521 * Returns a new list without any consecutively repeating elements.
522 * Equality is determined by applying the supplied predicate to each pair of consecutive elements.
523 * The first element in a series of equal elements will be preserved.
524 */
525export function dropRepeatsWith<T>(predicate: (left: T, right: T) => boolean, list: readonly T[]): T[];
526export function dropRepeatsWith<T>(predicate: (left: T, right: T) => boolean): (list: readonly T[]) => T[];
527
528/**
529 * Returns a new list containing the last n elements of a given list, passing each value to the supplied
530 * predicate function, skipping elements while the predicate function returns true.
531 */
532export function dropWhile<T>(fn: (a: T) => boolean, list: readonly T[]): T[];
533export function dropWhile<T>(fn: (a: T) => boolean): (list: readonly T[]) => T[];
534
535/**
536 * A function wrapping calls to the two functions in an || operation, returning the result of the first
537 * function if it is truth-y and the result of the second function otherwise. Note that this is
538 * short-circuited, meaning that the second function will not be invoked if the first returns a truth-y value.
539 */
540export function either(pred1: Pred, pred2: Pred): Pred;
541export function either(pred1: Pred): (pred2: Pred) => Pred;
542
543/**
544 * Returns the empty value of its argument's type. Ramda defines the empty value of Array ([]), Object ({}),
545 * String (''), and Arguments. Other types are supported if they define <Type>.empty and/or <Type>.prototype.empty.
546 * Dispatches to the empty method of the first argument, if present.
547 */
548export function empty<T>(x: T): T;
549
550/**
551 * Checks if a list ends with the provided values
552 */
553export function endsWith(a: string, list: string): boolean;
554export function endsWith(a: string): (list: string) => boolean;
555export function endsWith<T>(a: T | readonly T[], list: readonly T[]): boolean;
556export function endsWith<T>(a: T | readonly T[]): (list: readonly T[]) => boolean;
557
558/**
559 * Takes a function and two values in its domain and returns true if the values map to the same value in the
560 * codomain; false otherwise.
561 */
562export function eqBy<T, U = T>(fn: (a: T) => U, a: T, b: T): boolean;
563export function eqBy<T, U = T>(fn: (a: T) => U, a: T): (b: T) => boolean;
564export function eqBy<T, U = T>(fn: (a: T) => U): _.F.Curry<(a: T, b: T) => boolean>;
565
566/**
567 * Reports whether two functions have the same value for the specified property.
568 */
569export function eqProps<T, U>(prop: string, obj1: T, obj2: U): boolean;
570export function eqProps<P extends string>(prop: P): <T, U>(obj1: Record<P, T>, obj2: Record<P, U>) => boolean;
571export function eqProps<T>(prop: string, obj1: T): <U>(obj2: U) => boolean;
572
573/**
574 * Returns true if its arguments are equivalent, false otherwise. Dispatches to an equals method if present.
575 * Handles cyclical data structures.
576 */
577export function equals<T>(a: T, b: T): boolean;
578export function equals<T>(a: T): (b: T) => boolean;
579
580/**
581 * Creates a new object by evolving a shallow copy of object, according to the transformation functions.
582 */
583export function evolve<E extends Evolver, V extends Evolvable<E>>(transformations: E, obj: V): Evolve<V, E>;
584export function evolve<E extends Evolver>(transformations: E): <V extends Evolvable<E>>(obj: V) => Evolve<V, E>;
585
586/*
587* A function that always returns false. Any passed in parameters are ignored.
588*/
589export function F(): boolean;
590
591/**
592 * Returns a new list containing only those items that match a given predicate function. The predicate function is passed one argument: (value).
593 */
594export const filter: Filter;
595
596/**
597 * Returns the first element of the list which matches the predicate, or `undefined` if no
598 * element matches.
599 */
600export function find<T>(fn: (a: T) => boolean, list: readonly T[]): T | undefined;
601export function find<T>(fn: (a: T) => boolean): (list: readonly T[]) => T | undefined;
602
603/**
604 * Returns the index of the first element of the list which matches the predicate, or `-1`
605 * if no element matches.
606 */
607export function findIndex<T>(fn: (a: T) => boolean, list: readonly T[]): number;
608export function findIndex<T>(fn: (a: T) => boolean): (list: readonly T[]) => number;
609
610/**
611 * Returns the last element of the list which matches the predicate, or `undefined` if no
612 * element matches.
613 */
614export function findLast<T>(fn: (a: T) => boolean, list: readonly T[]): T | undefined;
615export function findLast<T>(fn: (a: T) => boolean): (list: readonly T[]) => T | undefined;
616
617/**
618 * Returns the index of the last element of the list which matches the predicate, or
619 * `-1` if no element matches.
620 */
621export function findLastIndex<T>(fn: (a: T) => boolean, list: readonly T[]): number;
622export function findLastIndex<T>(fn: (a: T) => boolean): (list: readonly T[]) => number;
623
624/**
625 * Returns a new list by pulling every item out of it (and all its sub-arrays) and putting
626 * them in a new array, depth-first.
627 */
628export function flatten<T extends readonly any[]>(list: T): _.T.Flatten<T>;
629
630/**
631 * Returns a new function much like the supplied one, except that the first two arguments'
632 * order is reversed.
633 */
634export function flip<T, U, TResult>(fn: (arg0: T, arg1: U) => TResult): (arg1: U, arg0?: T) => TResult;
635export function flip<F extends (...args: any) => any, P extends _.F.Parameters<F>>(fn: F): _.F.Curry<(...args: _.T.Merge<[P[1], P[0]], P>) => _.F.Return<F>>;
636
637/**
638 * Iterate over an input list, calling a provided function fn for each element in the list.
639 */
640export function forEach<T>(fn: (x: T) => void, list: readonly T[]): T[];
641export function forEach<T>(fn: (x: T) => void): (list: readonly T[]) => T[];
642export function forEach<T>(fn: (x: T) => void, list: readonly T[]): T[];
643export function forEach<T>(fn: (x: T) => void): (list: readonly T[]) => T[];
644
645/**
646 * Iterate over an input object, calling a provided function fn for each key and value in the object.
647 */
648export function forEachObjIndexed<T>(fn: (value: T[keyof T], key: keyof T, obj: T) => void, obj: T): T;
649export function forEachObjIndexed<T>(fn: (value: T[keyof T], key: keyof T, obj: T) => void): (obj: T) => T;
650
651/**
652 * Creates a new object out of a list key-value pairs.
653 */
654export function fromPairs<V>(pairs: Array<KeyValuePair<string, V>>): { [index: string]: V };
655export function fromPairs<V>(pairs: Array<KeyValuePair<number, V>>): { [index: number]: V };
656
657/**
658 * Splits a list into sublists stored in an object, based on the result of
659 * calling a String-returning function
660 * on each element, and grouping the results according to values returned.
661 */
662export function groupBy<T>(fn: (a: T) => string, list: readonly T[]): { [index: string]: T[] };
663export function groupBy<T>(fn: (a: T) => string): (list: readonly T[]) => { [index: string]: T[] };
664
665/**
666 * Takes a list and returns a list of lists where each sublist's elements are all "equal" according to the provided equality function
667 */
668export function groupWith<T>(fn: (x: T, y: T) => boolean): (list: readonly T[]) => T[][];
669export function groupWith<T>(fn: (x: T, y: T) => boolean, list: readonly T[]): T[][];
670export function groupWith<T>(fn: (x: T, y: T) => boolean, list: string): string[];
671
672/**
673 * Returns true if the first parameter is greater than the second.
674 */
675export function gt(__: Placeholder, b: number): (a: number) => boolean;
676export function gt(__: Placeholder): (b: number, a: number) => boolean;
677export function gt(a: number, b: number): boolean;
678export function gt(a: number): (b: number) => boolean;
679
680/**
681 * Returns true if the first parameter is greater than or equal to the second.
682 */
683export function gte(__: Placeholder, b: number): (a: number) => boolean;
684export function gte(__: Placeholder): (b: number, a: number) => boolean;
685export function gte(a: number, b: number): boolean;
686export function gte(a: number): (b: number) => boolean;
687
688/**
689 * Returns whether or not an object has an own property with the specified name.
690 */
691export function has<T>(__: Placeholder, obj: T): (s: string) => boolean;
692export function has<T>(__: Placeholder): (obj: T, s: string) => boolean;
693export function has<T>(s: string, obj: T): boolean;
694export function has(s: string): <T>(obj: T) => boolean;
695
696/**
697 * Returns whether or not an object or its prototype chain has a property with the specified name
698 */
699export function hasIn<T>(s: string, obj: T): boolean;
700export function hasIn(s: string): <T>(obj: T) => boolean;
701
702/**
703 * Returns whether or not a path exists in an object. Only the object's own properties are checked.
704 */
705export function hasPath<T>(list: readonly string[], obj: T): boolean;
706export function hasPath(list: readonly string[]): <T>(obj: T) => boolean;
707
708/**
709 * Returns the first element in a list.
710 * In some libraries this function is named `first`.
711 */
712export function head(str: string): string;
713export function head(list: readonly []): undefined;
714export function head<T extends any>(list: readonly T[]): T | undefined;
715
716/**
717 * Returns true if its arguments are identical, false otherwise. Values are identical if they reference the
718 * same memory. NaN is identical to NaN; 0 and -0 are not identical.
719 */
720export function identical<T>(a: T, b: T): boolean;
721export function identical<T>(a: T): (b: T) => boolean;
722
723/**
724 * A function that does nothing but return the parameter supplied to it. Good as a default
725 * or placeholder function.
726 */
727export function identity<T>(a: T): T;
728
729/**
730 * Creates a function that will process either the onTrue or the onFalse function depending upon the result
731 * of the condition predicate.
732 */
733export function ifElse(fn: Pred, onTrue: Arity1Fn, onFalse: Arity1Fn): Arity1Fn;
734export function ifElse(fn: Pred, onTrue: Arity2Fn, onFalse: Arity2Fn): Arity2Fn;
735
736/**
737 * Increments its argument.
738 */
739export function inc(n: number): number;
740
741/**
742 * Given a target, this function checks a list for the target and returns a boolean.
743 * Given a string, this function checks for the string in another string or list and returns
744 * a boolean.
745 */
746export function includes(s: string, list: readonly string[] | string): boolean;
747export function includes(s: string): (list: readonly string[] | string) => boolean;
748export function includes<T>(target: T, list: readonly T[]): boolean;
749export function includes<T>(target: T): (list: readonly T[]) => boolean;
750
751/**
752 * Given a function that generates a key, turns a list of objects into an object indexing the objects
753 * by the given key.
754 */
755export function indexBy<T>(fn: (a: T) => string, list: readonly T[]): { [key: string]: T };
756export function indexBy<T>(fn: (a: T) => string): (list: readonly T[]) => { [key: string]: T };
757
758/**
759 * Returns the position of the first occurrence of an item in an array
760 * (by strict equality),
761 * or -1 if the item is not included in the array.
762 */
763export function indexOf<T>(target: T, list: readonly T[]): number;
764export function indexOf<T>(target: T): (list: readonly T[]) => number;
765
766/**
767 * Returns all but the last element of a list or string.
768 */
769export function init<T>(list: readonly T[]): T[];
770export function init(list: string): string;
771
772/**
773 * Takes a predicate `pred`, a list `xs`, and a list `ys`, and returns a list
774 * `xs'` comprising each of the elements of `xs` which is equal to one or more
775 * elements of `ys` according to `pred`.
776 *
777 * `pred` must be a binary function expecting an element from each list.
778 *
779 * `xs`, `ys`, and `xs'` are treated as sets, semantically, so ordering should
780 * not be significant, but since `xs'` is ordered the implementation guarantees
781 * that its values are in the same order as they appear in `xs`. Duplicates are
782 * not removed, so `xs'` may contain duplicates if `xs` contains duplicates.
783 */
784
785export function innerJoin<T1, T2>(pred: (a: T1, b: T2) => boolean, list1: readonly T1[], list2: readonly T2[]): T1[];
786export function innerJoin<T1, T2>(pred: (a: T1, b: T2) => boolean): (list1: readonly T1[], list2: readonly T2[]) => T1[];
787export function innerJoin<T1, T2>(pred: (a: T1, b: T2) => boolean, list1: readonly T1[]): (list2: readonly T2[]) => T1[];
788
789/**
790 * Inserts the supplied element into the list, at index index. Note that
791 * this is not destructive: it returns a copy of the list with the changes.
792 */
793export function insert<T>(index: number, elt: T, list: readonly T[]): T[];
794export function insert<T>(index: number, elt: T): (list: readonly T[]) => T[];
795export function insert(index: number): <T>(elt: T, list: readonly T[]) => T[];
796
797/**
798 * Inserts the sub-list into the list, at index `index`. _Note that this
799 * is not destructive_: it returns a copy of the list with the changes.
800 */
801export function insertAll<T>(index: number, elts: readonly T[], list: readonly T[]): T[];
802export function insertAll<T>(index: number, elts: readonly T[]): (list: readonly T[]) => T[];
803export function insertAll(index: number): <T>(elts: readonly T[], list: readonly T[]) => T[];
804
805/**
806 * Combines two lists into a set (i.e. no duplicates) composed of those elements common to both lists.
807 */
808export function intersection<T>(list1: readonly T[], list2: readonly T[]): T[];
809export function intersection<T>(list1: readonly T[]): (list2: readonly T[]) => T[];
810
811/**
812 * Combines two lists into a set (i.e. no duplicates) composed of those
813 * elements common to both lists. Duplication is determined according
814 * to the value returned by applying the supplied predicate to two list
815 * elements.
816 */
817export function intersectionWith<T>(pred: (a: T, b: T) => boolean, list1: readonly T[], list2: readonly T[]): T[];
818
819/**
820 * Creates a new list with the separator interposed between elements.
821 */
822export function intersperse<T>(separator: T, list: readonly T[]): T[];
823export function intersperse<T>(separator: T): (list: readonly T[]) => T[];
824
825/**
826 * Transforms the items of the list with the transducer and appends the transformed items to the accumulator
827 * using an appropriate iterator function based on the accumulator type.
828 */
829export function into<T>(acc: any, xf: (...a: readonly any[]) => any, list: readonly T[]): T[];
830export function into(acc: any, xf: (...a: readonly any[]) => any): <T>(list: readonly T[]) => T[];
831export function into(acc: any): <T>(xf: (...a: readonly any[]) => any, list: readonly T[]) => T[];
832
833/**
834 * Same as R.invertObj, however this accounts for objects with duplicate values by putting the values into an array.
835 */
836export function invert<T>(obj: T): { [index: string]: string[] };
837
838/**
839 * Returns a new object with the keys of the given object as values, and the values of the given object as keys.
840 */
841export function invertObj(obj: { [index: string]: string } | { [index: number]: string }): { [index: string]: string };
842
843/**
844 * Turns a named method with a specified arity into a function that can be called directly
845 * supplied with arguments and a target object.
846 *
847 * The returned function is curried and accepts `arity + 1` parameters where the final
848 * parameter is the target object.
849 */
850export function invoker(arity: number, method: string): (...a: readonly any[]) => any;
851
852/**
853 * See if an object (`val`) is an instance of the supplied constructor.
854 * This function will check up the inheritance chain, if any.
855 */
856export function is(ctor: any, val: any): boolean;
857export function is(ctor: any): (val: any) => boolean;
858
859/**
860 * Reports whether the list has zero elements.
861 */
862export function isEmpty(value: any): boolean;
863
864/**
865 * Checks if the input value is null or undefined.
866 */
867export function isNil(value: any): value is null | undefined;
868
869/**
870 * Returns a string made by inserting the `separator` between each
871 * element and concatenating all the elements into a single string.
872 */
873export function join(x: string, xs: readonly any[]): string;
874export function join(x: string): (xs: readonly any[]) => string;
875
876/**
877 * Applies a list of functions to a list of values.
878 */
879export function juxt<A extends any[], R1, R2>(fns: [(...a: A) => R1, (...a: A) => R2]): (...a: A) => [R1, R2];
880export function juxt<A extends any[], R1, R2, R3>(fns: [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3]): (...a: A) => [R1, R2, R3];
881export function juxt<A extends any[], R1, R2, R3, R4>(fns: [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3, (...a: A) => R4]): (...a: A) => [R1, R2, R3, R4];
882export function juxt<A extends any[], R1, R2, R3, R4, R5>(fns: [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3, (...a: A) => R4, (...a: A) => R5]): (...a: A) => [R1, R2, R3, R4, R5];
883export function juxt<A extends any[], U>(fns: Array<(...args: A) => U>): (...args: A) => U[];
884
885/**
886 * Returns a list containing the names of all the enumerable own
887 * properties of the supplied object.
888 */
889export function keys<T extends object>(x: T): Array<keyof T>;
890export function keys<T>(x: T): string[];
891
892/**
893 * Returns a list containing the names of all the
894 * properties of the supplied object, including prototype properties.
895 */
896export function keysIn<T>(obj: T): string[];
897
898/**
899 * Returns the last element from a list.
900 */
901export function last(str: string): string;
902export function last(list: readonly []): undefined;
903export function last<T extends any>(list: readonly T[]): T | undefined;
904
905/**
906 * Returns the position of the last occurrence of an item (by strict equality) in
907 * an array, or -1 if the item is not included in the array.
908 */
909export function lastIndexOf<T>(target: T, list: readonly T[]): number;
910
911/**
912 * Returns the number of elements in the array by returning list.length.
913 */
914export function length<T>(list: readonly T[]): number;
915
916/**
917 * Returns a lens for the given getter and setter functions. The getter
918 * "gets" the value of the focus; the setter "sets" the value of the focus.
919 * The setter should not mutate the data structure.
920 */
921export function lens<T, U, V>(getter: (s: T) => U, setter: (a: U, s: T) => V): Lens;
922
923/**
924 * Creates a lens that will focus on index n of the source array.
925 */
926export function lensIndex(n: number): Lens;
927
928/**
929 * Returns a lens whose focus is the specified path.
930 * See also view, set, over.
931 */
932export function lensPath(path: Path): Lens;
933
934/**
935 * lensProp creates a lens that will focus on property k of the source object.
936 */
937export function lensProp(str: string): {
938 <T, U>(obj: T): U;
939 set<T, U, V>(val: T, obj: U): V;
940 /*map<T>(fn: (...a: readonly any[]) => any, obj: T): T*/
941};
942
943/**
944 * "lifts" a function of arity > 1 so that it may "map over" a list, Function or other object that satisfies
945 * the FantasyLand Apply spec.
946 */
947export function lift(fn: ((...a: readonly any[]) => any), ...args: readonly any[]): any;
948
949/**
950 * "lifts" a function to be the specified arity, so that it may "map over" that many lists, Functions or other
951 * objects that satisfy the FantasyLand Apply spec.
952 */
953export function liftN(n: number, fn: ((...a: readonly any[]) => any), ...args: readonly any[]): any;
954
955/**
956 * Returns true if the first parameter is less than the second.
957 */
958export function lt(__: Placeholder, b: number): (a: number) => boolean;
959export function lt(__: Placeholder): (b: number, a: number) => boolean;
960export function lt(a: number, b: number): boolean;
961export function lt(a: number): (b: number) => boolean;
962
963/**
964 * Returns true if the first parameter is less than or equal to the second.
965 */
966export function lte(__: Placeholder, b: number): (a: number) => boolean;
967export function lte(__: Placeholder): (b: number, a: number) => boolean;
968export function lte(a: number, b: number): boolean;
969export function lte(a: number): (b: number) => boolean;
970
971/**
972 * Returns a new list, constructed by applying the supplied function to every element of the supplied list.
973 */
974export function map<T, U>(fn: (x: T) => U, list: readonly T[]): U[];
975export function map<T, U>(fn: (x: T) => U): (list: readonly T[]) => U[];
976export function map<T, U>(fn: (x: T[keyof T & keyof U]) => U[keyof T & keyof U], list: T): U;
977export function map<T, U>(fn: (x: T[keyof T & keyof U]) => U[keyof T & keyof U]): (list: T) => U;
978export function map<T, U>(fn: (x: T) => U, obj: Functor<T>): Functor<U>; // used in functors
979export function map<T, U>(fn: (x: T) => U): (obj: Functor<T>) => Functor<U>; // used in functors
980
981/**
982 * The mapAccum function behaves like a combination of map and reduce.
983 */
984export function mapAccum<T, U, TResult>(fn: (acc: U, value: T) => [U, TResult], acc: U, list: readonly T[]): [U, TResult[]];
985export function mapAccum<T, U, TResult>(fn: (acc: U, value: T) => [U, TResult]): (acc: U, list: readonly T[]) => [U, TResult[]];
986export function mapAccum<T, U, TResult>(fn: (acc: U, value: T) => [U, TResult], acc: U): (list: readonly T[]) => [U, TResult[]];
987
988/**
989 * The mapAccumRight function behaves like a combination of map and reduce.
990 */
991export function mapAccumRight<T, U, TResult>(fn: (acc: U, value: T) => [U, TResult], acc: U, list: readonly T[]): [U, TResult[]];
992export function mapAccumRight<T, U, TResult>(fn: (acc: U, value: T) => [U, TResult]): (acc: U, list: readonly T[]) => [U, TResult[]];
993export function mapAccumRight<T, U, TResult>(fn: (acc: U, value: T) => [U, TResult], acc: U): (list: readonly T[]) => [U, TResult[]];
994
995/**
996 * Like mapObj, but but passes additional arguments to the predicate function.
997 */
998export function mapObjIndexed<T, TResult, TKey extends string>(
999 fn: (value: T, key: TKey, obj?: Record<TKey, T>) => TResult,
1000 obj: Record<TKey, T>
1001): Record<TKey, TResult>;
1002export function mapObjIndexed<T, TResult, TKey extends string>(
1003 fn: (value: T, key: TKey, obj?: Record<TKey, T>) => TResult
1004): (obj: Record<TKey, T>) => Record<TKey, TResult>;
1005export function mapObjIndexed<T, TResult>(
1006 fn: (value: T, key: string, obj?: {
1007 [key: string]: T
1008 }) => TResult,
1009 obj: {
1010 [key: string]: T
1011 }
1012): {
1013 [key: string]: TResult
1014};
1015export function mapObjIndexed<T, TResult>(fn: (value: T, key: string, obj?: any) => TResult, obj: any): { [index: string]: TResult };
1016export function mapObjIndexed<T, TResult>(fn: (value: T, key: string, obj?: any) => TResult): (obj: any) => { [index: string]: TResult };
1017
1018/**
1019 * Tests a regular expression agains a String
1020 */
1021export function match(regexp: RegExp, str: string): string[];
1022export function match(regexp: RegExp): (str: string) => string[];
1023
1024/**
1025 * mathMod behaves like the modulo operator should mathematically, unlike the `%`
1026 * operator (and by extension, R.modulo). So while "-17 % 5" is -2,
1027 * mathMod(-17, 5) is 3. mathMod requires Integer arguments, and returns NaN
1028 * when the modulus is zero or negative.
1029 */
1030export function mathMod(__: Placeholder, b: number): (a: number) => number;
1031export function mathMod(__: Placeholder): (b: number, a: number) => number;
1032export function mathMod(a: number, b: number): number;
1033export function mathMod(a: number): (b: number) => number;
1034
1035/**
1036 * Returns the larger of its two arguments.
1037 */
1038export function max<T extends Ord>(a: T, b: T): T;
1039export function max<T extends Ord>(a: T): (b: T) => T;
1040
1041/**
1042 * Takes a function and two values, and returns whichever value produces
1043 * the larger result when passed to the provided function.
1044 */
1045export function maxBy<T>(keyFn: (a: T) => Ord, a: T, b: T): T;
1046export function maxBy<T>(keyFn: (a: T) => Ord, a: T): (b: T) => T;
1047export function maxBy<T>(keyFn: (a: T) => Ord): _.F.Curry<(a: T, b: T) => T>;
1048
1049/**
1050 * Returns the mean of the given list of numbers.
1051 */
1052export function mean(list: readonly number[]): number;
1053
1054/**
1055 * Returns the median of the given list of numbers.
1056 */
1057export function median(list: readonly number[]): number;
1058
1059/**
1060 * Creates a new function that, when invoked, caches the result of calling fn for a given argument set and returns the result.
1061 * Subsequent calls to the memoized fn with the same argument set will not result in an additional call to fn; instead, the cached result for that set of arguments will be returned.
1062 */
1063export function memoizeWith<T extends (...args: readonly any[]) => any>(keyFn: (...v: Parameters<T>) => string, fn: T): T;
1064
1065/**
1066 * Create a new object with the own properties of a
1067 * merged with the own properties of object b.
1068 * This function will *not* mutate passed-in objects.
1069 *
1070 * @deprecated since 0.26 in favor of mergeRight
1071 */
1072export function merge<O2 extends object>(__: Placeholder, b: O2): <O1 extends object>(a: O1) => Merge<O2, O1, 'flat'>;
1073export function merge(__: Placeholder): <O1 extends object, O2 extends object>(b: O2, a: O1) => Merge<O2, O1, 'flat'>;
1074export function merge<O1 extends object, O2 extends object>(a: O1, b: O2): Merge<O2, O1, 'flat'>;
1075export function merge<O1 extends object>(a: O1): <O2 extends object>(b: O2) => Merge<O2, O1, 'flat'>;
1076
1077/**
1078 * Merges a list of objects together into one object.
1079 */
1080export function mergeAll<Os extends readonly object[]>(list: Os): MergeAll<Os>;
1081/**
1082 * Creates a new object with the own properties of the first object merged with the own properties of the second object.
1083 * If a key exists in both objects:
1084 * and both values are objects, the two values will be recursively merged
1085 * otherwise the value from the first object will be used.
1086 */
1087export function mergeDeepLeft<O1 extends object, O2 extends object>(o1: O1, o2: O2): Merge<O1, O2, 'deep'>;
1088export function mergeDeepLeft<O1 extends object>(o1: O1): <O2 extends object>(o2: O2) => Merge<O1, O2, 'deep'>;
1089
1090/**
1091 * Creates a new object with the own properties of the first object merged with the own properties of the second object.
1092 * If a key exists in both objects:
1093 * and both values are objects, the two values will be recursively merged
1094 * otherwise the value from the second object will be used.
1095 */
1096export function mergeDeepRight<O1 extends object, O2 extends object>(o1: O1, o2: O2): Merge<O2, O1, 'deep'>;
1097export function mergeDeepRight<O1 extends object>(a: O1): <O2 extends object>(o2: O2) => Merge<O2, O1, 'deep'>;
1098
1099/**
1100 * Creates a new object with the own properties of the two provided objects. If a key exists in both objects:
1101 * and both associated values are also objects then the values will be recursively merged.
1102 * otherwise the provided function is applied to associated values using the resulting value as the new value
1103 * associated with the key. If a key only exists in one object, the value will be associated with the key of the resulting object.
1104 */
1105export function mergeDeepWith<T1, T2>(fn: (x: any, z: any) => any, a: T1, b: T2): any;
1106export function mergeDeepWith<T1, T2>(fn: (x: any, z: any) => any, a: T1): (b: T2) => any;
1107export function mergeDeepWith<T1, T2>(fn: (x: any, z: any) => any): (a: T1, b: T2) => any;
1108
1109/**
1110 * Creates a new object with the own properties of the two provided objects. If a key exists in both objects:
1111 * and both associated values are also objects then the values will be recursively merged.
1112 * otherwise the provided function is applied to the key and associated values using the resulting value as
1113 * the new value associated with the key. If a key only exists in one object, the value will be associated with
1114 * the key of the resulting object.
1115 */
1116export function mergeDeepWithKey<T1, T2>(fn: (k: string, x: any, z: any) => any, a: T1, b: T2): any;
1117export function mergeDeepWithKey<T1, T2>(fn: (k: string, x: any, z: any) => any, a: T1): (b: T2) => any;
1118export function mergeDeepWithKey<T1, T2>(fn: (k: string, x: any, z: any) => any): (a: T1, b: T2) => any;
1119
1120/**
1121 * Create a new object with the own properties of the first object merged with the own properties of the second object.
1122 * If a key exists in both objects, the value from the first object will be used.
1123 */
1124export function mergeLeft<O1 extends object, O2 extends object>(a: O1, b: O2): Merge<O1, O2, 'flat'>;
1125export function mergeLeft<O1 extends object>(a: O1): <O2 extends object>(b: O2) => Merge<O1, O2, 'flat'>;
1126
1127/**
1128 * Create a new object with the own properties of the first object merged with the own properties of the second object.
1129 * If a key exists in both objects, the value from the second object will be used.
1130 */
1131export function mergeRight<O1 extends object, O2 extends object>(a: O1, b: O2): Merge<O2, O1, 'flat'>;
1132export function mergeRight<O1 extends object>(a: O1): <O2 extends object>(b: O2) => Merge<O2, O1, 'flat'>;
1133
1134/**
1135 * Creates a new object with the own properties of the two provided objects. If a key exists in both objects,
1136 * the provided function is applied to the values associated with the key in each object, with the result being used as
1137 * the value associated with the key in the returned object. The key will be excluded from the returned object if the
1138 * resulting value is undefined.
1139 */
1140export function mergeWith<U, V>(fn: (x: any, z: any) => any, a: U, b: V): any;
1141export function mergeWith<U>(fn: (x: any, z: any) => any, a: U): <V>(b: V) => any;
1142export function mergeWith(fn: (x: any, z: any) => any): <U, V>(a: U, b: V) => any;
1143
1144/**
1145 * Creates a new object with the own properties of the two provided objects. If a key exists in both objects,
1146 * the provided function is applied to the key and the values associated with the key in each object, with the
1147 * result being used as the value associated with the key in the returned object. The key will be excluded from
1148 * the returned object if the resulting value is undefined.
1149 */
1150export function mergeWithKey<U, V>(fn: (str: string, x: any, z: any) => any, a: U, b: V): any;
1151export function mergeWithKey<U>(fn: (str: string, x: any, z: any) => any, a: U): <V>(b: V) => any;
1152export function mergeWithKey(fn: (str: string, x: any, z: any) => any): <U, V>(a: U, b: V) => any;
1153
1154/**
1155 * Returns the smaller of its two arguments.
1156 */
1157export function min<T extends Ord>(a: T, b: T): T;
1158export function min<T extends Ord>(a: T): (b: T) => T;
1159
1160/**
1161 * Takes a function and two values, and returns whichever value produces
1162 * the smaller result when passed to the provided function.
1163 */
1164export function minBy<T>(keyFn: (a: T) => Ord, a: T, b: T): T;
1165export function minBy<T>(keyFn: (a: T) => Ord, a: T): (b: T) => T;
1166export function minBy<T>(keyFn: (a: T) => Ord): _.F.Curry<(a: T, b: T) => T>;
1167
1168/**
1169 * Divides the second parameter by the first and returns the remainder.
1170 * The flipped version (`moduloBy`) may be more useful curried.
1171 * Note that this functions preserves the JavaScript-style behavior for
1172 * modulo. For mathematical modulo see `mathMod`
1173 */
1174export function modulo(__: Placeholder, b: number): (a: number) => number;
1175export function modulo(__: Placeholder): (b: number, a: number) => number;
1176export function modulo(a: number, b: number): number;
1177export function modulo(a: number): (b: number) => number;
1178
1179/**
1180 * Multiplies two numbers. Equivalent to a * b but curried.
1181 */
1182export function multiply(a: number, b: number): number;
1183export function multiply(a: number): (b: number) => number;
1184
1185/**
1186 * Moves an item, at index `from`, to index `to`, in a `list` of elements.
1187 * A new list will be created containing the new elements order.
1188 */
1189export function move<T>(from: number, to: number, list: readonly T[]): T[];
1190export function move(from: number, to: number): <T>(list: readonly T[]) => T[];
1191export function move(from: number): {
1192 <T>(to: number, list: readonly T[]): T[];
1193 (to: number): <T>(list: readonly T[]) => T[];
1194};
1195
1196/**
1197 * Wraps a function of any arity (including nullary) in a function that accepts exactly n parameters.
1198 * Any extraneous parameters will not be passed to the supplied function.
1199 */
1200export function nAry(n: number, fn: (...arg: readonly any[]) => any): (...a: readonly any[]) => any;
1201export function nAry(n: number): (fn: (...arg: readonly any[]) => any) => (...a: readonly any[]) => any;
1202
1203/**
1204 * Negates its argument.
1205 */
1206export function negate(n: number): number;
1207
1208/**
1209 * Returns true if no elements of the list match the predicate, false otherwise.
1210 */
1211export function none<T>(fn: (a: T) => boolean, list: readonly T[]): boolean;
1212export function none<T>(fn: (a: T) => boolean): (list: readonly T[]) => boolean;
1213
1214/**
1215 * A function wrapping a call to the given function in a `!` operation. It will return `true` when the
1216 * underlying function would return a false-y value, and `false` when it would return a truth-y one.
1217 */
1218export function not(value: any): boolean;
1219
1220/**
1221 * Returns the nth element in a list.
1222 */
1223export function nth<T>(n: number, list: readonly T[]): T | undefined;
1224export function nth(n: number): <T>(list: readonly T[]) => T | undefined;
1225
1226/**
1227 * Returns a function which returns its nth argument.
1228 */
1229export function nthArg(n: number): (...a: readonly any[]) => any;
1230
1231/**
1232 * o is a curried composition function that returns a unary function. Like compose, o performs right-to-left function composition.
1233 * Unlike compose, the rightmost function passed to o will be invoked with only one argument.
1234 * Also, unlike compose, o is limited to accepting only 2 unary functions.
1235 * The name o was chosen because of its similarity to the mathematical composition operator ∘.
1236 */
1237export function o<T1, T2, R>(f: (x: T2) => R, g: (x: T1) => T2, v: T1): R;
1238export function o<T1, T2, R>(f: (x: T2) => R, g: (x: T1) => T2): (v: T1) => R;
1239export function o<T2, R>(
1240 f: (x: T2) => R,
1241): {
1242 <T1>(g: (x: T1) => T2, v: T1): R;
1243 <T1>(g: (x: T1) => T2): (v: T1) => R;
1244};
1245
1246/**
1247 * Creates an object containing a single key:value pair.
1248 */
1249export function objOf<T, K extends string>(key: K, value: T): Record<K, T>;
1250export function objOf<K extends string>(key: K): <T>(value: T) => Record<K, T>;
1251
1252/**
1253 * Returns a singleton array containing the value provided.
1254 */
1255export function of<T>(x: T): T[];
1256
1257/**
1258 * Returns a partial copy of an object omitting the keys specified.
1259 */
1260export function omit<T, K extends string>(names: readonly K[], obj: T): Omit<T, K>;
1261export function omit<K extends string>(names: readonly K[]): <T>(obj: T) => Omit<T, K>;
1262
1263/**
1264 * Accepts a function fn and returns a function that guards invocation of fn such that fn can only ever be
1265 * called once, no matter how many times the returned function is invoked. The first value calculated is
1266 * returned in subsequent invocations.
1267 */
1268export function once(fn: (...a: readonly any[]) => any): (...a: readonly any[]) => any;
1269export function once<T>(fn: (...a: readonly any[]) => T): (...a: readonly any[]) => T;
1270
1271/**
1272 * A function that returns the first truthy of two arguments otherwise the last argument. Note that this is
1273 * NOT short-circuited, meaning that if expressions are passed they are both evaluated.
1274 * Dispatches to the or method of the first argument if applicable.
1275 */
1276export function or<T, U>(a: T, b: U): T | U;
1277export function or<T>(a: T): <U>(b: U) => T | U;
1278export function or<T extends { or?: ((...a: readonly any[]) => any); }, U>(fn1: T, val2: U): T | U;
1279export function or<T extends { or?: ((...a: readonly any[]) => any); }>(fn1: T): <U>(val2: U) => T | U;
1280
1281/**
1282 * Returns the result of applying the onFailure function to the value inside a failed promise.
1283 * This is useful for handling rejected promises inside function compositions.
1284 */
1285export function otherwise<A, B>(onError: (error: any) => B | Promise<B>, promise: Promise<A>): Promise<B>;
1286export function otherwise<A, B>(onError: (error: any) => B | Promise<B>): (promise: Promise<A>) => Promise<B>;
1287
1288/**
1289 * Returns the result of "setting" the portion of the given data structure
1290 * focused by the given lens to the given value.
1291 */
1292export function over<T>(lens: Lens, fn: Arity1Fn, value: T): T;
1293export function over<T>(lens: Lens, fn: Arity1Fn, value: readonly T[]): T[];
1294export function over(lens: Lens, fn: Arity1Fn): <T>(value: T) => T;
1295export function over(lens: Lens, fn: Arity1Fn): <T>(value: readonly T[]) => T[];
1296export function over(lens: Lens): <T>(fn: Arity1Fn, value: T) => T;
1297export function over(lens: Lens): <T>(fn: Arity1Fn, value: readonly T[]) => T[];
1298
1299/**
1300 * Takes two arguments, fst and snd, and returns [fst, snd].
1301 */
1302export function pair<F, S>(fst: F, snd: S): [F, S];
1303
1304/**
1305 * Takes a function `f` and a list of arguments, and returns a function `g`.
1306 * When applied, `g` returns the result of applying `f` to the arguments
1307 * provided initially followed by the arguments provided to `g`.
1308 */
1309export function partial<V0, V1, T>(fn: (x0: V0, x1: V1) => T, args: [V0]): (x1: V1) => T;
1310
1311export function partial<V0, V1, V2, T>(fn: (x0: V0, x1: V1, x2: V2) => T, args: [V0, V1]): (x2: V2) => T;
1312export function partial<V0, V1, V2, T>(fn: (x0: V0, x1: V1, x2: V2) => T, args: [V0]): (x1: V1, x2: V2) => T;
1313
1314export function partial<V0, V1, V2, V3, T>(fn: (x0: V0, x1: V1, x2: V2, x3: V3) => T, args: [V0, V1, V2]): (x2: V3) => T;
1315export 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;
1316export 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;
1317
1318export function partial<T>(fn: (...a: readonly any[]) => T, args: readonly any[]): (...a: readonly any[]) => T;
1319
1320/**
1321 * Takes a function `f` and a list of arguments, and returns a function `g`.
1322 * When applied, `g` returns the result of applying `f` to the arguments
1323 * provided to `g` followed by the arguments provided initially.
1324 */
1325export function partialRight<V0, V1, T>(fn: (x0: V0, x1: V1) => T, args: [V1]): (x1: V0) => T;
1326
1327export function partialRight<V0, V1, V2, T>(fn: (x0: V0, x1: V1, x2: V2) => T, args: [V1, V2]): (x2: V0) => T;
1328export function partialRight<V0, V1, V2, T>(fn: (x0: V0, x1: V1, x2: V2) => T, args: [V2]): (x1: V0, x2: V1) => T;
1329
1330export function partialRight<V0, V1, V2, V3, T>(fn: (x0: V0, x1: V1, x2: V2, x3: V3) => T, args: [V1, V2, V3]): (x0: V0) => T;
1331export function partialRight<V0, V1, V2, V3, T>(fn: (x0: V0, x1: V1, x2: V2, x3: V3) => T, args: [V2, V3]): (x0: V0, x1: V1) => T;
1332export function partialRight<V0, V1, V2, V3, T>(fn: (x0: V0, x1: V1, x2: V2, x3: V3) => T, args: [V3]): (x0: V0, x1: V1, x2: V2) => T;
1333
1334export function partialRight<T>(fn: (...a: readonly any[]) => T, args: readonly any[]): (...a: readonly any[]) => T;
1335
1336/**
1337 * Takes a predicate and a list and returns the pair of lists of elements
1338 * which do and do not satisfy the predicate, respectively.
1339 */
1340export function partition(fn: (a: string) => boolean, list: readonly string[]): [string[], string[]];
1341export function partition<T>(fn: (a: T) => boolean, list: readonly T[]): [T[], T[]];
1342export function partition<T>(fn: (a: T) => boolean): (list: readonly T[]) => [T[], T[]];
1343export function partition(fn: (a: string) => boolean): (list: readonly string[]) => [string[], string[]];
1344
1345/**
1346 * Retrieve the value at a given path.
1347 */
1348export function path<T>(path: Path, obj: any): T | undefined;
1349export function path<T>(path: Path): (obj: any) => T | undefined;
1350
1351/**
1352 * Determines whether a nested path on an object has a specific value,
1353 * in `R.equals` terms. Most likely used to filter a list.
1354 */
1355export function pathEq(path: Path, val: any, obj: any): boolean;
1356export function pathEq(path: Path, val: any): (obj: any) => boolean;
1357export function pathEq(path: Path): _.F.Curry<(a: any, b: any) => boolean>;
1358
1359/**
1360 * If the given, non-null object has a value at the given path, returns the value at that path.
1361 * Otherwise returns the provided default value.
1362 */
1363export function pathOr<T>(defaultValue: T, path: Path, obj: any): T;
1364export function pathOr<T>(defaultValue: T, path: Path): (obj: any) => T;
1365export function pathOr<T>(defaultValue: T): _.F.Curry<(a: Path, b: any) => T>;
1366
1367/**
1368 * Returns true if the specified object property at given path satisfies the given predicate; false otherwise.
1369 */
1370export function pathSatisfies<T, U>(pred: (val: T) => boolean, path: Path, obj: U): boolean;
1371export function pathSatisfies<T, U>(pred: (val: T) => boolean, path: Path): (obj: U) => boolean;
1372export function pathSatisfies<T, U>(pred: (val: T) => boolean): _.F.Curry<(a: Path, b: U) => boolean>;
1373
1374/**
1375 * Returns a partial copy of an object containing only the keys specified. If the key does not exist, the
1376 * property is ignored.
1377 */
1378export function pick<T, K extends string>(names: readonly K[], obj: T): Pick<T, Exclude<keyof T, Exclude<keyof T, K>>>;
1379export function pick<K extends string>(names: readonly K[]): <T>(obj: T) => Pick<T, Exclude<keyof T, Exclude<keyof T, K>>>;
1380
1381/**
1382 * Similar to `pick` except that this one includes a `key: undefined` pair for properties that don't exist.
1383 */
1384export function pickAll<T, U>(names: readonly string[], obj: T): U;
1385export function pickAll(names: readonly string[]): <T, U>(obj: T) => U;
1386
1387/**
1388 * Returns a partial copy of an object containing only the keys that satisfy the supplied predicate.
1389 */
1390export function pickBy<T, U>(pred: ObjPred, obj: T): U;
1391export function pickBy(pred: ObjPred): <T, U>(obj: T) => U;
1392
1393/**
1394 * Creates a new function that runs each of the functions supplied as parameters in turn,
1395 * passing the return value of each function invocation to the next function invocation,
1396 * beginning with whatever arguments were passed to the initial invocation.
1397 */
1398// tslint:disable:max-line-length
1399export function pipe<T1>(fn0: () => T1): () => T1;
1400export function pipe<V0, T1>(fn0: (x0: V0) => T1): (x0: V0) => T1;
1401export function pipe<V0, V1, T1>(fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T1;
1402export function pipe<V0, V1, V2, T1>(fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T1;
1403
1404export function pipe<T1, T2>(fn0: () => T1, fn1: (x: T1) => T2): () => T2;
1405export function pipe<V0, T1, T2>(fn0: (x0: V0) => T1, fn1: (x: T1) => T2): (x0: V0) => T2;
1406export function pipe<V0, V1, T1, T2>(fn0: (x0: V0, x1: V1) => T1, fn1: (x: T1) => T2): (x0: V0, x1: V1) => T2;
1407export 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;
1408
1409export function pipe<T1, T2, T3>(fn0: () => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3): () => T3;
1410export function pipe<V0, T1, T2, T3>(fn0: (x: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3): (x: V0) => T3;
1411export 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;
1412export 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;
1413
1414export function pipe<T1, T2, T3, T4>(fn0: () => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4): () => T4;
1415export 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;
1416export 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;
1417export 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;
1418
1419export 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;
1420export 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;
1421export 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;
1422export 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;
1423
1424export 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;
1425export 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;
1426export 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;
1427export function pipe<V0, V1, V2, T1, T2, T3, T4, T5, T6>(fn0: (x0: V0, x1: V1, x2: V2) => 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, x2: V2) => T6;
1428
1429export function pipe<T1, T2, T3, T4, T5, T6, T7>(fn0: () => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn: (x: T6) => T7): () => T7;
1430export function pipe<V0, T1, T2, T3, T4, T5, T6, T7>(fn0: (x: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn: (x: T6) => T7): (x: V0) => T7;
1431export function pipe<V0, V1, T1, T2, T3, T4, T5, T6, T7>(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, fn6: (x: T6) => T7): (x0: V0, x1: V1) => T7;
1432export function pipe<V0, V1, V2, T1, T2, T3, T4, T5, T6, T7>(fn0: (x0: V0, x1: V1, x2: V2) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7): (x0: V0, x1: V1, x2: V2) => T7;
1433
1434export function pipe<T1, T2, T3, T4, T5, T6, T7, T8>(fn0: () => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7, fn: (x: T7) => T8): () => T8;
1435export function pipe<V0, T1, T2, T3, T4, T5, T6, T7, T8>(fn0: (x: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7, fn: (x: T7) => T8): (x: V0) => T8;
1436export function pipe<V0, V1, T1, T2, T3, T4, T5, T6, T7, T8>(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, fn6: (x: T6) => T7, fn7: (x: T7) => T8): (x0: V0, x1: V1) => T8;
1437export function pipe<V0, V1, V2, T1, T2, T3, T4, T5, T6, T7, T8>(fn0: (x0: V0, x1: V1, x2: V2) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7, fn7: (x: T7) => T8): (x0: V0, x1: V1, x2: V2) => T8;
1438
1439export function pipe<T1, T2, T3, T4, T5, T6, T7, T8, T9>(fn0: () => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7, fn7: (x: T7) => T8, fn8: (x: T8) => T9): () => T9;
1440export function pipe<V0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(fn0: (x0: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7, fn7: (x: T7) => T8, fn8: (x: T8) => T9): (x0: V0) => T9;
1441export function pipe<V0, V1, T1, T2, T3, T4, T5, T6, T7, T8, T9>(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, fn6: (x: T6) => T7, fn7: (x: T7) => T8, fn8: (x: T8) => T9): (x0: V0, x1: V1) => T9;
1442export function pipe<V0, V1, V2, T1, T2, T3, T4, T5, T6, T7, T8, T9>(fn0: (x0: V0, x1: V1, x2: V2) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7, fn7: (x: T7) => T8, fn8: (x: T8) => T9): (x0: V0, x1: V1, x2: V2) => T9;
1443
1444export function pipe<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(fn0: () => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7, fn7: (x: T7) => T8, fn8: (x: T8) => T9, fn9: (x: T9) => T10): () => T10;
1445export function pipe<V0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(fn0: (x0: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7, fn7: (x: T7) => T8, fn8: (x: T8) => T9, fn9: (x: T9) => T10): (x0: V0) => T10;
1446export function pipe<V0, V1, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(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, fn6: (x: T6) => T7, fn7: (x: T7) => T8, fn8: (x: T8) => T9, fn9: (x: T9) => T10): (x0: V0, x1: V1) => T10;
1447export function pipe<V0, V1, V2, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(fn0: (x0: V0, x1: V1, x2: V2) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4, fn4: (x: T4) => T5, fn5: (x: T5) => T6, fn6: (x: T6) => T7, fn7: (x: T7) => T8, fn8: (x: T8) => T9, fn9: (x: T9) => T10): (x0: V0, x1: V1, x2: V2) => T10;
1448// tslint:enable:max-line-length
1449
1450/**
1451 * Returns the left-to-right Kleisli composition of the provided functions, each of which must return a value of a type supported by chain.
1452 * The typings currently support arrays only as return values.
1453 * All functions need to be unary.
1454 * R.pipeK(f, g, h) is equivalent to R.pipe(f, R.chain(g), R.chain(h)).
1455 *
1456 * @deprecated since 0.26 in favor of pipeWith(chain)
1457 */
1458// tslint:disable:max-line-length
1459export function pipeK<V0, T1>(fn0: (x0: V0) => T1[]): (x0: V0) => T1[];
1460export function pipeK<V0, T1, T2>(fn0: (x0: V0) => T1[], fn1: (x: T1) => T2[]): (x0: V0) => T2[];
1461export function pipeK<V0, T1, T2, T3>(fn0: (x: V0) => T1[], fn1: (x: T1) => T2[], fn2: (x: T2) => T3[]): (x: V0) => T3[];
1462export function pipeK<V0, T1, T2, T3, T4>(fn0: (x: V0) => T1[], fn1: (x: T1) => T2[], fn2: (x: T2) => T3[], fn3: (x: T3) => T4[]): (x: V0) => T4[];
1463export function pipeK<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[];
1464export function pipeK<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[];
1465export function pipeK<V0, T1, T2, T3, T4, T5, T6, T7>(fn0: (x: V0) => T1[], fn1: (x: T1) => T2[], fn2: (x: T2) => T3[], fn3: (x: T3) => T4[], fn4: (x: T4) => T5[], fn5: (x: T5) => T6[], fn: (x: T6) => T7[]): (x: V0) => T7[];
1466export function pipeK<V0, T1, T2, T3, T4, T5, T6, T7, T8>(fn0: (x: V0) => T1[], fn1: (x: T1) => T2[], fn2: (x: T2) => T3[], fn3: (x: T3) => T4[], fn4: (x: T4) => T5[], fn5: (x: T5) => T6[], fn6: (x: T6) => T7[], fn: (x: T7) => T8[]): (x: V0) => T8[];
1467export function pipeK<V0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(fn0: (x0: V0) => T1[], fn1: (x: T1) => T2[], fn2: (x: T2) => T3[], fn3: (x: T3) => T4[], fn4: (x: T4) => T5[], fn5: (x: T5) => T6[], fn6: (x: T6) => T7[], fn7: (x: T7) => T8[], fn8: (x: T8) => T9[]): (x0: V0) => T9[];
1468export function pipeK<V0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(fn0: (x0: V0) => T1[], fn1: (x: T1) => T2[], fn2: (x: T2) => T3[], fn3: (x: T3) => T4[], fn4: (x: T4) => T5[], fn5: (x: T5) => T6[], fn6: (x: T6) => T7[], fn7: (x: T7) => T8[], fn8: (x: T8) => T9[], fn9: (x: T9) => T10[]): (x0: V0) => T10[];
1469// tslint:enable:max-line-length
1470
1471/**
1472 * Performs left-to-right composition of one or more Promise-returning functions.
1473 * All functions need to be unary.
1474 *
1475 * @deprecated since 0.26 in favor of pipeWith(then)
1476 */
1477// tslint:disable:max-line-length
1478export function pipeP<V0, T1>(fn0: (x0: V0) => Promise<T1>): (x0: V0) => Promise<T1>;
1479export function pipeP<V0, T1, T2>(fn0: (x0: V0) => Promise<T1>, fn1: (x: T1) => Promise<T2>): (x0: V0) => Promise<T2>;
1480export function pipeP<V0, T1, T2, T3>(fn0: (x: V0) => Promise<T1>, fn1: (x: T1) => Promise<T2>, fn2: (x: T2) => Promise<T3>): (x: V0) => Promise<T3>;
1481export function pipeP<V0, T1, T2, T3, T4>(fn0: (x: V0) => Promise<T1>, fn1: (x: T1) => Promise<T2>, fn2: (x: T2) => Promise<T3>, fn3: (x: T3) => Promise<T4>): (x: V0) => Promise<T4>;
1482export function pipeP<V0, T1, T2, T3, T4, T5>(fn0: (x: V0) => Promise<T1>, fn1: (x: T1) => Promise<T2>, fn2: (x: T2) => Promise<T3>, fn3: (x: T3) => Promise<T4>, fn4: (x: T4) => Promise<T5>): (x: V0) => Promise<T5>;
1483export function pipeP<V0, T1, T2, T3, T4, T5, T6>(fn0: (x: V0) => Promise<T1>, fn1: (x: T1) => Promise<T2>, fn2: (x: T2) => Promise<T3>, fn3: (x: T3) => Promise<T4>, fn4: (x: T4) => Promise<T5>, fn5: (x: T5) => Promise<T6>): (x: V0) => Promise<T6>;
1484export function pipeP<V0, T1, T2, T3, T4, T5, T6, T7>(fn0: (x: V0) => Promise<T1>, fn1: (x: T1) => Promise<T2>, fn2: (x: T2) => Promise<T3>, fn3: (x: T3) => Promise<T4>, fn4: (x: T4) => Promise<T5>, fn5: (x: T5) => Promise<T6>, fn: (x: T6) => Promise<T7>): (x: V0) => Promise<T7>;
1485export function pipeP<V0, T1, T2, T3, T4, T5, T6, T7, T8>(fn0: (x: V0) => Promise<T1>, fn1: (x: T1) => Promise<T2>, fn2: (x: T2) => Promise<T3>, fn3: (x: T3) => Promise<T4>, fn4: (x: T4) => Promise<T5>, fn5: (x: T5) => Promise<T6>, fn6: (x: T6) => Promise<T7>, fn: (x: T7) => Promise<T8>): (x: V0) => Promise<T8>;
1486export function pipeP<V0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(fn0: (x0: V0) => Promise<T1>, fn1: (x: T1) => Promise<T2>, fn2: (x: T2) => Promise<T3>, fn3: (x: T3) => Promise<T4>, fn4: (x: T4) => Promise<T5>, fn5: (x: T5) => Promise<T6>, fn6: (x: T6) => Promise<T7>, fn7: (x: T7) => Promise<T8>, fn8: (x: T8) => Promise<T9>): (x0: V0) => Promise<T9>;
1487export function pipeP<V0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(fn0: (x0: V0) => Promise<T1>, fn1: (x: T1) => Promise<T2>, fn2: (x: T2) => Promise<T3>, fn3: (x: T3) => Promise<T4>, fn4: (x: T4) => Promise<T5>, fn5: (x: T5) => Promise<T6>, fn6: (x: T6) => Promise<T7>, fn7: (x: T7) => Promise<T8>, fn8: (x: T8) => Promise<T9>, fn9: (x: T9) => Promise<T10>): (x0: V0) => Promise<T10>;
1488// tslint:enable:max-line-length
1489
1490/*
1491 * Performs left-to-right function composition using transforming function.
1492 * With the current typings, all functions must be unary.
1493 */
1494export function pipeWith<V0, T>(composer: (a: any) => any, fns: PipeWithFns<V0, T>): (x0: V0) => T;
1495export function pipeWith(composer: (a: any) => any): <V0, T>(fns: PipeWithFns<V0, T>) => (x0: V0) => T;
1496
1497/**
1498 * Returns a new list by plucking the same named property off all objects in the list supplied.
1499 */
1500export function pluck<K extends keyof T, T>(p: K, list: readonly T[]): Array<T[K]>;
1501export function pluck<T>(p: number, list: Array<{ [k: number]: T }>): T[];
1502export function pluck<P extends string>(p: P): <T>(list: Array<Record<P, T>>) => T[];
1503export function pluck(p: number): <T>(list: Array<{ [k: number]: T }>) => T[];
1504
1505/**
1506 * Returns a new list with the given element at the front, followed by the contents of the
1507 * list.
1508 */
1509export function prepend<T>(el: T, list: readonly T[]): T[];
1510export function prepend<T>(el: T): (list: readonly T[]) => T[];
1511
1512/**
1513 * Multiplies together all the elements of a list.
1514 */
1515export function product(list: readonly number[]): number;
1516
1517/**
1518 * Reasonable analog to SQL `select` statement.
1519 */
1520export function project<T, U>(props: readonly string[], objs: readonly T[]): U[];
1521export function project<T, U>(props: readonly string[]): (objs: readonly T[]) => U[];
1522
1523/**
1524 * Returns a function that when supplied an object returns the indicated property of that object, if it exists.
1525 */
1526export function prop<T>(__: Placeholder, obj: T): <P extends keyof T>(p: P) => T[P];
1527export function prop<P extends keyof T, T>(p: P, obj: T): T[P];
1528export function prop<P extends string>(p: P): <T>(obj: Record<P, T>) => T;
1529export function prop<P extends string, T>(p: P): (obj: Record<P, T>) => T;
1530
1531/**
1532 * Determines whether the given property of an object has a specific
1533 * value according to strict equality (`===`). Most likely used to
1534 * filter a list.
1535 */
1536export function propEq<T>(name: string | number, val: T, obj: any): boolean;
1537export function propEq<T>(name: string | number, val: T): (obj: any) => boolean;
1538export function propEq(name: string | number): {
1539 <T>(val: T, obj: any): boolean;
1540 <T>(val: T): (obj: any) => boolean;
1541};
1542
1543/**
1544 * Returns true if the specified object property is of the given type; false otherwise.
1545 */
1546export function propIs(type: any, name: string, obj: any): boolean;
1547export function propIs(type: any, name: string): (obj: any) => boolean;
1548export function propIs(type: any): {
1549 (name: string, obj: any): boolean;
1550 (name: string): (obj: any) => boolean;
1551};
1552
1553/**
1554 * If the given, non-null object has an own property with the specified name, returns the value of that property.
1555 * Otherwise returns the provided default value.
1556 */
1557export function propOr<T, U>(val: T, __: Placeholder, obj: U): <V>(p: string) => V;
1558export function propOr<U>(__: Placeholder, p: string, obj: U): <T, V>(val: T) => V;
1559export function propOr<T, U, V>(val: T, p: string, obj: U): V;
1560export function propOr<T>(val: T, p: string): <U, V>(obj: U) => V;
1561export function propOr<T>(val: T): <U, V>(p: string, obj: U) => V;
1562
1563/**
1564 * Returns the value at the specified property.
1565 * The only difference from `prop` is the parameter order.
1566 * Note: TS1.9 # replace any by dictionary
1567 */
1568export function props<P extends string, T>(ps: readonly P[], obj: Record<P, T>): T[];
1569export function props<P extends string>(ps: readonly P[]): <T>(obj: Record<P, T>) => T[];
1570export function props<P extends string, T>(ps: readonly P[]): (obj: Record<P, T>) => T[];
1571
1572/**
1573 * Returns true if the specified object property satisfies the given predicate; false otherwise.
1574 */
1575export function propSatisfies<T, U>(pred: (val: T) => boolean, name: string, obj: U): boolean;
1576export function propSatisfies<T, U>(pred: (val: T) => boolean, name: string): (obj: U) => boolean;
1577export function propSatisfies<T, U>(pred: (val: T) => boolean): _.F.Curry<(a: string, b: U) => boolean>;
1578
1579/**
1580 * Returns a list of numbers from `from` (inclusive) to `to`
1581 * (exclusive). In mathematical terms, `range(a, b)` is equivalent to
1582 * the half-open interval `[a, b)`.
1583 */
1584export function range(from: number, to: number): number[];
1585export function range(from: number): (to: number) => number[];
1586
1587/**
1588 * Returns a single item by iterating through the list, successively calling the iterator
1589 * function and passing it an accumulator value and the current value from the array, and
1590 * then passing the result to the next call.
1591 */
1592export function reduce<T, TResult>(fn: (acc: TResult, elem: T) => TResult | Reduced<TResult>, acc: TResult, list: readonly T[]): TResult;
1593export function reduce<T, TResult>(fn: (acc: TResult, elem: T) => TResult | Reduced<TResult>): (acc: TResult, list: readonly T[]) => TResult;
1594export function reduce<T, TResult>(fn: (acc: TResult, elem: T) => TResult | Reduced<TResult>, acc: TResult): (list: readonly T[]) => TResult;
1595
1596/**
1597 * Groups the elements of the list according to the result of calling the String-returning function keyFn on each
1598 * element and reduces the elements of each group to a single value via the reducer function valueFn.
1599 */
1600export function reduceBy<T, TResult>(valueFn: (acc: TResult, elem: T) => TResult, acc: TResult, keyFn: (elem: T) => string, list: readonly T[]): { [index: string]: TResult };
1601export function reduceBy<T, TResult>(valueFn: (acc: TResult, elem: T) => TResult, acc: TResult, keyFn: (elem: T) => string): (list: readonly T[]) => { [index: string]: TResult };
1602export function reduceBy<T, TResult>(valueFn: (acc: TResult, elem: T) => TResult, acc: TResult): _.F.Curry<(a: (elem: T) => string, b: readonly T[]) => { [index: string]: TResult }>;
1603export function reduceBy<T, TResult>(valueFn: (acc: TResult, elem: T) => TResult): _.F.Curry<(a: TResult, b: (elem: T) => string, c: readonly T[]) => { [index: string]: TResult }>;
1604
1605/**
1606 * Returns a value wrapped to indicate that it is the final value of the reduce and
1607 * transduce functions. The returned value should be considered a black box: the internal
1608 * structure is not guaranteed to be stable.
1609 */
1610export function reduced<T>(elem: T): Reduced<T>;
1611
1612/**
1613 * Returns a single item by iterating through the list, successively calling the iterator
1614 * function and passing it an accumulator value and the current value from the array, and
1615 * then passing the result to the next call.
1616 */
1617export function reduceRight<T, TResult>(fn: (elem: T, acc: TResult) => TResult, acc: TResult, list: readonly T[]): TResult;
1618export function reduceRight<T, TResult>(fn: (elem: T, acc: TResult) => TResult): (acc: TResult, list: readonly T[]) => TResult;
1619export function reduceRight<T, TResult>(fn: (elem: T, acc: TResult) => TResult, acc: TResult): (list: readonly T[]) => TResult;
1620
1621/**
1622 * Like reduce, reduceWhile returns a single item by iterating through the list, successively
1623 * calling the iterator function. reduceWhile also takes a predicate that is evaluated before
1624 * each step. If the predicate returns false, it "short-circuits" the iteration and returns
1625 * the current value of the accumulator.
1626 */
1627export function reduceWhile<T, TResult>(predicate: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult, acc: TResult, list: readonly T[]): TResult;
1628export function reduceWhile<T, TResult>(predicate: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult, acc: TResult): (list: readonly T[]) => TResult;
1629export function reduceWhile<T, TResult>(predicate: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult): _.F.Curry<(a: TResult, b: readonly T[]) => TResult>;
1630export function reduceWhile<T, TResult>(predicate: (acc: TResult, elem: T) => boolean): _.F.Curry<(a: (acc: TResult, elem: T) => TResult, b: TResult, c: readonly T[]) => TResult>;
1631
1632/**
1633 * Similar to `filter`, except that it keeps only values for which the given predicate
1634 * function returns falsy.
1635 */
1636export const reject: Filter;
1637
1638/**
1639 * Removes the sub-list of `list` starting at index `start` and containing `count` elements.
1640 */
1641export function remove<T>(start: number, count: number, list: readonly T[]): T[];
1642export function remove<T>(start: number): (count: number, list: readonly T[]) => T[];
1643export function remove<T>(start: number, count: number): (list: readonly T[]) => T[];
1644
1645/**
1646 * Returns a fixed list of size n containing a specified identical value.
1647 */
1648export function repeat<T>(a: T, n: number): T[];
1649export function repeat<T>(a: T): (n: number) => T[];
1650
1651/**
1652 * Replace a substring or regex match in a string with a replacement.
1653 */
1654export function replace(pattern: RegExp | string, replacement: string | ((match: string, ...args: readonly any[]) => string), str: string): string;
1655export function replace(pattern: RegExp | string, replacement: string | ((match: string, ...args: readonly any[]) => string)): (str: string) => string;
1656export function replace(pattern: RegExp | string): (replacement: string | ((match: string, ...args: readonly any[]) => string)) => (str: string) => string;
1657
1658/**
1659 * Returns a new list with the same elements as the original list, just in the reverse order.
1660 */
1661export function reverse<T>(list: readonly T[]): T[];
1662/**
1663 * Returns a new string with the characters in reverse order.
1664 */
1665export function reverse(str: string): string;
1666
1667/**
1668 * Scan is similar to reduce, but returns a list of successively reduced values from the left.
1669 */
1670export function scan<T, TResult>(fn: (acc: TResult, elem: T) => any, acc: TResult, list: readonly T[]): TResult[];
1671export function scan<T, TResult>(fn: (acc: TResult, elem: T) => any, acc: TResult): (list: readonly T[]) => TResult[];
1672export function scan<T, TResult>(fn: (acc: TResult, elem: T) => any): (acc: TResult, list: readonly T[]) => TResult[];
1673
1674/**
1675 * Returns the result of "setting" the portion of the given data structure focused by the given lens to the
1676 * given value.
1677 */
1678export function set<T, U>(lens: Lens, a: U, obj: T): T;
1679export function set<U>(lens: Lens, a: U): <T>(obj: T) => T;
1680export function set(lens: Lens): <T, U>(a: U, obj: T) => T;
1681
1682/**
1683 * Returns the elements from `xs` starting at `a` and ending at `b - 1`.
1684 */
1685export function slice(a: number, b: number, list: string): string;
1686export function slice<T>(a: number, b: number, list: readonly T[]): T[];
1687export function slice(a: number, b: number): {
1688 (list: string): string;
1689 <T>(list: readonly T[]): T[];
1690};
1691export function slice(a: number): {
1692 (b: number, list: string): string;
1693 <T>(b: number, list: readonly T[]): T[];
1694};
1695
1696/**
1697 * Returns a copy of the list, sorted according to the comparator function, which should accept two values at a
1698 * time and return a negative number if the first value is smaller, a positive number if it's larger, and zero
1699 * if they are equal.
1700 */
1701export function sort<T>(fn: (a: T, b: T) => number, list: readonly T[]): T[];
1702export function sort<T>(fn: (a: T, b: T) => number): (list: readonly T[]) => T[];
1703
1704/**
1705 * Sorts the list according to a key generated by the supplied function.
1706 */
1707export function sortBy<T>(fn: (a: T) => Ord, list: readonly T[]): T[];
1708export function sortBy(fn: (a: any) => Ord): <T>(list: readonly T[]) => T[];
1709
1710/**
1711 * Sorts a list according to a list of comparators.
1712 */
1713export function sortWith<T>(fns: Array<((a: T, b: T) => number)>, list: readonly T[]): T[];
1714export function sortWith<T>(fns: Array<((a: T, b: T) => number)>): (list: readonly T[]) => T[];
1715
1716/**
1717 * Splits a string into an array of strings based on the given
1718 * separator.
1719 */
1720export function split(sep: string | RegExp): (str: string) => string[];
1721export function split(sep: string | RegExp, str: string): string[];
1722
1723/**
1724 * Splits a given list or string at a given index.
1725 */
1726export function splitAt<T>(index: number, list: readonly T[]): [T[], T[]];
1727export function splitAt(index: number, list: string): [string, string];
1728export function splitAt(index: number): {
1729 <T>(list: readonly T[]): [T[], T[]];
1730 (list: string): [string, string];
1731};
1732
1733/**
1734 * Splits a collection into slices of the specified length.
1735 */
1736export function splitEvery<T>(a: number, list: readonly T[]): T[][];
1737export function splitEvery(a: number, list: string): string[];
1738export function splitEvery(a: number): {
1739 (list: string): string[];
1740 <T>(list: readonly T[]): T[][];
1741};
1742
1743/**
1744 * Takes a list and a predicate and returns a pair of lists with the following properties:
1745 * - the result of concatenating the two output lists is equivalent to the input list;
1746 * - none of the elements of the first output list satisfies the predicate; and
1747 * - if the second output list is non-empty, its first element satisfies the predicate.
1748 */
1749export function splitWhen<T, U>(pred: (val: T) => boolean, list: readonly U[]): U[][];
1750export function splitWhen<T>(pred: (val: T) => boolean): <U>(list: readonly U[]) => U[][];
1751
1752/**
1753 * Checks if a list starts with the provided values
1754 */
1755export function startsWith(a: string, list: string): boolean;
1756export function startsWith(a: string): (list: string) => boolean;
1757export function startsWith<T>(a: T | readonly T[], list: readonly T[]): boolean;
1758export function startsWith<T>(a: T | readonly T[]): (list: readonly T[]) => boolean;
1759
1760/**
1761 * Subtracts two numbers. Equivalent to `a - b` but curried.
1762 */
1763export function subtract(__: Placeholder, b: number): (a: number) => number;
1764export function subtract(__: Placeholder): (b: number, a: number) => number;
1765export function subtract(a: number, b: number): number;
1766export function subtract(a: number): (b: number) => number;
1767
1768/**
1769 * Adds together all the elements of a list.
1770 */
1771export function sum(list: readonly number[]): number;
1772
1773/**
1774 * Finds the set (i.e. no duplicates) of all elements contained in the first or second list, but not both.
1775 */
1776export function symmetricDifference<T>(list1: readonly T[], list2: readonly T[]): T[];
1777export function symmetricDifference<T>(list: readonly T[]): <T>(list: readonly T[]) => T[];
1778
1779/**
1780 * Finds the set (i.e. no duplicates) of all elements contained in the first or second list, but not both.
1781 * Duplication is determined according to the value returned by applying the supplied predicate to two list elements.
1782 */
1783export function symmetricDifferenceWith<T>(pred: (a: T, b: T) => boolean, list1: readonly T[], list2: readonly T[]): T[];
1784export function symmetricDifferenceWith<T>(pred: (a: T, b: T) => boolean): _.F.Curry<(a: readonly T[], b: readonly T[]) => T[]>;
1785
1786/**
1787 * A function that always returns true. Any passed in parameters are ignored.
1788 */
1789export function T(): boolean;
1790
1791/**
1792 * Returns all but the first element of a list or string.
1793 */
1794export function tail(list: string): string;
1795export function tail<T extends any>(list: readonly T[]): T[];
1796
1797/**
1798 * Returns a new list containing the first `n` elements of the given list. If
1799 * `n > * list.length`, returns a list of `list.length` elements.
1800 */
1801export function take<T>(n: number, xs: readonly T[]): T[];
1802export function take(n: number, xs: string): string;
1803export function take(n: number): {
1804 (xs: string): string;
1805 <T>(xs: readonly T[]): T[];
1806};
1807
1808/**
1809 * Returns a new list containing the last n elements of the given list. If n > list.length,
1810 * returns a list of list.length elements.
1811 */
1812export function takeLast<T>(n: number, xs: readonly T[]): T[];
1813export function takeLast(n: number, xs: string): string;
1814export function takeLast(n: number): {
1815 <T>(xs: readonly T[]): T[];
1816 (xs: string): string;
1817};
1818
1819/**
1820 * Returns a new list containing the last n elements of a given list, passing each value
1821 * to the supplied predicate function, and terminating when the predicate function returns
1822 * false. Excludes the element that caused the predicate function to fail. The predicate
1823 * function is passed one argument: (value).
1824 */
1825export function takeLastWhile<T>(pred: (a: T) => boolean, list: readonly T[]): T[];
1826export function takeLastWhile<T>(pred: (a: T) => boolean): <T>(list: readonly T[]) => T[];
1827
1828/**
1829 * Returns a new list containing the first `n` elements of a given list, passing each value
1830 * to the supplied predicate function, and terminating when the predicate function returns
1831 * `false`.
1832 */
1833export function takeWhile<T>(fn: (x: T) => boolean, list: readonly T[]): T[];
1834export function takeWhile<T>(fn: (x: T) => boolean): (list: readonly T[]) => T[];
1835
1836/**
1837 * The function to call with x. The return value of fn will be thrown away.
1838 */
1839export function tap<T>(fn: (a: T) => any, value: T): T;
1840export function tap<T>(fn: (a: T) => any): (value: T) => T;
1841
1842/**
1843 * Determines whether a given string matches a given regular expression.
1844 */
1845export function test(regexp: RegExp, str: string): boolean;
1846export function test(regexp: RegExp): (str: string) => boolean;
1847
1848/**
1849 * Returns the result of applying the onSuccess function to the value inside a successfully resolved promise. This is useful for working with promises inside function compositions.
1850 */
1851export function then<A, B>(onSuccess: (a: A) => B | Promise<B>, promise: Promise<A>): Promise<B>;
1852export function then<A, B>(onSuccess: (a: A) => B | Promise<B>): (promise: Promise<A>) => Promise<B>;
1853
1854/**
1855 * Creates a thunk out of a function.
1856 * A thunk delays a calculation until its result is needed, providing lazy evaluation of arguments.
1857 */
1858export function thunkify<F extends (...args: readonly any[]) => any>(fn: F): _.F.Curry<(...args: Parameters<F>) => (() => ReturnType<F>)>;
1859
1860/**
1861 * Calls an input function `n` times, returning an array containing the results of those
1862 * function calls.
1863 */
1864export function times<T>(fn: (i: number) => T, n: number): T[];
1865export function times<T>(fn: (i: number) => T): (n: number) => T[];
1866
1867/**
1868 * The lower case version of a string.
1869 */
1870export function toLower(str: string): string;
1871
1872/**
1873 * Converts an object into an array of key, value arrays.
1874 * Only the object's own properties are used.
1875 * Note that the order of the output array is not guaranteed to be
1876 * consistent across different JS platforms.
1877 */
1878export function toPairs<S>(obj: { [k: string]: S } | { [k: number]: S }): Array<[string, S]>;
1879
1880/**
1881 * Converts an object into an array of key, value arrays.
1882 * The object's own properties and prototype properties are used.
1883 * Note that the order of the output array is not guaranteed to be
1884 * consistent across different JS platforms.
1885 */
1886export function toPairsIn<S>(obj: { [k: string]: S } | { [k: number]: S }): Array<[string, S]>;
1887
1888/**
1889 * Returns the string representation of the given value. eval'ing the output should
1890 * result in a value equivalent to the input value. Many of the built-in toString
1891 * methods do not satisfy this requirement.
1892 *
1893 * If the given value is an [object Object] with a toString method other than
1894 * Object.prototype.toString, this method is invoked with no arguments to produce the
1895 * return value. This means user-defined constructor functions can provide a suitable
1896 * toString method.
1897 */
1898export function toString<T>(val: T): string;
1899
1900/**
1901 * The upper case version of a string.
1902 */
1903export function toUpper(str: string): string;
1904
1905/**
1906 * Initializes a transducer using supplied iterator function. Returns a single item by iterating through the
1907 * list, successively calling the transformed iterator function and passing it an accumulator value and the
1908 * current value from the array, and then passing the result to the next call.
1909 */
1910export function transduce<T, U>(xf: (arg: readonly T[]) => T[], fn: (acc: readonly U[], val: U) => U[], acc: readonly T[], list: readonly T[]): U;
1911export function transduce<T, U>(xf: (arg: readonly T[]) => T[]): (fn: (acc: readonly U[], val: U) => U[], acc: readonly T[], list: readonly T[]) => U;
1912export function transduce<T, U>(xf: (arg: readonly T[]) => T[], fn: (acc: readonly U[], val: U) => U[]): (acc: readonly T[], list: readonly T[]) => U;
1913export function transduce<T, U>(xf: (arg: readonly T[]) => T[], fn: (acc: readonly U[], val: U) => U[], acc: readonly T[]): (list: readonly T[]) => U;
1914
1915/**
1916 * Transposes the rows and columns of a 2D list. When passed a list of n lists of length x, returns a list of x lists of length n.
1917 */
1918export function transpose<T>(list: readonly T[][]): T[][];
1919
1920/**
1921 * Maps an Applicative-returning function over a Traversable, then uses
1922 * sequence to transform the resulting Traversable of Applicative into
1923 * an Applicative of Traversable.
1924 */
1925export function traverse<A, B>(of: (a: B) => B[], fn: (t: A) => B[], list: readonly A[]): B[][];
1926export function traverse<A, B>(of: (a: B) => B[], fn: (t: A) => B[]): (list: readonly A[]) => B[][];
1927export function traverse<A, B>(of: (a: B) => B[]): (fn: (t: A) => B[], list: readonly A[]) => B[][];
1928
1929/**
1930 * Removes (strips) whitespace from both ends of the string.
1931 */
1932export function trim(str: string): string;
1933
1934/**
1935 * tryCatch takes two functions, a tryer and a catcher. The returned function evaluates the tryer; if it does
1936 * not throw, it simply returns the result. If the tryer does throw, the returned function evaluates the catcher
1937 * function and returns its result. Note that for effective composition with this function, both the tryer and
1938 * catcher functions must return the same type of results.
1939 */
1940export function tryCatch<T>(tryer: (...args: readonly any[]) => T, catcher: (...args: readonly any[]) => T): (...args: readonly any[]) => T;
1941
1942/**
1943 * Gives a single-word string description of the (native) type of a value, returning such answers as 'Object',
1944 * 'Number', 'Array', or 'Null'. Does not attempt to distinguish user Object types any further, reporting them
1945 * all as 'Object'.
1946 */
1947export function type(val: any): 'Object' | 'Number' | 'Boolean' | 'String' | 'Null' | 'Array' | 'RegExp' | 'Function' | 'Undefined';
1948
1949/**
1950 * Takes a function fn, which takes a single array argument, and returns a function which:
1951 * - takes any number of positional arguments;
1952 * - passes these arguments to fn as an array; and
1953 * - returns the result.
1954 * In other words, R.unapply derives a variadic function from a function which takes an array.
1955 * R.unapply is the inverse of R.apply.
1956 */
1957export function unapply<T>(fn: (args: readonly any[]) => T): (...args: readonly any[]) => T;
1958
1959/**
1960 * Wraps a function of any arity (including nullary) in a function that accepts exactly 1 parameter.
1961 * Any extraneous parameters will not be passed to the supplied function.
1962 */
1963export function unary<T>(fn: (a: T, ...args: readonly any[]) => any): (a: T) => any;
1964
1965/**
1966 * Returns a function of arity n from a (manually) curried function.
1967 */
1968export function uncurryN<T>(len: number, fn: (a: any) => any): (...a: readonly any[]) => T;
1969
1970/**
1971 * Builds a list from a seed value. Accepts an iterator function, which returns either false
1972 * to stop iteration or an array of length 2 containing the value to add to the resulting
1973 * list and the seed to be used in the next call to the iterator function.
1974 */
1975export function unfold<T, TResult>(fn: (seed: T) => [TResult, T] | false, seed: T): TResult[];
1976export function unfold<T, TResult>(fn: (seed: T) => [TResult, T] | false): (seed: T) => TResult[];
1977
1978/**
1979 * Combines two lists into a set (i.e. no duplicates) composed of the
1980 * elements of each list.
1981 */
1982export function union<T>(as: readonly T[], bs: readonly T[]): T[];
1983export function union<T>(as: readonly T[]): (bs: readonly T[]) => T[];
1984
1985/**
1986 * Combines two lists into a set (i.e. no duplicates) composed of the elements of each list. Duplication is
1987 * determined according to the value returned by applying the supplied predicate to two list elements.
1988 */
1989export function unionWith<T>(pred: (a: T, b: T) => boolean, list1: readonly T[], list2: readonly T[]): T[];
1990export function unionWith<T>(pred: (a: T, b: T) => boolean): _.F.Curry<(a: readonly T[], b: readonly T[]) => T[]>;
1991
1992/**
1993 * Returns a new list containing only one copy of each element in the original list.
1994 */
1995export function uniq<T>(list: readonly T[]): T[];
1996
1997/**
1998 * Returns a new list containing only one copy of each element in the original list,
1999 * based upon the value returned by applying the supplied function to each list element.
2000 * Prefers the first item if the supplied function produces the same value on two items.
2001 * R.equals is used for comparison.
2002 */
2003export function uniqBy<T, U>(fn: (a: T) => U, list: readonly T[]): T[];
2004export function uniqBy<T, U>(fn: (a: T) => U): (list: readonly T[]) => T[];
2005
2006/**
2007 * Returns a new list containing only one copy of each element in the original list, based upon the value
2008 * returned by applying the supplied predicate to two list elements.
2009 */
2010export function uniqWith<T, U>(pred: (x: T, y: T) => boolean, list: readonly T[]): T[];
2011export function uniqWith<T, U>(pred: (x: T, y: T) => boolean): (list: readonly T[]) => T[];
2012
2013/**
2014 * Tests the final argument by passing it to the given predicate function. If the predicate is not satisfied,
2015 * the function will return the result of calling the whenFalseFn function with the same argument. If the
2016 * predicate is satisfied, the argument is returned as is.
2017 */
2018export function unless<T, U>(pred: (a: T) => boolean, whenFalseFn: (a: T) => U, obj: T): U;
2019export function unless<T, U>(pred: (a: T) => boolean, whenFalseFn: (a: T) => U): (obj: T) => U;
2020
2021/**
2022 * Returns a new list by pulling every item at the first level of nesting out, and putting
2023 * them in a new array.
2024 */
2025export function unnest<T extends readonly any[]>(list: T): _.T.UnNest<T>;
2026
2027/**
2028 * Takes a predicate, a transformation function, and an initial value, and returns a value of the same type as
2029 * the initial value. It does so by applying the transformation until the predicate is satisfied, at which point
2030 * it returns the satisfactory value.
2031 */
2032export function until<T, U>(pred: (val: T) => boolean, fn: (val: T) => U, init: U): U;
2033export function until<T, U>(pred: (val: T) => boolean, fn: (val: T) => U): (init: U) => U;
2034
2035/**
2036 * Returns a new copy of the array with the element at the provided index replaced with the given value.
2037 */
2038export function update<T>(index: number, value: T, list: readonly T[]): T[];
2039export function update<T>(index: number, value: T): (list: readonly T[]) => T[];
2040
2041/**
2042 * Accepts a function fn and a list of transformer functions and returns a new curried function.
2043 * When the new function is invoked, it calls the function fn with parameters consisting of the
2044 * result of calling each supplied handler on successive arguments to the new function.
2045 *
2046 * If more arguments are passed to the returned function than transformer functions, those arguments
2047 * are passed directly to fn as additional parameters. If you expect additional arguments that don't
2048 * need to be transformed, although you can ignore them, it's best to pass an identity function so
2049 * that the new function reports the correct arity.
2050 */
2051export function useWith(fn: ((...a: readonly any[]) => any), transformers: Array<((...a: readonly any[]) => any)>): (...a: readonly any[]) => any;
2052
2053/**
2054 * Returns a list of all the enumerable own properties of the supplied object.
2055 * Note that the order of the output array is not guaranteed across
2056 * different JS platforms.
2057 */
2058export function values<T extends object, K extends keyof T>(obj: T): Array<T[K]>;
2059
2060/**
2061 * Returns a list of all the properties, including prototype properties, of the supplied
2062 * object. Note that the order of the output array is not guaranteed to be consistent across different JS platforms.
2063 */
2064export function valuesIn<T>(obj: any): T[];
2065
2066/**
2067 * Returns a "view" of the given data structure, determined by the given lens. The lens's focus determines which
2068 * portion of the data structure is visible.
2069 */
2070export function view<T, U>(lens: Lens): (obj: T) => U;
2071export function view<T, U>(lens: Lens, obj: T): U;
2072
2073/**
2074 * Tests the final argument by passing it to the given predicate function. If the predicate is satisfied, the function
2075 * will return the result of calling the whenTrueFn function with the same argument. If the predicate is not satisfied,
2076 * the argument is returned as is.
2077 */
2078export function when<T, U>(pred: (a: T) => boolean, whenTrueFn: (a: T) => U, obj: T): U;
2079export function when<T, U>(pred: (a: T) => boolean, whenTrueFn: (a: T) => U): (obj: T) => U;
2080
2081/**
2082 * Takes a spec object and a test object and returns true if the test satisfies the spec.
2083 * Any property on the spec that is not a function is interpreted as an equality
2084 * relation.
2085 *
2086 * If the spec has a property mapped to a function, then `where` evaluates the function, passing in
2087 * the test object's value for the property in question, as well as the whole test object.
2088 *
2089 * `where` is well suited to declaratively expressing constraints for other functions, e.g.,
2090 * `filter`, `find`, `pickWith`, etc.
2091 */
2092export function where<T, U>(spec: T, testObj: U): boolean;
2093export function where<T>(spec: T): <U>(testObj: U) => boolean;
2094export function where<ObjFunc2, U>(spec: ObjFunc2, testObj: U): boolean;
2095export function where<ObjFunc2>(spec: ObjFunc2): <U>(testObj: U) => boolean;
2096
2097/**
2098 * Takes a spec object and a test object; returns true if the test satisfies the spec,
2099 * false otherwise. An object satisfies the spec if, for each of the spec's own properties,
2100 * accessing that property of the object gives the same value (in R.eq terms) as accessing
2101 * that property of the spec.
2102 */
2103export function whereEq<T, U>(spec: T, obj: U): boolean;
2104export function whereEq<T>(spec: T): <U>(obj: U) => boolean;
2105
2106/**
2107 * Returns a new list without values in the first argument. R.equals is used to determine equality.
2108 * Acts as a transducer if a transformer is given in list position.
2109 */
2110export function without<T>(list1: readonly T[], list2: readonly T[]): T[];
2111export function without<T>(list1: readonly T[]): (list2: readonly T[]) => T[];
2112
2113/**
2114 * Creates a new list out of the two supplied by creating each possible pair from the lists.
2115 */
2116export function xprod<K, V>(as: readonly K[], bs: readonly V[]): Array<KeyValuePair<K, V>>;
2117export function xprod<K>(as: readonly K[]): <V>(bs: readonly V[]) => Array<KeyValuePair<K, V>>;
2118
2119/**
2120 * Creates a new list out of the two supplied by pairing up equally-positioned items from
2121 * both lists. Note: `zip` is equivalent to `zipWith(function(a, b) { return [a, b] })`.
2122 */
2123export function zip<K, V>(list1: readonly K[], list2: readonly V[]): Array<KeyValuePair<K, V>>;
2124export function zip<K>(list1: readonly K[]): <V>(list2: readonly V[]) => Array<KeyValuePair<K, V>>;
2125
2126/**
2127 * Creates a new object out of a list of keys and a list of values.
2128 */
2129// TODO: Dictionary<T> as a return value is to specific, any seems to loose
2130export function zipObj<T>(keys: readonly string[], values: readonly T[]): { [index: string]: T };
2131export function zipObj(keys: readonly string[]): <T>(values: readonly T[]) => { [index: string]: T };
2132export function zipObj<T>(keys: readonly number[], values: readonly T[]): { [index: number]: T };
2133export function zipObj(keys: readonly number[]): <T>(values: readonly T[]) => { [index: number]: T };
2134
2135/**
2136 * Creates a new list out of the two supplied by applying the function to each
2137 * equally-positioned pair in the lists.
2138 */
2139export function zipWith<T, U, TResult>(fn: (x: T, y: U) => TResult, list1: readonly T[], list2: readonly U[]): TResult[];
2140export function zipWith<T, U, TResult>(fn: (x: T, y: U) => TResult, list1: readonly T[]): (list2: readonly U[]) => TResult[];
2141export function zipWith<T, U, TResult>(fn: (x: T, y: U) => TResult): (list1: readonly T[], list2: readonly U[]) => TResult[];
2142
2143export as namespace R