UNPKG

146 kBTypeScriptView Raw
1// Type definitions for ramda 0.26
2// Project: https://github.com/donnut/typescript-ramda, 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// Jack Leigh <https://github.com/leighman>
18// Tomas Szabo <https://github.com/deftomat>
19// Bonggyun Lee <https://github.com/deptno>
20// Maciek Blim <https://github.com/blimusiek>
21// Marcin Biernat <https://github.com/biern>
22// Rayhaneh Banyassady <https://github.com/rayhaneh>
23// Ryan McCuaig <https://github.com/rgm>
24// Drew Wyatt <https://github.com/drewwyatt>
25// John Ottenlips <https://github.com/jottenlips>
26// Nitesh Phadatare <https://github.com/minitesh>
27// Krantisinh Deshmukh <https://github.com/krantisinh>
28// Pierre-Antoine Mills <https://github.com/pirix-gh>
29// Brekk Bockrath <https://github.com/brekk>
30// Aram Kharazyan <https://github.com/nemo108>
31// Jituan Lin <https://github.com/jituanlin>
32// Philippe Mills <https://github.com/Philippe-mills>
33// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
34// TypeScript Version: 3.5
35
36/// <reference path="./es/add.d.ts" />
37/// <reference path="./es/addIndex.d.ts" />
38/// <reference path="./es/adjust.d.ts" />
39/// <reference path="./es/all.d.ts" />
40/// <reference path="./es/allPass.d.ts" />
41/// <reference path="./es/always.d.ts" />
42/// <reference path="./es/and.d.ts" />
43/// <reference path="./es/any.d.ts" />
44/// <reference path="./es/anyPass.d.ts" />
45/// <reference path="./es/ap.d.ts" />
46/// <reference path="./es/aperture.d.ts" />
47/// <reference path="./es/append.d.ts" />
48/// <reference path="./es/apply.d.ts" />
49/// <reference path="./es/applySpec.d.ts" />
50/// <reference path="./es/applyTo.d.ts" />
51/// <reference path="./es/ascend.d.ts" />
52/// <reference path="./es/assoc.d.ts" />
53/// <reference path="./es/assocPath.d.ts" />
54/// <reference path="./es/binary.d.ts" />
55/// <reference path="./es/bind.d.ts" />
56/// <reference path="./es/both.d.ts" />
57/// <reference path="./es/call.d.ts" />
58/// <reference path="./es/chain.d.ts" />
59/// <reference path="./es/clamp.d.ts" />
60/// <reference path="./es/clone.d.ts" />
61/// <reference path="./es/comparator.d.ts" />
62/// <reference path="./es/complement.d.ts" />
63/// <reference path="./es/compose.d.ts" />
64/// <reference path="./es/composeK.d.ts" />
65/// <reference path="./es/composeP.d.ts" />
66/// <reference path="./es/composeWith.d.ts" />
67/// <reference path="./es/concat.d.ts" />
68/// <reference path="./es/cond.d.ts" />
69/// <reference path="./es/construct.d.ts" />
70/// <reference path="./es/constructN.d.ts" />
71/// <reference path="./es/contains.d.ts" />
72/// <reference path="./es/converge.d.ts" />
73/// <reference path="./es/countBy.d.ts" />
74/// <reference path="./es/curry.d.ts" />
75/// <reference path="./es/curryN.d.ts" />
76/// <reference path="./es/dec.d.ts" />
77/// <reference path="./es/defaultTo.d.ts" />
78/// <reference path="./es/descend.d.ts" />
79/// <reference path="./es/difference.d.ts" />
80/// <reference path="./es/differenceWith.d.ts" />
81/// <reference path="./es/dissoc.d.ts" />
82/// <reference path="./es/dissocPath.d.ts" />
83/// <reference path="./es/divide.d.ts" />
84/// <reference path="./es/drop.d.ts" />
85/// <reference path="./es/dropLast.d.ts" />
86/// <reference path="./es/dropLastWhile.d.ts" />
87/// <reference path="./es/dropRepeats.d.ts" />
88/// <reference path="./es/dropRepeatsWith.d.ts" />
89/// <reference path="./es/either.d.ts" />
90/// <reference path="./es/empty.d.ts" />
91/// <reference path="./es/endsWith.d.ts" />
92/// <reference path="./es/eqBy.d.ts" />
93/// <reference path="./es/eqProps.d.ts" />
94/// <reference path="./es/equals.d.ts" />
95/// <reference path="./es/evolve.d.ts" />
96/// <reference path="./es/F.d.ts" />
97/// <reference path="./es/filter.d.ts" />
98/// <reference path="./es/find.d.ts" />
99/// <reference path="./es/findIndex.d.ts" />
100/// <reference path="./es/findLast.d.ts" />
101/// <reference path="./es/findLastIndex.d.ts" />
102/// <reference path="./es/flatten.d.ts" />
103/// <reference path="./es/flip.d.ts" />
104/// <reference path="./es/forEach.d.ts" />
105/// <reference path="./es/forEachObjIndexed.d.ts" />
106/// <reference path="./es/fromPairs.d.ts" />
107/// <reference path="./es/groupBy.d.ts" />
108/// <reference path="./es/groupWith.d.ts" />
109/// <reference path="./es/gt.d.ts" />
110/// <reference path="./es/gte.d.ts" />
111/// <reference path="./es/has.d.ts" />
112/// <reference path="./es/hasIn.d.ts" />
113/// <reference path="./es/hasPath.d.ts" />
114/// <reference path="./es/head.d.ts" />
115/// <reference path="./es/identical.d.ts" />
116/// <reference path="./es/identity.d.ts" />
117/// <reference path="./es/ifElse.d.ts" />
118/// <reference path="./es/inc.d.ts" />
119/// <reference path="./es/indexBy.d.ts" />
120/// <reference path="./es/indexOf.d.ts" />
121/// <reference path="./es/init.d.ts" />
122/// <reference path="./es/innerJoin.d.ts" />
123/// <reference path="./es/insertAll.d.ts" />
124/// <reference path="./es/insert.d.ts" />
125/// <reference path="./es/intersection.d.ts" />
126/// <reference path="./es/intersectionWith.d.ts" />
127/// <reference path="./es/intersperse.d.ts" />
128/// <reference path="./es/into.d.ts" />
129/// <reference path="./es/invert.d.ts" />
130/// <reference path="./es/invertObj.d.ts" />
131/// <reference path="./es/invoker.d.ts" />
132/// <reference path="./es/is.d.ts" />
133/// <reference path="./es/isEmpty.d.ts" />
134/// <reference path="./es/isNil.d.ts" />
135/// <reference path="./es/join.d.ts" />
136/// <reference path="./es/juxt.d.ts" />
137/// <reference path="./es/keys.d.ts" />
138/// <reference path="./es/keysIn.d.ts" />
139/// <reference path="./es/last.d.ts" />
140/// <reference path="./es/lastIndexOf.d.ts" />
141/// <reference path="./es/length.d.ts" />
142/// <reference path="./es/lens.d.ts" />
143/// <reference path="./es/lensIndex.d.ts" />
144/// <reference path="./es/lensPath.d.ts" />
145/// <reference path="./es/lensProp.d.ts" />
146/// <reference path="./es/lift.d.ts" />
147/// <reference path="./es/lt.d.ts" />
148/// <reference path="./es/lte.d.ts" />
149/// <reference path="./es/mapAccum.d.ts" />
150/// <reference path="./es/mapAccumRight.d.ts" />
151/// <reference path="./es/map.d.ts" />
152/// <reference path="./es/mapObjIndexed.d.ts" />
153/// <reference path="./es/match.d.ts" />
154/// <reference path="./es/mathMod.d.ts" />
155/// <reference path="./es/maxBy.d.ts" />
156/// <reference path="./es/max.d.ts" />
157/// <reference path="./es/mean.d.ts" />
158/// <reference path="./es/median.d.ts" />
159/// <reference path="./es/memoizeWith.d.ts" />
160/// <reference path="./es/mergeAll.d.ts" />
161/// <reference path="./es/mergeDeepLeft.d.ts" />
162/// <reference path="./es/mergeDeepRight.d.ts" />
163/// <reference path="./es/mergeDeepWith.d.ts" />
164/// <reference path="./es/mergeDeepWithKey.d.ts" />
165/// <reference path="./es/mergeLeft.d.ts" />
166/// <reference path="./es/mergeRight.d.ts" />
167/// <reference path="./es/merge.d.ts" />
168/// <reference path="./es/mergeWith.d.ts" />
169/// <reference path="./es/mergeWithKey.d.ts" />
170/// <reference path="./es/minBy.d.ts" />
171/// <reference path="./es/min.d.ts" />
172/// <reference path="./es/modulo.d.ts" />
173/// <reference path="./es/move.d.ts" />
174/// <reference path="./es/multiply.d.ts" />
175/// <reference path="./es/nAry.d.ts" />
176/// <reference path="./es/negate.d.ts" />
177/// <reference path="./es/none.d.ts" />
178/// <reference path="./es/not.d.ts" />
179/// <reference path="./es/nthArg.d.ts" />
180/// <reference path="./es/nth.d.ts" />
181/// <reference path="./es/objOf.d.ts" />
182/// <reference path="./es/of.d.ts" />
183/// <reference path="./es/omit.d.ts" />
184/// <reference path="./es/once.d.ts" />
185/// <reference path="./es/or.d.ts" />
186/// <reference path="./es/over.d.ts" />
187/// <reference path="./es/otherwise.d.ts" />
188/// <reference path="./es/pair.d.ts" />
189/// <reference path="./es/partial.d.ts" />
190/// <reference path="./es/partialRight.d.ts" />
191/// <reference path="./es/partition.d.ts" />
192/// <reference path="./es/path.d.ts" />
193/// <reference path="./es/pathEq.d.ts" />
194/// <reference path="./es/pathOr.d.ts" />
195/// <reference path="./es/pathSatisfies.d.ts" />
196/// <reference path="./es/pickAll.d.ts" />
197/// <reference path="./es/pickBy.d.ts" />
198/// <reference path="./es/pick.d.ts" />
199/// <reference path="./es/pipe.d.ts" />
200/// <reference path="./es/pipeK.d.ts" />
201/// <reference path="./es/pipeP.d.ts" />
202/// <reference path="./es/pipeWith.d.ts" />
203/// <reference path="./es/pluck.d.ts" />
204/// <reference path="./es/prepend.d.ts" />
205/// <reference path="./es/product.d.ts" />
206/// <reference path="./es/project.d.ts" />
207/// <reference path="./es/prop.d.ts" />
208/// <reference path="./es/propEq.d.ts" />
209/// <reference path="./es/propIs.d.ts" />
210/// <reference path="./es/propOr.d.ts" />
211/// <reference path="./es/propSatisfies.d.ts" />
212/// <reference path="./es/props.d.ts" />
213/// <reference path="./es/range.d.ts" />
214/// <reference path="./es/reduceBy.d.ts" />
215/// <reference path="./es/reduced.d.ts" />
216/// <reference path="./es/reduce.d.ts" />
217/// <reference path="./es/reduceRight.d.ts" />
218/// <reference path="./es/reduceWhile.d.ts" />
219/// <reference path="./es/reject.d.ts" />
220/// <reference path="./es/remove.d.ts" />
221/// <reference path="./es/repeat.d.ts" />
222/// <reference path="./es/replace.d.ts" />
223/// <reference path="./es/reverse.d.ts" />
224/// <reference path="./es/scan.d.ts" />
225/// <reference path="./es/set.d.ts" />
226/// <reference path="./es/slice.d.ts" />
227/// <reference path="./es/sortBy.d.ts" />
228/// <reference path="./es/sort.d.ts" />
229/// <reference path="./es/sortWith.d.ts" />
230/// <reference path="./es/splitAt.d.ts" />
231/// <reference path="./es/split.d.ts" />
232/// <reference path="./es/splitEvery.d.ts" />
233/// <reference path="./es/splitWhen.d.ts" />
234/// <reference path="./es/startsWith.d.ts" />
235/// <reference path="./es/subtract.d.ts" />
236/// <reference path="./es/sum.d.ts" />
237/// <reference path="./es/symmetricDifference.d.ts" />
238/// <reference path="./es/symmetricDifferenceWith.d.ts" />
239/// <reference path="./es/tail.d.ts" />
240/// <reference path="./es/take.d.ts" />
241/// <reference path="./es/takeLast.d.ts" />
242/// <reference path="./es/takeLastWhile.d.ts" />
243/// <reference path="./es/takeWhile.d.ts" />
244/// <reference path="./es/tap.d.ts" />
245/// <reference path="./es/T.d.ts" />
246/// <reference path="./es/test.d.ts" />
247/// <reference path="./es/then.d.ts" />
248/// <reference path="./es/thunkify.d.ts" />
249/// <reference path="./es/times.d.ts" />
250/// <reference path="./es/toLower.d.ts" />
251/// <reference path="./es/toPairs.d.ts" />
252/// <reference path="./es/toPairsIn.d.ts" />
253/// <reference path="./es/toString.d.ts" />
254/// <reference path="./es/toUpper.d.ts" />
255/// <reference path="./es/transduce.d.ts" />
256/// <reference path="./es/transpose.d.ts" />
257/// <reference path="./es/traverse.d.ts" />
258/// <reference path="./es/trim.d.ts" />
259/// <reference path="./es/tryCatch.d.ts" />
260/// <reference path="./es/type.d.ts" />
261/// <reference path="./es/unapply.d.ts" />
262/// <reference path="./es/unary.d.ts" />
263/// <reference path="./es/uncurryN.d.ts" />
264/// <reference path="./es/unfold.d.ts" />
265/// <reference path="./es/union.d.ts" />
266/// <reference path="./es/unionWith.d.ts" />
267/// <reference path="./es/uniqBy.d.ts" />
268/// <reference path="./es/uniq.d.ts" />
269/// <reference path="./es/uniqWith.d.ts" />
270/// <reference path="./es/unless.d.ts" />
271/// <reference path="./es/unnest.d.ts" />
272/// <reference path="./es/until.d.ts" />
273/// <reference path="./es/update.d.ts" />
274/// <reference path="./es/useWith.d.ts" />
275/// <reference path="./es/values.d.ts" />
276/// <reference path="./es/valuesIn.d.ts" />
277/// <reference path="./es/view.d.ts" />
278/// <reference path="./es/when.d.ts" />
279/// <reference path="./es/where.d.ts" />
280/// <reference path="./es/whereEq.d.ts" />
281/// <reference path="./es/without.d.ts" />
282/// <reference path="./es/xprod.d.ts" />
283/// <reference path="./es/zip.d.ts" />
284/// <reference path="./es/zipObj.d.ts" />
285/// <reference path="./es/zipWith.d.ts" />
286/// <reference path="./es/includes.d.ts" />
287/// <reference path="./tools.d.ts" />
288
289/// <reference path="./src/add.d.ts" />
290/// <reference path="./src/addIndex.d.ts" />
291/// <reference path="./src/adjust.d.ts" />
292/// <reference path="./src/all.d.ts" />
293/// <reference path="./src/allPass.d.ts" />
294/// <reference path="./src/always.d.ts" />
295/// <reference path="./src/and.d.ts" />
296/// <reference path="./src/any.d.ts" />
297/// <reference path="./src/anyPass.d.ts" />
298/// <reference path="./src/ap.d.ts" />
299/// <reference path="./src/aperture.d.ts" />
300/// <reference path="./src/append.d.ts" />
301/// <reference path="./src/apply.d.ts" />
302/// <reference path="./src/applySpec.d.ts" />
303/// <reference path="./src/applyTo.d.ts" />
304/// <reference path="./src/ascend.d.ts" />
305/// <reference path="./src/assoc.d.ts" />
306/// <reference path="./src/assocPath.d.ts" />
307/// <reference path="./src/binary.d.ts" />
308/// <reference path="./src/bind.d.ts" />
309/// <reference path="./src/both.d.ts" />
310/// <reference path="./src/call.d.ts" />
311/// <reference path="./src/chain.d.ts" />
312/// <reference path="./src/clamp.d.ts" />
313/// <reference path="./src/clone.d.ts" />
314/// <reference path="./src/comparator.d.ts" />
315/// <reference path="./src/complement.d.ts" />
316/// <reference path="./src/compose.d.ts" />
317/// <reference path="./src/composeK.d.ts" />
318/// <reference path="./src/composeP.d.ts" />
319/// <reference path="./src/composeWith.d.ts" />
320/// <reference path="./src/concat.d.ts" />
321/// <reference path="./src/cond.d.ts" />
322/// <reference path="./src/construct.d.ts" />
323/// <reference path="./src/constructN.d.ts" />
324/// <reference path="./src/contains.d.ts" />
325/// <reference path="./src/converge.d.ts" />
326/// <reference path="./src/countBy.d.ts" />
327/// <reference path="./src/curry.d.ts" />
328/// <reference path="./src/curryN.d.ts" />
329/// <reference path="./src/dec.d.ts" />
330/// <reference path="./src/defaultTo.d.ts" />
331/// <reference path="./src/descend.d.ts" />
332/// <reference path="./src/difference.d.ts" />
333/// <reference path="./src/differenceWith.d.ts" />
334/// <reference path="./src/dissoc.d.ts" />
335/// <reference path="./src/dissocPath.d.ts" />
336/// <reference path="./src/divide.d.ts" />
337/// <reference path="./src/drop.d.ts" />
338/// <reference path="./src/dropLast.d.ts" />
339/// <reference path="./src/dropLastWhile.d.ts" />
340/// <reference path="./src/dropRepeats.d.ts" />
341/// <reference path="./src/dropRepeatsWith.d.ts" />
342/// <reference path="./src/either.d.ts" />
343/// <reference path="./src/empty.d.ts" />
344/// <reference path="./src/endsWith.d.ts" />
345/// <reference path="./src/eqBy.d.ts" />
346/// <reference path="./src/eqProps.d.ts" />
347/// <reference path="./src/equals.d.ts" />
348/// <reference path="./src/evolve.d.ts" />
349/// <reference path="./src/F.d.ts" />
350/// <reference path="./src/filter.d.ts" />
351/// <reference path="./src/find.d.ts" />
352/// <reference path="./src/findIndex.d.ts" />
353/// <reference path="./src/findLast.d.ts" />
354/// <reference path="./src/findLastIndex.d.ts" />
355/// <reference path="./src/flatten.d.ts" />
356/// <reference path="./src/flip.d.ts" />
357/// <reference path="./src/forEach.d.ts" />
358/// <reference path="./src/forEachObjIndexed.d.ts" />
359/// <reference path="./src/fromPairs.d.ts" />
360/// <reference path="./src/groupBy.d.ts" />
361/// <reference path="./src/groupWith.d.ts" />
362/// <reference path="./src/gt.d.ts" />
363/// <reference path="./src/gte.d.ts" />
364/// <reference path="./src/has.d.ts" />
365/// <reference path="./src/hasIn.d.ts" />
366/// <reference path="./src/hasPath.d.ts" />
367/// <reference path="./src/head.d.ts" />
368/// <reference path="./src/identical.d.ts" />
369/// <reference path="./src/identity.d.ts" />
370/// <reference path="./src/ifElse.d.ts" />
371/// <reference path="./src/inc.d.ts" />
372/// <reference path="./src/indexBy.d.ts" />
373/// <reference path="./src/indexOf.d.ts" />
374/// <reference path="./src/init.d.ts" />
375/// <reference path="./src/innerJoin.d.ts" />
376/// <reference path="./src/insertAll.d.ts" />
377/// <reference path="./src/insert.d.ts" />
378/// <reference path="./src/intersection.d.ts" />
379/// <reference path="./src/intersectionWith.d.ts" />
380/// <reference path="./src/intersperse.d.ts" />
381/// <reference path="./src/into.d.ts" />
382/// <reference path="./src/invert.d.ts" />
383/// <reference path="./src/invertObj.d.ts" />
384/// <reference path="./src/invoker.d.ts" />
385/// <reference path="./src/is.d.ts" />
386/// <reference path="./src/isEmpty.d.ts" />
387/// <reference path="./src/isNil.d.ts" />
388/// <reference path="./src/join.d.ts" />
389/// <reference path="./src/juxt.d.ts" />
390/// <reference path="./src/keys.d.ts" />
391/// <reference path="./src/keysIn.d.ts" />
392/// <reference path="./src/last.d.ts" />
393/// <reference path="./src/lastIndexOf.d.ts" />
394/// <reference path="./src/length.d.ts" />
395/// <reference path="./src/lens.d.ts" />
396/// <reference path="./src/lensIndex.d.ts" />
397/// <reference path="./src/lensPath.d.ts" />
398/// <reference path="./src/lensProp.d.ts" />
399/// <reference path="./src/lift.d.ts" />
400/// <reference path="./src/lt.d.ts" />
401/// <reference path="./src/lte.d.ts" />
402/// <reference path="./src/mapAccum.d.ts" />
403/// <reference path="./src/mapAccumRight.d.ts" />
404/// <reference path="./src/map.d.ts" />
405/// <reference path="./src/mapObjIndexed.d.ts" />
406/// <reference path="./src/match.d.ts" />
407/// <reference path="./src/mathMod.d.ts" />
408/// <reference path="./src/maxBy.d.ts" />
409/// <reference path="./src/max.d.ts" />
410/// <reference path="./src/mean.d.ts" />
411/// <reference path="./src/median.d.ts" />
412/// <reference path="./src/memoizeWith.d.ts" />
413/// <reference path="./src/mergeAll.d.ts" />
414/// <reference path="./src/mergeDeepLeft.d.ts" />
415/// <reference path="./src/mergeDeepRight.d.ts" />
416/// <reference path="./src/mergeDeepWith.d.ts" />
417/// <reference path="./src/mergeDeepWithKey.d.ts" />
418/// <reference path="./src/mergeLeft.d.ts" />
419/// <reference path="./src/mergeRight.d.ts" />
420/// <reference path="./src/merge.d.ts" />
421/// <reference path="./src/mergeWith.d.ts" />
422/// <reference path="./src/mergeWithKey.d.ts" />
423/// <reference path="./src/minBy.d.ts" />
424/// <reference path="./src/min.d.ts" />
425/// <reference path="./src/modulo.d.ts" />
426/// <reference path="./src/move.d.ts" />
427/// <reference path="./src/multiply.d.ts" />
428/// <reference path="./src/nAry.d.ts" />
429/// <reference path="./src/negate.d.ts" />
430/// <reference path="./src/none.d.ts" />
431/// <reference path="./src/not.d.ts" />
432/// <reference path="./src/nthArg.d.ts" />
433/// <reference path="./src/nth.d.ts" />
434/// <reference path="./src/objOf.d.ts" />
435/// <reference path="./src/of.d.ts" />
436/// <reference path="./src/omit.d.ts" />
437/// <reference path="./src/once.d.ts" />
438/// <reference path="./src/or.d.ts" />
439/// <reference path="./src/over.d.ts" />
440/// <reference path="./src/otherwise.d.ts" />
441/// <reference path="./src/pair.d.ts" />
442/// <reference path="./src/partial.d.ts" />
443/// <reference path="./src/partialRight.d.ts" />
444/// <reference path="./src/partition.d.ts" />
445/// <reference path="./src/path.d.ts" />
446/// <reference path="./src/pathEq.d.ts" />
447/// <reference path="./src/pathOr.d.ts" />
448/// <reference path="./src/pathSatisfies.d.ts" />
449/// <reference path="./src/pickAll.d.ts" />
450/// <reference path="./src/pickBy.d.ts" />
451/// <reference path="./src/pick.d.ts" />
452/// <reference path="./src/pipe.d.ts" />
453/// <reference path="./src/pipeK.d.ts" />
454/// <reference path="./src/pipeP.d.ts" />
455/// <reference path="./src/pipeWith.d.ts" />
456/// <reference path="./src/pluck.d.ts" />
457/// <reference path="./src/prepend.d.ts" />
458/// <reference path="./src/product.d.ts" />
459/// <reference path="./src/project.d.ts" />
460/// <reference path="./src/prop.d.ts" />
461/// <reference path="./src/propEq.d.ts" />
462/// <reference path="./src/propIs.d.ts" />
463/// <reference path="./src/propOr.d.ts" />
464/// <reference path="./src/propSatisfies.d.ts" />
465/// <reference path="./src/props.d.ts" />
466/// <reference path="./src/range.d.ts" />
467/// <reference path="./src/reduceBy.d.ts" />
468/// <reference path="./src/reduced.d.ts" />
469/// <reference path="./src/reduce.d.ts" />
470/// <reference path="./src/reduceRight.d.ts" />
471/// <reference path="./src/reduceWhile.d.ts" />
472/// <reference path="./src/reject.d.ts" />
473/// <reference path="./src/remove.d.ts" />
474/// <reference path="./src/repeat.d.ts" />
475/// <reference path="./src/replace.d.ts" />
476/// <reference path="./src/reverse.d.ts" />
477/// <reference path="./src/scan.d.ts" />
478/// <reference path="./src/set.d.ts" />
479/// <reference path="./src/slice.d.ts" />
480/// <reference path="./src/sortBy.d.ts" />
481/// <reference path="./src/sort.d.ts" />
482/// <reference path="./src/sortWith.d.ts" />
483/// <reference path="./src/splitAt.d.ts" />
484/// <reference path="./src/split.d.ts" />
485/// <reference path="./src/splitEvery.d.ts" />
486/// <reference path="./src/splitWhen.d.ts" />
487/// <reference path="./src/startsWith.d.ts" />
488/// <reference path="./src/subtract.d.ts" />
489/// <reference path="./src/sum.d.ts" />
490/// <reference path="./src/symmetricDifference.d.ts" />
491/// <reference path="./src/symmetricDifferenceWith.d.ts" />
492/// <reference path="./src/tail.d.ts" />
493/// <reference path="./src/take.d.ts" />
494/// <reference path="./src/takeLast.d.ts" />
495/// <reference path="./src/takeLastWhile.d.ts" />
496/// <reference path="./src/takeWhile.d.ts" />
497/// <reference path="./src/tap.d.ts" />
498/// <reference path="./src/T.d.ts" />
499/// <reference path="./src/test.d.ts" />
500/// <reference path="./src/then.d.ts" />
501/// <reference path="./src/thunkify.d.ts" />
502/// <reference path="./src/times.d.ts" />
503/// <reference path="./src/toLower.d.ts" />
504/// <reference path="./src/toPairs.d.ts" />
505/// <reference path="./src/toPairsIn.d.ts" />
506/// <reference path="./src/toString.d.ts" />
507/// <reference path="./src/toUpper.d.ts" />
508/// <reference path="./src/transduce.d.ts" />
509/// <reference path="./src/transpose.d.ts" />
510/// <reference path="./src/traverse.d.ts" />
511/// <reference path="./src/trim.d.ts" />
512/// <reference path="./src/tryCatch.d.ts" />
513/// <reference path="./src/type.d.ts" />
514/// <reference path="./src/unapply.d.ts" />
515/// <reference path="./src/unary.d.ts" />
516/// <reference path="./src/uncurryN.d.ts" />
517/// <reference path="./src/unfold.d.ts" />
518/// <reference path="./src/union.d.ts" />
519/// <reference path="./src/unionWith.d.ts" />
520/// <reference path="./src/uniqBy.d.ts" />
521/// <reference path="./src/uniq.d.ts" />
522/// <reference path="./src/uniqWith.d.ts" />
523/// <reference path="./src/unless.d.ts" />
524/// <reference path="./src/unnest.d.ts" />
525/// <reference path="./src/until.d.ts" />
526/// <reference path="./src/update.d.ts" />
527/// <reference path="./src/useWith.d.ts" />
528/// <reference path="./src/values.d.ts" />
529/// <reference path="./src/valuesIn.d.ts" />
530/// <reference path="./src/view.d.ts" />
531/// <reference path="./src/when.d.ts" />
532/// <reference path="./src/where.d.ts" />
533/// <reference path="./src/whereEq.d.ts" />
534/// <reference path="./src/without.d.ts" />
535/// <reference path="./src/xprod.d.ts" />
536/// <reference path="./src/zip.d.ts" />
537/// <reference path="./src/zipObj.d.ts" />
538/// <reference path="./src/zipWith.d.ts" />
539/// <reference path="./src/includes.d.ts" />
540
541import { A, F, T, O } from "ts-toolbelt";
542
543declare let R: R.Static;
544
545declare namespace R {
546 import ValueOfRecord = Tools.ValueOfRecord;
547 type Omit<T, K extends string> = Pick<T, Exclude<keyof T, K>>;
548
549 type Ord = number | string | boolean | Date;
550
551 type Path = Array<(number | string)>;
552
553 type KeyValuePair<K, V> = [K, V];
554
555 interface Functor<T> {
556 map<U>(fn: (t: T) => U): Functor<U>;
557 }
558
559 interface ArrayLike {
560 nodeType: number;
561 }
562
563 type Arity0Fn = () => any;
564
565 type Arity1Fn = (a: any) => any;
566
567 type Arity2Fn = (a: any, b: any) => any;
568
569 interface ObjFunc {
570 [index: string]: (...a: readonly any[]) => any;
571 }
572
573 interface ObjFunc2 {
574 [index: string]: (x: any, y: any) => boolean;
575 }
576
577 type Pred = (...a: readonly any[]) => boolean;
578 type SafePred<T> = (...a: readonly T[]) => boolean;
579
580 type ObjPred = (value: any, key: string) => boolean;
581
582 interface Dictionary<T> {
583 [index: string]: T;
584 }
585
586 interface CharList extends String {
587 push(x: string): void;
588 }
589
590 interface Lens {
591 <T, U>(obj: T): U;
592 set<T, U>(str: string, obj: T): U;
593 }
594
595 interface Filter {
596 <T>(fn: (value: T) => boolean): FilterOnceApplied<T>;
597 <T, Kind extends 'array'>(fn: (value: T) => boolean): (list: readonly T[]) => T[];
598 <T, Kind extends 'object'>(fn: (value: T) => boolean): (list: Dictionary<T>) => Dictionary<T>;
599 <T>(fn: (value: T) => boolean, list: readonly T[]): T[];
600 <T>(fn: (value: T) => boolean, obj: Dictionary<T>): Dictionary<T>;
601 }
602
603 type FilterOnceApplied<T> =
604 <K extends T[] | Dictionary<T>>(source: K) =>
605 K extends Array<infer U> ? U[] :
606 K extends Dictionary<infer U> ? Dictionary<U> :
607 never;
608
609 type Evolve<O extends Evolvable<E>, E extends Evolver> = {
610 [P in keyof O]: P extends keyof E ? EvolveValue<O[P], E[P]> : O[P];
611 };
612
613 type EvolveValue<V, E> =
614 E extends (value: V) => any ? ReturnType<E> :
615 E extends Evolver ? EvolveNestedValue<V, E> :
616 never;
617
618 type EvolveNestedValue<V, E extends Evolver> =
619 V extends object ? (V extends Evolvable<E> ? Evolve<V, E> : never) : never;
620
621 interface Evolver {
622 [key: string]: ((value: any) => any) | Evolver;
623 }
624
625 // Represents all objects evolvable with Evolver E
626 type Evolvable<E extends Evolver> = {
627 [P in keyof E]?: Evolved<E[P]>;
628 };
629
630 type Evolved<T> =
631 T extends (value: infer V) => any ? V :
632 T extends Evolver ? Evolvable<T> :
633 never;
634
635 type Placeholder = A.x & {'@@functional/placeholder': true};
636
637 interface Reduced<T> {
638 '@@transducer/value': T;
639 '@@transducer/reduced': true;
640 }
641
642 type PipeWithFns<V0, T> = [
643 (x0: V0) => T
644 ] | [
645 (x0: V0) => any,
646 (x: any) => T
647 ] | [
648 (x0: V0) => any,
649 (x: any) => any,
650 (x: any) => T
651 ] | [
652 (x0: V0) => any,
653 (x: any) => any,
654 (x: any) => any,
655 (x: any) => T
656 ] | [
657 (x0: V0) => any,
658 (x: any) => any,
659 (x: any) => any,
660 (x: any) => any,
661 (x: any) => T
662 ] | [
663 (x0: V0) => any,
664 (x: any) => any,
665 (x: any) => any,
666 (x: any) => any,
667 (x: any) => any,
668 (x: any) => T
669 ] | [
670 (x0: V0) => any,
671 (x: any) => any,
672 (x: any) => any,
673 (x: any) => any,
674 (x: any) => any,
675 (x: any) => any,
676 (x: any) => T
677 ] | [
678 (x0: V0) => any,
679 (x: any) => any,
680 (x: any) => any,
681 (x: any) => any,
682 (x: any) => any,
683 (x: any) => any,
684 (x: any) => any,
685 (x: any) => T
686 ] | [
687 (x0: V0) => any,
688 (x: any) => any,
689 (x: any) => any,
690 (x: any) => any,
691 (x: any) => any,
692 (x: any) => any,
693 (x: any) => any,
694 (x: any) => any,
695 (x: any) => T
696 ] | [
697 (x0: V0) => any,
698 (x: any) => any,
699 (x: any) => any,
700 (x: any) => any,
701 (x: any) => any,
702 (x: any) => any,
703 (x: any) => any,
704 (x: any) => any,
705 (x: any) => any,
706 (x: any) => T
707 ];
708
709 type ComposeWithFns<V0, T> = [
710 (x0: V0) => T
711 ] | [
712 (x: any) => T,
713 (x: V0) => any
714 ] | [
715 (x: any) => T,
716 (x: any) => any,
717 (x: V0) => any
718 ] | [
719 (x: any) => T,
720 (x: any) => any,
721 (x: any) => any,
722 (x: V0) => any
723 ] | [
724 (x: any) => T,
725 (x: any) => any,
726 (x: any) => any,
727 (x: any) => any,
728 (x: V0) => any
729 ] | [
730 (x: any) => T,
731 (x: any) => any,
732 (x: any) => any,
733 (x: any) => any,
734 (x: any) => any,
735 (x: V0) => any
736 ] | [
737 (x: any) => T,
738 (x: any) => any,
739 (x: any) => any,
740 (x: any) => any,
741 (x: any) => any,
742 (x: any) => any,
743 (x: V0) => any
744 ] | [
745 (x: any) => T,
746 (x: any) => any,
747 (x: any) => any,
748 (x: any) => any,
749 (x: any) => any,
750 (x: any) => any,
751 (x: any) => any,
752 (x: V0) => any
753 ] | [
754 (x: any) => T,
755 (x: any) => any,
756 (x: any) => any,
757 (x: any) => any,
758 (x: any) => any,
759 (x: any) => any,
760 (x: any) => any,
761 (x: any) => any,
762 (x: V0) => any
763 ] | [
764 (x: any) => T,
765 (x: any) => any,
766 (x: any) => any,
767 (x: any) => any,
768 (x: any) => any,
769 (x: any) => any,
770 (x: any) => any,
771 (x: any) => any,
772 (x: any) => any,
773 (x: V0) => any
774 ];
775
776 interface AssocPartialOne<K extends keyof any> {
777 <T>(val: T): <U>(obj: U) => Record<K, T> & U;
778 <T, U>(val: T, obj: U): Record<K, T> & U;
779 }
780
781 interface Static {
782 /**
783 * Placeholder. When used with functions like curry, or op, the second argument is applied to the second
784 * position, and it returns a function waiting for its first argument.
785 */
786 __: 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 */
787
788 /**
789 * Adds two numbers (or strings). Equivalent to a + b but curried.
790 */
791 add(a: number, b: number): number;
792 add(a: string, b: string): string;
793 add(a: number): (b: number) => number;
794 add(a: string): (b: string) => string;
795
796 /**
797 * Creates a new list iteration function from an existing one by adding two new parameters to its callback
798 * function: the current index, and the entire list.
799 */
800 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[]>;
801 /* Special case for forEach */
802 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[]>;
803 /* Special case for reduce */
804 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>;
805
806 /**
807 * Applies a function to the value at the given index of an array, returning a new copy of the array with the
808 * element at the given index replaced with the result of the function application.
809 */
810 adjust<T>(index: number, fn: (a: T) => T, list: readonly T[]): T[];
811 adjust<T>(index: number, fn: (a: T) => T): (list: readonly T[]) => T[];
812
813 /**
814 * Returns true if all elements of the list match the predicate, false if there are any that don't.
815 */
816 all<T>(fn: (a: T) => boolean, list: readonly T[]): boolean;
817 all<T>(fn: (a: T) => boolean): (list: readonly T[]) => boolean;
818
819 /**
820 * Given a list of predicates, returns a new predicate that will be true exactly when all of them are.
821 */
822 allPass(preds: readonly Pred[]): Pred;
823
824 /**
825 * Returns a function that always returns the given value.
826 */
827 always<T>(val: T): () => T;
828
829 /**
830 * A function that returns the first argument if it's falsy otherwise the second argument. Note that this is
831 * NOT short-circuited, meaning that if expressions are passed they are both evaluated.
832 */
833 and<T extends { and?: ((...a: readonly any[]) => any); } | number | boolean | string | null>(fn1: T, val2: any): boolean;
834 and<T extends { and?: ((...a: readonly any[]) => any); } | number | boolean | string | null>(fn1: T): (val2: any) => boolean;
835
836 /**
837 * Returns true if at least one of elements of the list match the predicate, false otherwise.
838 */
839 any<T>(fn: (a: T) => boolean, list: readonly T[]): boolean;
840 any<T>(fn: (a: T) => boolean): (list: readonly T[]) => boolean;
841
842 /**
843 * Given a list of predicates returns a new predicate that will be true exactly when any one of them is.
844 */
845 anyPass<T>(preds: Array<SafePred<T>>): SafePred<T>;
846
847 /**
848 * ap applies a list of functions to a list of values.
849 */
850 ap<T, U>(fns: Array<((a: T) => U)>, vs: readonly T[]): U[];
851 ap<T, U>(fns: Array<((a: T) => U)>): (vs: readonly T[]) => U[];
852 ap<X0, X1, R>(
853 fn: (x1: X1, x0: X0) => R,
854 fn1: (x1: X1) => X0
855 ): (x1: X1) => R;
856
857 /**
858 * Returns a new list, composed of n-tuples of consecutive elements If n is greater than the length of the list,
859 * an empty list is returned.
860 */
861 aperture<T>(n: 1, list: readonly T[]): Array<[T]>;
862 aperture<T>(n: 2, list: readonly T[]): Array<[T, T]>;
863 aperture<T>(n: 3, list: readonly T[]): Array<[T, T, T]>;
864 aperture<T>(n: 4, list: readonly T[]): Array<[T, T, T, T]>;
865 aperture<T>(n: 5, list: readonly T[]): Array<[T, T, T, T, T]>;
866 aperture<T>(n: 6, list: readonly T[]): Array<[T, T, T, T, T, T]>;
867 aperture<T>(n: 7, list: readonly T[]): Array<[T, T, T, T, T, T, T]>;
868 aperture<T>(n: 8, list: readonly T[]): Array<[T, T, T, T, T, T, T, T]>;
869 aperture<T>(n: 9, list: readonly T[]): Array<[T, T, T, T, T, T, T, T, T]>;
870 aperture<T>(n: 10, list: readonly T[]): Array<[T, T, T, T, T, T, T, T, T, T]>;
871 aperture<T>(n: number, list: readonly T[]): T[][];
872 aperture(n: number): <T>(list: readonly T[]) => T[][];
873
874 /**
875 * Returns a new list containing the contents of the given list, followed by the given element.
876 */
877 append<T>(el: T, list: readonly T[]): T[];
878 append<T>(el: T): <T>(list: readonly T[]) => T[];
879
880 /**
881 * Applies function fn to the argument list args. This is useful for creating a fixed-arity function from
882 * a variadic function. fn should be a bound function if context is significant.
883 */
884 apply<T, U, TResult>(fn: (arg0: T, ...args: readonly T[]) => TResult, args: readonly U[]): TResult;
885 apply<T, TResult>(fn: (arg0: T, ...args: readonly T[]) => TResult): <U>(args: readonly U[]) => TResult;
886
887 /**
888 * Given a spec object recursively mapping properties to functions, creates a function producing an object
889 * of the same structure, by mapping each property to the result of calling its associated function with
890 * the supplied arguments.
891 */
892 applySpec<Obj extends Record<string, (...args: readonly any[]) => any>>(
893 obj: Obj
894 ): (
895 ...args: Parameters<ValueOfRecord<Obj>>
896 ) => { [Key in keyof Obj]: ReturnType<Obj[Key]> };
897 applySpec<T>(obj: any): (...args: readonly any[]) => T;
898
899 /**
900 * Takes a value and applies a function to it.
901 * This function is also known as the thrush combinator.
902 */
903 applyTo<T, U>(el: T, fn: (t: T) => U): U;
904 applyTo<T>(el: T): <U>(fn: (t: T) => U) => U;
905
906 /**
907 * Makes an ascending comparator function out of a function that returns a value that can be compared with < and >.
908 */
909 ascend<T>(fn: (obj: T) => any, a: T, b: T): number;
910 ascend<T>(fn: (obj: T) => any): (a: T, b: T) => number;
911
912 /**
913 * Makes a shallow clone of an object, setting or overriding the specified property with the given value.
914 */
915 assoc<T, U>(__: Placeholder, val: T, obj: U): <K extends string>(prop: K) => Record<K, T> & U;
916 assoc<U, K extends string>(prop: K, __: Placeholder, obj: U): <T>(val: T) => Record<K, T> & U;
917 assoc<T, U, K extends string>(prop: K, val: T, obj: U): Record<K, T> & U;
918 assoc<T, K extends string>(prop: K, val: T): <U>(obj: U) => Record<K, T> & U;
919 assoc<K extends string>(prop: K): AssocPartialOne<K>;
920
921 /**
922 * Makes a shallow clone of an object, setting or overriding the nodes required to create the given path, and
923 * placing the specific value at the tail end of that path.
924 */
925 assocPath<T, U>(__: Placeholder, val: T, obj: U): (path: Path) => U;
926 assocPath<T, U>(path: Path, __: Placeholder, obj: U): (val: T) => U;
927 assocPath<T, U>(path: Path, val: T, obj: U): U;
928 assocPath<T, U>(path: Path, val: T): (obj: U) => U;
929 assocPath<T, U>(path: Path): F.Curry<(a: T, b: U) => U>;
930
931 /**
932 * Wraps a function of any arity (including nullary) in a function that accepts exactly 2
933 * parameters. Any extraneous parameters will not be passed to the supplied function.
934 */
935 binary(fn: (...args: readonly any[]) => any): (...a: readonly any[]) => any;
936
937 /**
938 * Creates a function that is bound to a context. Note: R.bind does not provide the additional argument-binding
939 * capabilities of Function.prototype.bind.
940 */
941 bind<T>(fn: (...args: readonly any[]) => any, thisObj: T): (...args: readonly any[]) => any;
942
943 /**
944 * A function wrapping calls to the two functions in an && operation, returning the result of the first function
945 * if it is false-y and the result of the second function otherwise. Note that this is short-circuited, meaning
946 * that the second function will not be invoked if the first returns a false-y value.
947 */
948 both(pred1: Pred, pred2: Pred): Pred;
949 both(pred1: Pred): (pred2: Pred) => Pred;
950
951 /**
952 * Returns the result of calling its first argument with the remaining arguments. This is occasionally useful
953 * as a converging function for R.converge: the left branch can produce a function while the right branch
954 * produces a value to be passed to that function as an argument.
955 */
956 call(fn: (...args: readonly any[]) => (...args: readonly any[]) => any, ...args: readonly any[]): any;
957
958 /**
959 * `chain` maps a function over a list and concatenates the results.
960 * This implementation is compatible with the Fantasy-land Chain spec
961 */
962 chain<T, U>(fn: (n: T) => U[], list: readonly T[]): U[];
963 chain<T, U>(fn: (n: T) => U[]): (list: readonly T[]) => U[];
964 chain<X0, X1, R>(fn: (x0: X0, x1: X1) => R, fn1: (x1: X1) => X0): (x1: X1) => R;
965
966 /**
967 * Restricts a number to be within a range.
968 * Also works for other ordered types such as Strings and Date
969 */
970 clamp<T>(min: T, max: T, value: T): T;
971 clamp<T>(min: T, max: T): (value: T) => T;
972 clamp<T>(min: T): (max: T, value: T) => T;
973 clamp<T>(min: T): (max: T) => (value: T) => T;
974
975 /**
976 * Creates a deep copy of the value which may contain (nested) Arrays and Objects, Numbers, Strings, Booleans and Dates.
977 */
978 clone<T>(value: T): T;
979 clone<T>(value: readonly T[]): T[];
980
981 /**
982 * Makes a comparator function out of a function that reports whether the first element is less than the second.
983 */
984 // comparator(pred: (a: any, b: any) => boolean): (x: number, y: number) => number;
985 comparator<T>(pred: (a: T, b: T) => boolean): (x: T, y: T) => number;
986
987 /**
988 * Takes a function f and returns a function g such that:
989 * - applying g to zero or more arguments will give true if applying the same arguments to f gives
990 * a logical false value; and
991 * - applying g to zero or more arguments will give false if applying the same arguments to f gives
992 * a logical true value.
993 */
994 complement(pred: (...args: readonly any[]) => boolean): (...args: readonly any[]) => boolean;
995
996 /**
997 * Performs right-to-left function composition. The rightmost function may have any arity; the remaining
998 * functions must be unary.
999 */
1000
1001 // generic rest parameters in TS 3.0 allows writing a single variant for any number of Vx
1002 // compose<V extends any[], T1>(fn0: (...args: V) => T1): (...args: V) => T1;
1003 // compose<V extends any[], T1, T2>(fn1: (x: T1) => T2, fn0: (...args: V) => T1): (...args: V) => T2;
1004 // but requiring TS>=3.0 sounds like a breaking change, so just leaving a comment for the future
1005
1006 compose<T1>(fn0: () => T1): () => T1;
1007 compose<V0, T1>(fn0: (x0: V0) => T1): (x0: V0) => T1;
1008 compose<V0, V1, T1>(fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T1;
1009 compose<V0, V1, V2, T1>(fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T1;
1010
1011 compose<T1, T2>(fn1: (x: T1) => T2, fn0: () => T1): () => T2;
1012 compose<V0, T1, T2>(fn1: (x: T1) => T2, fn0: (x0: V0) => T1): (x0: V0) => T2;
1013 compose<V0, V1, T1, T2>(fn1: (x: T1) => T2, fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T2;
1014 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;
1015
1016 compose<T1, T2, T3>(fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: () => T1): () => T3;
1017 compose<V0, T1, T2, T3>(fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: (x: V0) => T1): (x: V0) => T3;
1018 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;
1019 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;
1020
1021 compose<T1, T2, T3, T4>(fn3: (x: T3) => T4, fn2: (x: T2) => T3, fn1: (x: T1) => T2, fn0: () => T1): () => T4;
1022 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;
1023 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;
1024 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;
1025
1026 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;
1027 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;
1028 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;
1029 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;
1030
1031 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;
1032 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;
1033 compose<V0, V1, T1, T2, T3, T4, T5, T6>(
1034 fn5: (x: T5) => T6,
1035 fn4: (x: T4) => T5,
1036 fn3: (x: T3) => T4,
1037 fn2: (x: T2) => T3,
1038 fn1: (x: T1) => T2,
1039 fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T6;
1040 compose<V0, V1, V2, T1, T2, T3, T4, T5, T6>(
1041 fn5: (x: T5) => T6,
1042 fn4: (x: T4) => T5,
1043 fn3: (x: T3) => T4,
1044 fn2: (x: T2) => T3,
1045 fn1: (x: T1) => T2,
1046 fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T6;
1047
1048 /**
1049 * Returns the right-to-left Kleisli composition of the provided functions, each of which must return a value of a type supported by chain.
1050 * The typings only support arrays for now.
1051 * All functions must be unary.
1052 * R.composeK(h, g, f) is equivalent to R.compose(R.chain(h), R.chain(g), f).
1053 *
1054 * @deprecated since 0.26 in favor of composeWith(chain)
1055 */
1056 composeK<V0, T1>(
1057 fn0: (x0: V0) => T1[]): (x0: V0) => T1[];
1058 composeK<V0, T1, T2>(
1059 fn1: (x: T1) => T2[],
1060 fn0: (x0: V0) => T1[]): (x0: V0) => T2[];
1061 composeK<V0, T1, T2, T3>(
1062 fn2: (x: T2) => T3[],
1063 fn1: (x: T1) => T2[],
1064 fn0: (x: V0) => T1[]): (x: V0) => T3[];
1065 composeK<V0, T1, T2, T3, T4>(
1066 fn3: (x: T3) => T4[],
1067 fn2: (x: T2) => T3[],
1068 fn1: (x: T1) => T2[],
1069 fn0: (x: V0) => T1[]): (x: V0) => T4[];
1070 composeK<V0, T1, T2, T3, T4, T5>(
1071 fn4: (x: T4) => T5[],
1072 fn3: (x: T3) => T4[],
1073 fn2: (x: T2) => T3[],
1074 fn1: (x: T1) => T2[],
1075 fn0: (x: V0) => T1[]): (x: V0) => T5[];
1076 composeK<V0, T1, T2, T3, T4, T5, T6>(
1077 fn5: (x: T5) => T6[],
1078 fn4: (x: T4) => T5[],
1079 fn3: (x: T3) => T4[],
1080 fn2: (x: T2) => T3[],
1081 fn1: (x: T1) => T2[],
1082 fn0: (x: V0) => T1[]): (x: V0) => T6[];
1083
1084 /**
1085 * Performs right-to-left composition of one or more Promise-returning functions.
1086 * All functions must be unary.
1087 *
1088 * @deprecated since 0.26 in favor of composeWith(then)
1089 */
1090 composeP<V0, T1>(
1091 fn0: (x0: V0) => Promise<T1>): (x0: V0) => Promise<T1>;
1092 composeP<V0, T1, T2>(
1093 fn1: (x: T1) => Promise<T2>,
1094 fn0: (x0: V0) => Promise<T1>): (x0: V0) => Promise<T2>;
1095 composeP<V0, T1, T2, T3>(
1096 fn2: (x: T2) => Promise<T3>,
1097 fn1: (x: T1) => Promise<T2>,
1098 fn0: (x: V0) => Promise<T1>): (x: V0) => Promise<T3>;
1099 composeP<V0, T1, T2, T3, T4>(
1100 fn3: (x: T3) => Promise<T4>,
1101 fn2: (x: T2) => Promise<T3>,
1102 fn1: (x: T1) => Promise<T2>,
1103 fn0: (x: V0) => Promise<T1>): (x: V0) => Promise<T4>;
1104 composeP<V0, T1, T2, T3, T4, T5>(
1105 fn4: (x: T4) => Promise<T5>,
1106 fn3: (x: T3) => Promise<T4>,
1107 fn2: (x: T2) => Promise<T3>,
1108 fn1: (x: T1) => Promise<T2>,
1109 fn0: (x: V0) => Promise<T1>):
1110 (x: V0) => Promise<T5>;
1111 composeP<V0, T1, T2, T3, T4, T5, T6>(
1112 fn5: (x: T5) => Promise<T6>,
1113 fn4: (x: T4) => Promise<T5>,
1114 fn3: (x: T3) => Promise<T4>,
1115 fn2: (x: T2) => Promise<T3>,
1116 fn1: (x: T1) => Promise<T2>,
1117 fn0: (x: V0) => Promise<T1>):
1118 (x: V0) => Promise<T6>;
1119
1120 /**
1121 * Performs right-to-left function composition using transforming function.
1122 * With the current typings, all functions must be unary.
1123 */
1124 composeWith<V0, T>(composer: (a: any) => any, fns: ComposeWithFns<V0, T>): (x0: V0) => T;
1125 composeWith(composer: (a: any) => any): <V0, T>(fns: ComposeWithFns<V0, T>) => (x: V0) => T;
1126
1127 /**
1128 * Returns a new list consisting of the elements of the first list followed by the elements
1129 * of the second.
1130 */
1131 concat<T>(placeholder: Placeholder): (list2: readonly T[], list1: readonly T[]) => T[];
1132 concat<T>(placeholder: Placeholder, list2: readonly T[]): (list1: readonly T[]) => T[];
1133 concat<T>(list1: readonly T[], list2: readonly T[]): T[];
1134 concat<T>(list1: readonly T[]): (list2: readonly T[]) => T[];
1135 concat(list1: string, list2: string): string;
1136 concat(list1: string): (list2: string) => string;
1137
1138 /**
1139 * Returns a function, fn, which encapsulates if/else-if/else logic. R.cond takes a list of [predicate, transform] pairs.
1140 * All of the arguments to fn are applied to each of the predicates in turn until one returns a "truthy" value, at which
1141 * point fn returns the result of applying its arguments to the corresponding transformer. If none of the predicates
1142 * matches, fn returns undefined.
1143 */
1144 cond(fns: Array<[Pred, (...a: readonly any[]) => any]>): (...a: readonly any[]) => any;
1145 cond<A, B>(fns: Array<[SafePred<A>, (...a: readonly A[]) => B]>): (...a: readonly A[]) => B;
1146
1147 /**
1148 * Wraps a constructor function inside a curried function that can be called with the same arguments and returns the same type.
1149 */
1150 construct<A extends any[], T>(constructor: { new(...a: A): T } | ((...a: A) => T)): (...a: A) => T;
1151
1152 /**
1153 * Wraps a constructor function inside a curried function that can be called with the same arguments and returns the same type.
1154 * The arity of the function returned is specified to allow using variadic constructor functions.
1155 */
1156 constructN<A extends any[], T>(n: number, constructor: { new(...a: A): T } | ((...a: A) => T)): (...a: Partial<A>) => T;
1157
1158 /**
1159 * Returns `true` if the specified item is somewhere in the list, `false` otherwise.
1160 * Equivalent to `indexOf(a)(list) > -1`. Uses strict (`===`) equality checking.
1161 *
1162 * @deprecated since 0.26 in favor of includes
1163 */
1164 contains(__: Placeholder, list: string): (a: string) => boolean;
1165 contains<T>(__: Placeholder, list: readonly T[]): (a: T) => boolean;
1166 contains(__: Placeholder): (list: string, a: string) => boolean;
1167 contains<T>(__: Placeholder): (list: readonly T[], a: T) => boolean;
1168 contains(a: string, list: string): boolean;
1169 contains<T>(a: T, list: readonly T[]): boolean;
1170 contains(a: string): (list: string) => boolean;
1171 contains<T>(a: T): (list: readonly T[]) => boolean;
1172
1173 /**
1174 * Accepts a converging function and a list of branching functions and returns a new
1175 * function. When invoked, this new function is applied to some arguments, each branching
1176 * function is applied to those same arguments. The results of each branching function
1177 * are passed as arguments to the converging function to produce the return value.
1178 */
1179 converge(after: ((...a: readonly any[]) => any), fns: Array<((...a: readonly any[]) => any)>): (...a: readonly any[]) => any;
1180
1181 /**
1182 * Counts the elements of a list according to how many match each value
1183 * of a key generated by the supplied function. Returns an object
1184 * mapping the keys produced by `fn` to the number of occurrences in
1185 * the list. Note that all keys are coerced to strings because of how
1186 * JavaScript objects work.
1187 */
1188 countBy<T>(fn: (a: T) => string | number, list: readonly T[]): { [index: string]: number };
1189 countBy<T>(fn: (a: T) => string | number): (list: readonly T[]) => { [index: string]: number };
1190
1191 /**
1192 * Returns a curried equivalent of the provided function. The curried function has two unusual capabilities.
1193 * First, its arguments needn't be provided one at a time.
1194 */
1195 curry<F extends (...args: any) => any>(f: F): F.Curry<F>;
1196
1197 /**
1198 * Returns a curried equivalent of the provided function, with the specified arity. The curried function has
1199 * two unusual capabilities. First, its arguments needn't be provided one at a time.
1200 */
1201 curryN(length: number, fn: (...args: readonly any[]) => any): (...a: readonly any[]) => any;
1202
1203 /**
1204 * Decrements its argument.
1205 */
1206 dec(n: number): number;
1207
1208 /**
1209 * Returns the second argument if it is not null or undefined. If it is null or undefined, the
1210 * first (default) argument is returned.
1211 */
1212 defaultTo<T, U>(a: T, b: U | null | undefined): T | U;
1213 defaultTo<T>(a: T): <U>(b: U | null | undefined) => T | U;
1214
1215 /**
1216 * Makes a descending comparator function out of a function that returns a value that can be compared with < and >.
1217 */
1218 descend<T>(fn: (obj: T) => any, a: T, b: T): number;
1219 descend<T>(fn: (obj: T) => any): (a: T, b: T) => number;
1220
1221 /**
1222 * Finds the set (i.e. no duplicates) of all elements in the first list not contained in the second list.
1223 */
1224 difference<T>(list1: readonly T[], list2: readonly T[]): T[];
1225 difference<T>(list1: readonly T[]): (list2: readonly T[]) => T[];
1226
1227 /**
1228 * Finds the set (i.e. no duplicates) of all elements in the first list not contained in the second list.
1229 * Duplication is determined according to the value returned by applying the supplied predicate to two list
1230 * elements.
1231 */
1232 differenceWith<T1, T2>(pred: (a: T1, b: T2) => boolean, list1: readonly T1[], list2: readonly T2[]): T1[];
1233 differenceWith<T1, T2>(pred: (a: T1, b: T2) => boolean): (list1: readonly T1[], list2: readonly T2[]) => T1[];
1234 differenceWith<T1, T2>(pred: (a: T1, b: T2) => boolean, list1: readonly T1[]): (list2: readonly T2[]) => T1[];
1235
1236 /*
1237 * Returns a new object that does not contain a prop property.
1238 */
1239 // It seems impossible to infer the return type, so this may to be specified explicitely
1240 dissoc<T>(prop: string, obj: any): T;
1241 dissoc(prop: string): <U>(obj: any) => U;
1242
1243 /**
1244 * Makes a shallow clone of an object, omitting the property at the given path.
1245 */
1246 dissocPath<T>(path: Path, obj: any): T;
1247 dissocPath<T>(path: Path): (obj: any) => T;
1248
1249 /**
1250 * Divides two numbers. Equivalent to a / b.
1251 */
1252 divide(__: Placeholder, b: number): (a: number) => number;
1253 divide(__: Placeholder): (b: number, a: number) => number;
1254 divide(a: number, b: number): number;
1255 divide(a: number): (b: number) => number;
1256
1257 /**
1258 * Returns a new list containing all but the first n elements of the given list.
1259 */
1260 drop<T>(n: number, xs: readonly T[]): T[];
1261 drop(n: number, xs: string): string;
1262 drop<T>(n: number): {
1263 (xs: string): string;
1264 (xs: readonly T[]): T[];
1265 };
1266
1267 /**
1268 * Returns a list containing all but the last n elements of the given list.
1269 */
1270 dropLast<T>(n: number, xs: readonly T[]): T[];
1271 dropLast(n: number, xs: string): string;
1272 dropLast<T>(n: number): {
1273 (xs: readonly T[]): T[];
1274 (xs: string): string;
1275 };
1276
1277 /**
1278 * Returns a new list containing all but last then elements of a given list, passing each value from the
1279 * right to the supplied predicate function, skipping elements while the predicate function returns true.
1280 */
1281 dropLastWhile<T>(fn: (a: T) => boolean, list: readonly T[]): T[];
1282 dropLastWhile<T>(fn: (a: T) => boolean): (list: readonly T[]) => T[];
1283
1284 /**
1285 * Returns a new list without any consecutively repeating elements. R.equals is used to determine equality.
1286 */
1287 dropRepeats<T>(list: readonly T[]): T[];
1288
1289 /**
1290 * Returns a new list without any consecutively repeating elements.
1291 * Equality is determined by applying the supplied predicate to each pair of consecutive elements.
1292 * The first element in a series of equal elements will be preserved.
1293 */
1294 dropRepeatsWith<T>(predicate: (left: T, right: T) => boolean, list: readonly T[]): T[];
1295 dropRepeatsWith<T>(predicate: (left: T, right: T) => boolean): (list: readonly T[]) => T[];
1296
1297 /**
1298 * Returns a new list containing the last n elements of a given list, passing each value to the supplied
1299 * predicate function, skipping elements while the predicate function returns true.
1300 */
1301 dropWhile<T>(fn: (a: T) => boolean, list: readonly T[]): T[];
1302 dropWhile<T>(fn: (a: T) => boolean): (list: readonly T[]) => T[];
1303
1304 /**
1305 * A function wrapping calls to the two functions in an || operation, returning the result of the first
1306 * function if it is truth-y and the result of the second function otherwise. Note that this is
1307 * short-circuited, meaning that the second function will not be invoked if the first returns a truth-y value.
1308 */
1309 either(pred1: Pred, pred2: Pred): Pred;
1310 either(pred1: Pred): (pred2: Pred) => Pred;
1311
1312 /**
1313 * Returns the empty value of its argument's type. Ramda defines the empty value of Array ([]), Object ({}),
1314 * String (''), and Arguments. Other types are supported if they define <Type>.empty and/or <Type>.prototype.empty.
1315 * Dispatches to the empty method of the first argument, if present.
1316 */
1317 empty<T>(x: T): T;
1318
1319 /**
1320 * Checks if a list ends with the provided values
1321 */
1322 endsWith(a: string, list: string): boolean;
1323 endsWith(a: string): (list: string) => boolean;
1324 endsWith<T>(a: T | readonly T[], list: readonly T[]): boolean;
1325 endsWith<T>(a: T | readonly T[]): (list: readonly T[]) => boolean;
1326
1327 /**
1328 * Takes a function and two values in its domain and returns true if the values map to the same value in the
1329 * codomain; false otherwise.
1330 */
1331 eqBy<T, U = T>(fn: (a: T) => U, a: T, b: T): boolean;
1332 eqBy<T, U = T>(fn: (a: T) => U, a: T): (b: T) => boolean;
1333 eqBy<T, U = T>(fn: (a: T) => U): F.Curry<(a: T, b: T) => boolean>;
1334
1335 /**
1336 * Reports whether two functions have the same value for the specified property.
1337 */
1338 eqProps<T, U>(prop: string, obj1: T, obj2: U): boolean;
1339 eqProps<P extends string>(prop: P): <T, U>(obj1: Record<P, T>, obj2: Record<P, U>) => boolean;
1340 eqProps<T>(prop: string, obj1: T): <U>(obj2: U) => boolean;
1341
1342 /**
1343 * Returns true if its arguments are equivalent, false otherwise. Dispatches to an equals method if present.
1344 * Handles cyclical data structures.
1345 */
1346 equals<T>(a: T, b: T): boolean;
1347 equals<T>(a: T): (b: T) => boolean;
1348
1349 /**
1350 * Creates a new object by evolving a shallow copy of object, according to the transformation functions.
1351 */
1352 evolve<E extends Evolver, V extends Evolvable<E>>(transformations: E, obj: V): Evolve<V, E>;
1353 evolve<E extends Evolver>(transformations: E): <V extends Evolvable<E>>(obj: V) => Evolve<V, E>;
1354
1355 /*
1356 * A function that always returns false. Any passed in parameters are ignored.
1357 */
1358 F(): boolean;
1359
1360 /**
1361 * Returns a new list containing only those items that match a given predicate function. The predicate function is passed one argument: (value).
1362 */
1363 filter: Filter;
1364
1365 /**
1366 * Returns the first element of the list which matches the predicate, or `undefined` if no
1367 * element matches.
1368 */
1369 find<T>(fn: (a: T) => boolean, list: readonly T[]): T | undefined;
1370 find<T>(fn: (a: T) => boolean): (list: readonly T[]) => T | undefined;
1371
1372 /**
1373 * Returns the index of the first element of the list which matches the predicate, or `-1`
1374 * if no element matches.
1375 */
1376 findIndex<T>(fn: (a: T) => boolean, list: readonly T[]): number;
1377 findIndex<T>(fn: (a: T) => boolean): (list: readonly T[]) => number;
1378
1379 /**
1380 * Returns the last element of the list which matches the predicate, or `undefined` if no
1381 * element matches.
1382 */
1383 findLast<T>(fn: (a: T) => boolean, list: readonly T[]): T | undefined;
1384 findLast<T>(fn: (a: T) => boolean): (list: readonly T[]) => T | undefined;
1385
1386 /**
1387 * Returns the index of the last element of the list which matches the predicate, or
1388 * `-1` if no element matches.
1389 */
1390 findLastIndex<T>(fn: (a: T) => boolean, list: readonly T[]): number;
1391 findLastIndex<T>(fn: (a: T) => boolean): (list: readonly T[]) => number;
1392
1393 /**
1394 * Returns a new list by pulling every item out of it (and all its sub-arrays) and putting
1395 * them in a new array, depth-first.
1396 */
1397 flatten<T extends readonly any[]>(list: T): T.Flatten<T>;
1398
1399 /**
1400 * Returns a new function much like the supplied one, except that the first two arguments'
1401 * order is reversed.
1402 */
1403 flip<T, U, TResult>(fn: (arg0: T, arg1: U) => TResult): (arg1: U, arg0?: T) => TResult;
1404 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>>;
1405
1406 /**
1407 * Iterate over an input list, calling a provided function fn for each element in the list.
1408 */
1409 forEach<T>(fn: (x: T) => void, list: readonly T[]): T[];
1410 forEach<T>(fn: (x: T) => void): (list: readonly T[]) => T[];
1411 forEach<T>(fn: (x: T) => void, list: readonly T[]): T[];
1412 forEach<T>(fn: (x: T) => void): (list: readonly T[]) => T[];
1413
1414 /**
1415 * Iterate over an input object, calling a provided function fn for each key and value in the object.
1416 */
1417 forEachObjIndexed<T>(fn: (value: T[keyof T], key: keyof T, obj: T) => void, obj: T): T;
1418 forEachObjIndexed<T>(fn: (value: T[keyof T], key: keyof T, obj: T) => void): (obj: T) => T;
1419
1420 /**
1421 * Creates a new object out of a list key-value pairs.
1422 */
1423 fromPairs<V>(pairs: Array<KeyValuePair<string, V>>): { [index: string]: V };
1424 fromPairs<V>(pairs: Array<KeyValuePair<number, V>>): { [index: number]: V };
1425
1426 /**
1427 * Splits a list into sublists stored in an object, based on the result of
1428 * calling a String-returning function
1429 * on each element, and grouping the results according to values returned.
1430 */
1431 groupBy<T>(fn: (a: T) => string, list: readonly T[]): { [index: string]: T[] };
1432 groupBy<T>(fn: (a: T) => string): (list: readonly T[]) => { [index: string]: T[] };
1433
1434 /**
1435 * Takes a list and returns a list of lists where each sublist's elements are all "equal" according to the provided equality function
1436 */
1437 groupWith<T>(fn: (x: T, y: T) => boolean): (list: readonly T[]) => T[][];
1438 groupWith<T>(fn: (x: T, y: T) => boolean, list: readonly T[]): T[][];
1439 groupWith<T>(fn: (x: T, y: T) => boolean, list: string): string[];
1440
1441 /**
1442 * Returns true if the first parameter is greater than the second.
1443 */
1444 gt(__: Placeholder, b: number): (a: number) => boolean;
1445 gt(__: Placeholder): (b: number, a: number) => boolean;
1446 gt(a: number, b: number): boolean;
1447 gt(a: number): (b: number) => boolean;
1448
1449 /**
1450 * Returns true if the first parameter is greater than or equal to the second.
1451 */
1452 gte(__: Placeholder, b: number): (a: number) => boolean;
1453 gte(__: Placeholder): (b: number, a: number) => boolean;
1454 gte(a: number, b: number): boolean;
1455 gte(a: number): (b: number) => boolean;
1456
1457 /**
1458 * Returns whether or not an object has an own property with the specified name.
1459 */
1460 has<T>(__: Placeholder, obj: T): (s: string) => boolean;
1461 has<T>(__: Placeholder): (obj: T, s: string) => boolean;
1462 has<T>(s: string, obj: T): boolean;
1463 has(s: string): <T>(obj: T) => boolean;
1464
1465 /**
1466 * Returns whether or not an object or its prototype chain has a property with the specified name
1467 */
1468 hasIn<T>(s: string, obj: T): boolean;
1469 hasIn(s: string): <T>(obj: T) => boolean;
1470
1471 /**
1472 * Returns whether or not a path exists in an object. Only the object's own properties are checked.
1473 */
1474 hasPath<T>(list: readonly string[], obj: T): boolean;
1475 hasPath(list: readonly string[]): <T>(obj: T) => boolean;
1476
1477 /**
1478 * Returns the first element in a list.
1479 * In some libraries this function is named `first`.
1480 */
1481 head(str: string): string;
1482 head(list: readonly []): undefined;
1483 head<T extends any>(list: readonly T[]): T;
1484
1485 /**
1486 * Returns true if its arguments are identical, false otherwise. Values are identical if they reference the
1487 * same memory. NaN is identical to NaN; 0 and -0 are not identical.
1488 */
1489 identical<T>(a: T, b: T): boolean;
1490 identical<T>(a: T): (b: T) => boolean;
1491
1492 /**
1493 * A function that does nothing but return the parameter supplied to it. Good as a default
1494 * or placeholder function.
1495 */
1496 identity<T>(a: T): T;
1497
1498 /**
1499 * Creates a function that will process either the onTrue or the onFalse function depending upon the result
1500 * of the condition predicate.
1501 */
1502 ifElse(fn: Pred, onTrue: Arity1Fn, onFalse: Arity1Fn): Arity1Fn;
1503 ifElse(fn: Pred, onTrue: Arity2Fn, onFalse: Arity2Fn): Arity2Fn;
1504
1505 /**
1506 * Increments its argument.
1507 */
1508 inc(n: number): number;
1509
1510 /**
1511 * Given a target, this function checks a list for the target and returns a boolean.
1512 * Given a string, this function checks for the string in another string or list and returns
1513 * a boolean.
1514 */
1515 includes(s: string, list: readonly string[] | string): boolean;
1516 includes(s: string): (list: readonly string[] | string) => boolean;
1517 includes<T>(target: T, list: readonly T[]): boolean;
1518 includes<T>(target: T): (list: readonly T[]) => boolean;
1519
1520 /**
1521 * Given a function that generates a key, turns a list of objects into an object indexing the objects
1522 * by the given key.
1523 */
1524 indexBy<T>(fn: (a: T) => string, list: readonly T[]): { [key: string]: T };
1525 indexBy<T>(fn: (a: T) => string): (list: readonly T[]) => { [key: string]: T };
1526
1527 /**
1528 * Returns the position of the first occurrence of an item in an array
1529 * (by strict equality),
1530 * or -1 if the item is not included in the array.
1531 */
1532 indexOf<T>(target: T, list: readonly T[]): number;
1533 indexOf<T>(target: T): (list: readonly T[]) => number;
1534
1535 /**
1536 * Returns all but the last element of a list or string.
1537 */
1538 init<T>(list: readonly T[]): T[];
1539 init(list: string): string;
1540
1541 /**
1542 * Takes a predicate `pred`, a list `xs`, and a list `ys`, and returns a list
1543 * `xs'` comprising each of the elements of `xs` which is equal to one or more
1544 * elements of `ys` according to `pred`.
1545 *
1546 * `pred` must be a binary function expecting an element from each list.
1547 *
1548 * `xs`, `ys`, and `xs'` are treated as sets, semantically, so ordering should
1549 * not be significant, but since `xs'` is ordered the implementation guarantees
1550 * that its values are in the same order as they appear in `xs`. Duplicates are
1551 * not removed, so `xs'` may contain duplicates if `xs` contains duplicates.
1552 */
1553
1554 innerJoin<T1, T2>(pred: (a: T1, b: T2) => boolean, list1: readonly T1[], list2: readonly T2[]): T1[];
1555 innerJoin<T1, T2>(pred: (a: T1, b: T2) => boolean): (list1: readonly T1[], list2: readonly T2[]) => T1[];
1556 innerJoin<T1, T2>(pred: (a: T1, b: T2) => boolean, list1: readonly T1[]): (list2: readonly T2[]) => T1[];
1557
1558 /**
1559 * Inserts the supplied element into the list, at index index. Note that
1560 * this is not destructive: it returns a copy of the list with the changes.
1561 */
1562 insert<T>(index: number, elt: T, list: readonly T[]): T[];
1563 insert<T>(index: number, elt: T): (list: readonly T[]) => T[];
1564 insert(index: number): <T>(elt: T, list: readonly T[]) => T[];
1565
1566 /**
1567 * Inserts the sub-list into the list, at index `index`. _Note that this
1568 * is not destructive_: it returns a copy of the list with the changes.
1569 */
1570 insertAll<T>(index: number, elts: readonly T[], list: readonly T[]): T[];
1571 insertAll<T>(index: number, elts: readonly T[]): (list: readonly T[]) => T[];
1572 insertAll(index: number): <T>(elts: readonly T[], list: readonly T[]) => T[];
1573
1574 /**
1575 * Combines two lists into a set (i.e. no duplicates) composed of those elements common to both lists.
1576 */
1577 intersection<T>(list1: readonly T[], list2: readonly T[]): T[];
1578 intersection<T>(list1: readonly T[]): (list2: readonly T[]) => T[];
1579
1580 /**
1581 * Combines two lists into a set (i.e. no duplicates) composed of those
1582 * elements common to both lists. Duplication is determined according
1583 * to the value returned by applying the supplied predicate to two list
1584 * elements.
1585 */
1586 intersectionWith<T>(pred: (a: T, b: T) => boolean, list1: readonly T[], list2: readonly T[]): T[];
1587
1588 /**
1589 * Creates a new list with the separator interposed between elements.
1590 */
1591 intersperse<T>(separator: T, list: readonly T[]): T[];
1592 intersperse<T>(separator: T): (list: readonly T[]) => T[];
1593
1594 /**
1595 * Transforms the items of the list with the transducer and appends the transformed items to the accumulator
1596 * using an appropriate iterator function based on the accumulator type.
1597 */
1598 into<T>(acc: any, xf: (...a: readonly any[]) => any, list: readonly T[]): T[];
1599 into(acc: any, xf: (...a: readonly any[]) => any): <T>(list: readonly T[]) => T[];
1600 into(acc: any): <T>(xf: (...a: readonly any[]) => any, list: readonly T[]) => T[];
1601
1602 /**
1603 * Same as R.invertObj, however this accounts for objects with duplicate values by putting the values into an array.
1604 */
1605 invert<T>(obj: T): { [index: string]: string[] };
1606
1607 /**
1608 * Returns a new object with the keys of the given object as values, and the values of the given object as keys.
1609 */
1610 invertObj(obj: { [index: string]: string } | { [index: number]: string }): { [index: string]: string };
1611
1612 /**
1613 * Turns a named method with a specified arity into a function that can be called directly
1614 * supplied with arguments and a target object.
1615 *
1616 * The returned function is curried and accepts `arity + 1` parameters where the final
1617 * parameter is the target object.
1618 */
1619 invoker(arity: number, method: string): (...a: readonly any[]) => any;
1620
1621 /**
1622 * See if an object (`val`) is an instance of the supplied constructor.
1623 * This function will check up the inheritance chain, if any.
1624 */
1625 is(ctor: any, val: any): boolean;
1626 is(ctor: any): (val: any) => boolean;
1627
1628 /**
1629 * Reports whether the list has zero elements.
1630 */
1631 isEmpty(value: any): boolean;
1632
1633 /**
1634 * Checks if the input value is null or undefined.
1635 */
1636 isNil(value: any): value is null | undefined;
1637
1638 /**
1639 * Returns a string made by inserting the `separator` between each
1640 * element and concatenating all the elements into a single string.
1641 */
1642 join(x: string, xs: readonly any[]): string;
1643 join(x: string): (xs: readonly any[]) => string;
1644
1645 /**
1646 * Applies a list of functions to a list of values.
1647 */
1648 juxt<A extends any[], R1, R2>(fns: [(...a: A) => R1, (...a: A) => R2]): (...a: A) => [R1, R2];
1649 juxt<A extends any[], R1, R2, R3>(fns: [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3]): (...a: A) => [R1, R2, R3];
1650 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];
1651 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];
1652 juxt<A extends any[], U>(fns: Array<(...args: A) => U>): (...args: A) => U[];
1653
1654 /**
1655 * Returns a list containing the names of all the enumerable own
1656 * properties of the supplied object.
1657 */
1658 keys<T extends object>(x: T): Array<keyof T>;
1659 keys<T>(x: T): string[];
1660
1661 /**
1662 * Returns a list containing the names of all the
1663 * properties of the supplied object, including prototype properties.
1664 */
1665 keysIn<T>(obj: T): string[];
1666
1667 /**
1668 * Returns the last element from a list.
1669 */
1670 last(str: string): string;
1671 last(list: readonly []): undefined;
1672 last<T extends any>(list: readonly T[]): T;
1673
1674 /**
1675 * Returns the position of the last occurrence of an item (by strict equality) in
1676 * an array, or -1 if the item is not included in the array.
1677 */
1678 lastIndexOf<T>(target: T, list: readonly T[]): number;
1679
1680 /**
1681 * Returns the number of elements in the array by returning list.length.
1682 */
1683 length<T>(list: readonly T[]): number;
1684
1685 /**
1686 * Returns a lens for the given getter and setter functions. The getter
1687 * "gets" the value of the focus; the setter "sets" the value of the focus.
1688 * The setter should not mutate the data structure.
1689 */
1690 lens<T, U, V>(getter: (s: T) => U, setter: (a: U, s: T) => V): Lens;
1691
1692 /**
1693 * Creates a lens that will focus on index n of the source array.
1694 */
1695 lensIndex(n: number): Lens;
1696
1697 /**
1698 * Returns a lens whose focus is the specified path.
1699 * See also view, set, over.
1700 */
1701 lensPath(path: Path): Lens;
1702
1703 /**
1704 * lensProp creates a lens that will focus on property k of the source object.
1705 */
1706 lensProp(str: string): {
1707 <T, U>(obj: T): U;
1708 set<T, U, V>(val: T, obj: U): V;
1709 /*map<T>(fn: (...a: readonly any[]) => any, obj: T): T*/
1710 };
1711
1712 /**
1713 * "lifts" a function of arity > 1 so that it may "map over" a list, Function or other object that satisfies
1714 * the FantasyLand Apply spec.
1715 */
1716 lift(fn: ((...a: readonly any[]) => any), ...args: readonly any[]): any;
1717
1718 /**
1719 * "lifts" a function to be the specified arity, so that it may "map over" that many lists, Functions or other
1720 * objects that satisfy the FantasyLand Apply spec.
1721 */
1722 liftN(n: number, fn: ((...a: readonly any[]) => any), ...args: readonly any[]): any;
1723
1724 /**
1725 * Returns true if the first parameter is less than the second.
1726 */
1727 lt(__: Placeholder, b: number): (a: number) => boolean;
1728 lt(__: Placeholder): (b: number, a: number) => boolean;
1729 lt(a: number, b: number): boolean;
1730 lt(a: number): (b: number) => boolean;
1731
1732 /**
1733 * Returns true if the first parameter is less than or equal to the second.
1734 */
1735 lte(__: Placeholder, b: number): (a: number) => boolean;
1736 lte(__: Placeholder): (b: number, a: number) => boolean;
1737 lte(a: number, b: number): boolean;
1738 lte(a: number): (b: number) => boolean;
1739
1740 /**
1741 * Returns a new list, constructed by applying the supplied function to every element of the supplied list.
1742 */
1743 map<T, U>(fn: (x: T) => U, list: readonly T[]): U[];
1744 map<T, U>(fn: (x: T) => U): (list: readonly T[]) => U[];
1745 map<T, U>(fn: (x: T[keyof T & keyof U]) => U[keyof T & keyof U], list: T): U;
1746 map<T, U>(fn: (x: T[keyof T & keyof U]) => U[keyof T & keyof U]): (list: T) => U;
1747 map<T, U>(fn: (x: T) => U, obj: Functor<T>): Functor<U>; // used in functors
1748 map<T, U>(fn: (x: T) => U): (obj: Functor<T>) => Functor<U>; // used in functors
1749
1750 /**
1751 * The mapAccum function behaves like a combination of map and reduce.
1752 */
1753 mapAccum<T, U, TResult>(fn: (acc: U, value: T) => [U, TResult], acc: U, list: readonly T[]): [U, TResult[]];
1754 mapAccum<T, U, TResult>(fn: (acc: U, value: T) => [U, TResult]): (acc: U, list: readonly T[]) => [U, TResult[]];
1755 mapAccum<T, U, TResult>(fn: (acc: U, value: T) => [U, TResult], acc: U): (list: readonly T[]) => [U, TResult[]];
1756
1757 /**
1758 * The mapAccumRight function behaves like a combination of map and reduce.
1759 */
1760 mapAccumRight<T, U, TResult>(fn: (acc: U, value: T) => [U, TResult], acc: U, list: readonly T[]): [U, TResult[]];
1761 mapAccumRight<T, U, TResult>(fn: (acc: U, value: T) => [U, TResult]): (acc: U, list: readonly T[]) => [U, TResult[]];
1762 mapAccumRight<T, U, TResult>(fn: (acc: U, value: T) => [U, TResult], acc: U): (list: readonly T[]) => [U, TResult[]];
1763
1764 /**
1765 * Like mapObj, but but passes additional arguments to the predicate function.
1766 */
1767 mapObjIndexed<T, TResult>(
1768 fn: (value: T, key: string, obj?: {
1769 [key: string]: T
1770 }) => TResult,
1771 obj: {
1772 [key: string]: T
1773 }
1774 ): {
1775 [key: string]: TResult
1776 };
1777 mapObjIndexed<T, TResult>(fn: (value: T, key: string, obj?: any) => TResult, obj: any): { [index: string]: TResult };
1778 mapObjIndexed<T, TResult>(fn: (value: T, key: string, obj?: any) => TResult): (obj: any) => { [index: string]: TResult };
1779
1780 /**
1781 * Tests a regular expression agains a String
1782 */
1783 match(regexp: RegExp, str: string): any[];
1784 match(regexp: RegExp): (str: string) => any[];
1785
1786 /**
1787 * mathMod behaves like the modulo operator should mathematically, unlike the `%`
1788 * operator (and by extension, R.modulo). So while "-17 % 5" is -2,
1789 * mathMod(-17, 5) is 3. mathMod requires Integer arguments, and returns NaN
1790 * when the modulus is zero or negative.
1791 */
1792 mathMod(__: Placeholder, b: number): (a: number) => number;
1793 mathMod(__: Placeholder): (b: number, a: number) => number;
1794 mathMod(a: number, b: number): number;
1795 mathMod(a: number): (b: number) => number;
1796
1797 /**
1798 * Returns the larger of its two arguments.
1799 */
1800 max<T extends Ord>(a: T, b: T): T;
1801 max<T extends Ord>(a: T): (b: T) => T;
1802
1803 /**
1804 * Takes a function and two values, and returns whichever value produces
1805 * the larger result when passed to the provided function.
1806 */
1807 maxBy<T>(keyFn: (a: T) => Ord, a: T, b: T): T;
1808 maxBy<T>(keyFn: (a: T) => Ord, a: T): (b: T) => T;
1809 maxBy<T>(keyFn: (a: T) => Ord): F.Curry<(a: T, b: T) => T>;
1810
1811 /**
1812 * Returns the mean of the given list of numbers.
1813 */
1814 mean(list: readonly number[]): number;
1815
1816 /**
1817 * Returns the median of the given list of numbers.
1818 */
1819 median(list: readonly number[]): number;
1820
1821 /**
1822 * Creates a new function that, when invoked, caches the result of calling fn for a given argument set and returns the result.
1823 * 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.
1824 */
1825 memoizeWith<T extends (...args: readonly any[]) => any>(keyFn: (...v: Parameters<T>) => string, fn: T): T;
1826
1827 /**
1828 * Create a new object with the own properties of a
1829 * merged with the own properties of object b.
1830 * This function will *not* mutate passed-in objects.
1831 *
1832 * @deprecated since 0.26 in favor of mergeRight
1833 */
1834 merge<O2 extends object>(__: Placeholder, b: O2): <O1 extends object>(a: O1) => O.Ensure<O.MergeUp<O2, O1>>;
1835 merge(__: Placeholder): <O1 extends object, O2 extends object>(b: O2, a: O1) => O.Ensure<O.MergeUp<O2, O1>>;
1836 merge<O1 extends object, O2 extends object>(a: O1, b: O2): O.Ensure<O.MergeUp<O2, O1>>;
1837 merge<O1 extends object>(a: O1): <O2 extends object>(b: O2) => O.Ensure<O.MergeUp<O2, O1>>;
1838
1839 /**
1840 * Merges a list of objects together into one object.
1841 */
1842 mergeAll<Os extends readonly object[]>(list: Os): O.AssignUp<{}, Os> extends infer M
1843 ? {} extends M // nothing merged bcs no `as const`
1844 ? T.UnionOf<Os> // so we output the default types
1845 : O.Ensure<M & {}> // otherwise, we can compute `M`
1846 : never;
1847
1848 /**
1849 * Creates a new object with the own properties of the first object merged with the own properties of the second object.
1850 * If a key exists in both objects:
1851 * and both values are objects, the two values will be recursively merged
1852 * otherwise the value from the first object will be used.
1853 */
1854 mergeDeepLeft<O1 extends object, O2 extends object>(o1: O1, o2: O2): O.Ensure<O.MergeUp<O1, O2, 'deep'>>;
1855 mergeDeepLeft<O1 extends object>(o1: O1): <O2 extends object>(o2: O2) => O.Ensure<O.MergeUp<O1, O2, 'deep'>>;
1856
1857 /**
1858 * Creates a new object with the own properties of the first object merged with the own properties of the second object.
1859 * If a key exists in both objects:
1860 * and both values are objects, the two values will be recursively merged
1861 * otherwise the value from the second object will be used.
1862 */
1863 mergeDeepRight<O1 extends object, O2 extends object>(o1: O1, o2: O2): O.Ensure<O.MergeUp<O2, O1, 'deep'>>;
1864 mergeDeepRight<O1 extends object>(a: O1): <O2 extends object>(o2: O2) => O.Ensure<O.MergeUp<O2, O1, 'deep'>>;
1865
1866 /**
1867 * Creates a new object with the own properties of the two provided objects. If a key exists in both objects:
1868 * and both associated values are also objects then the values will be recursively merged.
1869 * otherwise the provided function is applied to associated values using the resulting value as the new value
1870 * associated with the key. If a key only exists in one object, the value will be associated with the key of the resulting object.
1871 */
1872 mergeDeepWith<T1, T2>(fn: (x: any, z: any) => any, a: T1, b: T2): any;
1873 mergeDeepWith<T1, T2>(fn: (x: any, z: any) => any, a: T1): (b: T2) => any;
1874 mergeDeepWith<T1, T2>(fn: (x: any, z: any) => any): (a: T1, b: T2) => any;
1875
1876 /**
1877 * Creates a new object with the own properties of the two provided objects. If a key exists in both objects:
1878 * and both associated values are also objects then the values will be recursively merged.
1879 * otherwise the provided function is applied to the key and associated values using the resulting value as
1880 * the new value associated with the key. If a key only exists in one object, the value will be associated with
1881 * the key of the resulting object.
1882 */
1883 mergeDeepWithKey<T1, T2>(fn: (k: string, x: any, z: any) => any, a: T1, b: T2): any;
1884 mergeDeepWithKey<T1, T2>(fn: (k: string, x: any, z: any) => any, a: T1): (b: T2) => any;
1885 mergeDeepWithKey<T1, T2>(fn: (k: string, x: any, z: any) => any): (a: T1, b: T2) => any;
1886
1887 /**
1888 * Create a new object with the own properties of the first object merged with the own properties of the second object.
1889 * If a key exists in both objects, the value from the first object will be used.
1890 */
1891 mergeLeft<O1 extends object, O2 extends object>(a: O1, b: O2): O.Ensure<O.MergeUp<O1, O2>>;
1892 mergeLeft<O1 extends object>(a: O1): <O2 extends object>(b: O2) => O.Ensure<O.MergeUp<O1, O2>>;
1893
1894 /**
1895 * Create a new object with the own properties of the first object merged with the own properties of the second object.
1896 * If a key exists in both objects, the value from the second object will be used.
1897 */
1898 mergeRight<O1 extends object, O2 extends object>(a: O1, b: O2): O.Ensure<O.MergeUp<O2, O1>>;
1899 mergeRight<O1 extends object>(a: O1): <O2 extends object>(b: O2) => O.Ensure<O.MergeUp<O2, O1>>;
1900
1901 /**
1902 * Creates a new object with the own properties of the two provided objects. If a key exists in both objects,
1903 * the provided function is applied to the values associated with the key in each object, with the result being used as
1904 * the value associated with the key in the returned object. The key will be excluded from the returned object if the
1905 * resulting value is undefined.
1906 */
1907 mergeWith<U, V>(fn: (x: any, z: any) => any, a: U, b: V): any;
1908 mergeWith<U>(fn: (x: any, z: any) => any, a: U): <V>(b: V) => any;
1909 mergeWith(fn: (x: any, z: any) => any): <U, V>(a: U, b: V) => any;
1910
1911 /**
1912 * Creates a new object with the own properties of the two provided objects. If a key exists in both objects,
1913 * the provided function is applied to the key and the values associated with the key in each object, with the
1914 * result being used as the value associated with the key in the returned object. The key will be excluded from
1915 * the returned object if the resulting value is undefined.
1916 */
1917 mergeWithKey<U, V>(fn: (str: string, x: any, z: any) => any, a: U, b: V): any;
1918 mergeWithKey<U>(fn: (str: string, x: any, z: any) => any, a: U): <V>(b: V) => any;
1919 mergeWithKey(fn: (str: string, x: any, z: any) => any): <U, V>(a: U, b: V) => any;
1920
1921 /**
1922 * Returns the smaller of its two arguments.
1923 */
1924 min<T extends Ord>(a: T, b: T): T;
1925 min<T extends Ord>(a: T): (b: T) => T;
1926
1927 /**
1928 * Takes a function and two values, and returns whichever value produces
1929 * the smaller result when passed to the provided function.
1930 */
1931 minBy<T>(keyFn: (a: T) => Ord, a: T, b: T): T;
1932 minBy<T>(keyFn: (a: T) => Ord, a: T): (b: T) => T;
1933 minBy<T>(keyFn: (a: T) => Ord): F.Curry<(a: T, b: T) => T>;
1934
1935 /**
1936 * Divides the second parameter by the first and returns the remainder.
1937 * The flipped version (`moduloBy`) may be more useful curried.
1938 * Note that this functions preserves the JavaScript-style behavior for
1939 * modulo. For mathematical modulo see `mathMod`
1940 */
1941 modulo(__: Placeholder, b: number): (a: number) => number;
1942 modulo(__: Placeholder): (b: number, a: number) => number;
1943 modulo(a: number, b: number): number;
1944 modulo(a: number): (b: number) => number;
1945
1946 /**
1947 * Multiplies two numbers. Equivalent to a * b but curried.
1948 */
1949 multiply(a: number, b: number): number;
1950 multiply(a: number): (b: number) => number;
1951
1952 /**
1953 * Moves an item, at index `from`, to index `to`, in a `list` of elements.
1954 * A new list will be created containing the new elements order.
1955 */
1956 move<T>(from: number, to: number, list: readonly T[]): T[];
1957 move(from: number, to: number): <T>(list: readonly T[]) => T[];
1958 move(from: number): {
1959 <T>(to: number, list: readonly T[]): T[];
1960 (to: number): <T>(list: readonly T[]) => T[];
1961 };
1962
1963 /**
1964 * Wraps a function of any arity (including nullary) in a function that accepts exactly n parameters.
1965 * Any extraneous parameters will not be passed to the supplied function.
1966 */
1967 nAry(n: number, fn: (...arg: readonly any[]) => any): (...a: readonly any[]) => any;
1968 nAry(n: number): (fn: (...arg: readonly any[]) => any) => (...a: readonly any[]) => any;
1969
1970 /**
1971 * Negates its argument.
1972 */
1973 negate(n: number): number;
1974
1975 /**
1976 * Returns true if no elements of the list match the predicate, false otherwise.
1977 */
1978 none<T>(fn: (a: T) => boolean, list: readonly T[]): boolean;
1979 none<T>(fn: (a: T) => boolean): (list: readonly T[]) => boolean;
1980
1981 /**
1982 * A function wrapping a call to the given function in a `!` operation. It will return `true` when the
1983 * underlying function would return a false-y value, and `false` when it would return a truth-y one.
1984 */
1985 not(value: any): boolean;
1986
1987 /**
1988 * Returns the nth element in a list.
1989 */
1990 nth<T>(n: number, list: readonly T[]): T | undefined;
1991 nth(n: number): <T>(list: readonly T[]) => T | undefined;
1992
1993 /**
1994 * Returns a function which returns its nth argument.
1995 */
1996 nthArg(n: number): (...a: readonly any[]) => any;
1997
1998 /**
1999 * Creates an object containing a single key:value pair.
2000 */
2001 objOf<T, K extends string>(key: K, value: T): Record<K, T>;
2002 objOf<K extends string>(key: K): <T>(value: T) => Record<K, T>;
2003
2004 /**
2005 * Returns a singleton array containing the value provided.
2006 */
2007 of<T>(x: T): T[];
2008
2009 /**
2010 * Returns a partial copy of an object omitting the keys specified.
2011 */
2012 omit<T, K extends string>(names: readonly K[], obj: T): Omit<T, K>;
2013 omit<K extends string>(names: readonly K[]): <T>(obj: T) => Omit<T, K>;
2014
2015 /**
2016 * Accepts a function fn and returns a function that guards invocation of fn such that fn can only ever be
2017 * called once, no matter how many times the returned function is invoked. The first value calculated is
2018 * returned in subsequent invocations.
2019 */
2020 once(fn: (...a: readonly any[]) => any): (...a: readonly any[]) => any;
2021 once<T>(fn: (...a: readonly any[]) => T): (...a: readonly any[]) => T;
2022
2023 /**
2024 * A function that returns the first truthy of two arguments otherwise the last argument. Note that this is
2025 * NOT short-circuited, meaning that if expressions are passed they are both evaluated.
2026 * Dispatches to the or method of the first argument if applicable.
2027 */
2028 or<T, U>(a: T, b: U): T | U;
2029 or<T>(a: T): <U>(b: U) => T | U;
2030 or<T extends { or?: ((...a: readonly any[]) => any); }, U>(fn1: T, val2: U): T | U;
2031 or<T extends { or?: ((...a: readonly any[]) => any); }>(fn1: T): <U>(val2: U) => T | U;
2032
2033 /**
2034 * Returns the result of applying the onFailure function to the value inside a failed promise.
2035 * This is useful for handling rejected promises inside function compositions.
2036 */
2037 otherwise<A, B>(onError: (error: any) => B | Promise<B>, promise: Promise<A>): Promise<B>;
2038 otherwise<A, B>(onError: (error: any) => B | Promise<B>): (promise: Promise<A>) => Promise<B>;
2039
2040 /**
2041 * Returns the result of "setting" the portion of the given data structure
2042 * focused by the given lens to the given value.
2043 */
2044 over<T>(lens: Lens, fn: Arity1Fn, value: T): T;
2045 over<T>(lens: Lens, fn: Arity1Fn, value: readonly T[]): T[];
2046 over(lens: Lens, fn: Arity1Fn): <T>(value: T) => T;
2047 over(lens: Lens, fn: Arity1Fn): <T>(value: readonly T[]) => T[];
2048 over(lens: Lens): <T>(fn: Arity1Fn, value: T) => T;
2049 over(lens: Lens): <T>(fn: Arity1Fn, value: readonly T[]) => T[];
2050
2051 /**
2052 * Takes two arguments, fst and snd, and returns [fst, snd].
2053 */
2054 pair<F, S>(fst: F, snd: S): [F, S];
2055
2056 /**
2057 * Takes a function `f` and a list of arguments, and returns a function `g`.
2058 * When applied, `g` returns the result of applying `f` to the arguments
2059 * provided initially followed by the arguments provided to `g`.
2060 */
2061 partial<V0, V1, T>(fn: (x0: V0, x1: V1) => T, args: [V0]): (x1: V1) => T;
2062
2063 partial<V0, V1, V2, T>(fn: (x0: V0, x1: V1, x2: V2) => T, args: [V0, V1]): (x2: V2) => T;
2064 partial<V0, V1, V2, T>(fn: (x0: V0, x1: V1, x2: V2) => T, args: [V0]): (x1: V1, x2: V2) => T;
2065
2066 partial<V0, V1, V2, V3, T>(fn: (x0: V0, x1: V1, x2: V2, x3: V3) => T, args: [V0, V1, V2]): (x2: V3) => T;
2067 partial<V0, V1, V2, V3, T>(fn: (x0: V0, x1: V1, x2: V2, x3: V3) => T, args: [V0, V1]): (x2: V2, x3: V3) => T;
2068 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;
2069
2070 partial<T>(fn: (...a: readonly any[]) => T, args: readonly any[]): (...a: readonly any[]) => T;
2071
2072 /**
2073 * Takes a function `f` and a list of arguments, and returns a function `g`.
2074 * When applied, `g` returns the result of applying `f` to the arguments
2075 * provided to `g` followed by the arguments provided initially.
2076 */
2077 partialRight<V0, V1, T>(fn: (x0: V0, x1: V1) => T, args: [V1]): (x1: V0) => T;
2078
2079 partialRight<V0, V1, V2, T>(fn: (x0: V0, x1: V1, x2: V2) => T, args: [V1, V2]): (x2: V0) => T;
2080 partialRight<V0, V1, V2, T>(fn: (x0: V0, x1: V1, x2: V2) => T, args: [V2]): (x1: V0, x2: V1) => T;
2081
2082 partialRight<V0, V1, V2, V3, T>(fn: (x0: V0, x1: V1, x2: V2, x3: V3) => T, args: [V1, V2, V3]): (x0: V0) => T;
2083 partialRight<V0, V1, V2, V3, T>(fn: (x0: V0, x1: V1, x2: V2, x3: V3) => T, args: [V2, V3]): (x0: V0, x1: V1) => T;
2084 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;
2085
2086 partialRight<T>(fn: (...a: readonly any[]) => T, args: readonly any[]): (...a: readonly any[]) => T;
2087
2088 /**
2089 * Takes a predicate and a list and returns the pair of lists of elements
2090 * which do and do not satisfy the predicate, respectively.
2091 */
2092 partition(fn: (a: string) => boolean, list: readonly string[]): [string[], string[]];
2093 partition<T>(fn: (a: T) => boolean, list: readonly T[]): [T[], T[]];
2094 partition<T>(fn: (a: T) => boolean): (list: readonly T[]) => [T[], T[]];
2095 partition(fn: (a: string) => boolean): (list: readonly string[]) => [string[], string[]];
2096
2097 /**
2098 * Retrieve the value at a given path.
2099 */
2100 path<T>(path: Path, obj: any): T | undefined;
2101 path<T>(path: Path): (obj: any) => T | undefined;
2102
2103 /**
2104 * Determines whether a nested path on an object has a specific value,
2105 * in `R.equals` terms. Most likely used to filter a list.
2106 */
2107 pathEq(path: Path, val: any, obj: any): boolean;
2108 pathEq(path: Path, val: any): (obj: any) => boolean;
2109 pathEq(path: Path): F.Curry<(a: any, b: any) => boolean>;
2110
2111 /**
2112 * If the given, non-null object has a value at the given path, returns the value at that path.
2113 * Otherwise returns the provided default value.
2114 */
2115 pathOr<T>(defaultValue: T, path: Path, obj: any): T;
2116 pathOr<T>(defaultValue: T, path: Path): (obj: any) => T;
2117 pathOr<T>(defaultValue: T): F.Curry<(a: Path, b: any) => T>;
2118
2119 /**
2120 * Returns true if the specified object property at given path satisfies the given predicate; false otherwise.
2121 */
2122 pathSatisfies<T, U>(pred: (val: T) => boolean, path: Path, obj: U): boolean;
2123 pathSatisfies<T, U>(pred: (val: T) => boolean, path: Path): (obj: U) => boolean;
2124 pathSatisfies<T, U>(pred: (val: T) => boolean): F.Curry<(a: Path, b: U) => boolean>;
2125
2126 /**
2127 * Returns a partial copy of an object containing only the keys specified. If the key does not exist, the
2128 * property is ignored.
2129 */
2130 pick<T, K extends string>(names: readonly K[], obj: T): Pick<T, Exclude<keyof T, Exclude<keyof T, K>>>;
2131 pick<K extends string>(names: readonly K[]): <T>(obj: T) => Pick<T, Exclude<keyof T, Exclude<keyof T, K>>>;
2132
2133 /**
2134 * Similar to `pick` except that this one includes a `key: undefined` pair for properties that don't exist.
2135 */
2136 pickAll<T, U>(names: readonly string[], obj: T): U;
2137 pickAll(names: readonly string[]): <T, U>(obj: T) => U;
2138
2139 /**
2140 * Returns a partial copy of an object containing only the keys that satisfy the supplied predicate.
2141 */
2142 pickBy<T, U>(pred: ObjPred, obj: T): U;
2143 pickBy(pred: ObjPred): <T, U>(obj: T) => U;
2144
2145 /**
2146 * Creates a new function that runs each of the functions supplied as parameters in turn,
2147 * passing the return value of each function invocation to the next function invocation,
2148 * beginning with whatever arguments were passed to the initial invocation.
2149 */
2150 pipe<T1>(fn0: () => T1): () => T1;
2151 pipe<V0, T1>(fn0: (x0: V0) => T1): (x0: V0) => T1;
2152 pipe<V0, V1, T1>(fn0: (x0: V0, x1: V1) => T1): (x0: V0, x1: V1) => T1;
2153 pipe<V0, V1, V2, T1>(fn0: (x0: V0, x1: V1, x2: V2) => T1): (x0: V0, x1: V1, x2: V2) => T1;
2154
2155 pipe<T1, T2>(fn0: () => T1, fn1: (x: T1) => T2): () => T2;
2156 pipe<V0, T1, T2>(fn0: (x0: V0) => T1, fn1: (x: T1) => T2): (x0: V0) => T2;
2157 pipe<V0, V1, T1, T2>(fn0: (x0: V0, x1: V1) => T1, fn1: (x: T1) => T2): (x0: V0, x1: V1) => T2;
2158 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;
2159
2160 pipe<T1, T2, T3>(fn0: () => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3): () => T3;
2161 pipe<V0, T1, T2, T3>(fn0: (x: V0) => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3): (x: V0) => T3;
2162 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;
2163 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;
2164
2165 pipe<T1, T2, T3, T4>(fn0: () => T1, fn1: (x: T1) => T2, fn2: (x: T2) => T3, fn3: (x: T3) => T4): () => T4;
2166 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;
2167 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;
2168 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;
2169
2170 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;
2171 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;
2172 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;
2173 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;
2174
2175 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;
2176 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;
2177 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;
2178 pipe<V0, V1, V2, T1, T2, T3, T4, T5, T6>(
2179 fn0: (x0: V0, x1: V1, x2: V2) => T1,
2180 fn1: (x: T1) => T2,
2181 fn2: (x: T2) => T3,
2182 fn3: (x: T3) => T4,
2183 fn4: (x: T4) => T5,
2184 fn5: (x: T5) => T6): (x0: V0, x1: V1, x2: V2) => T6;
2185
2186 pipe<T1, T2, T3, T4, T5, T6, T7>(
2187 fn0: () => T1,
2188 fn1: (x: T1) => T2,
2189 fn2: (x: T2) => T3,
2190 fn3: (x: T3) => T4,
2191 fn4: (x: T4) => T5,
2192 fn5: (x: T5) => T6,
2193 fn: (x: T6) => T7): () => T7;
2194 pipe<V0, T1, T2, T3, T4, T5, T6, T7>(
2195 fn0: (x: V0) => T1,
2196 fn1: (x: T1) => T2,
2197 fn2: (x: T2) => T3,
2198 fn3: (x: T3) => T4,
2199 fn4: (x: T4) => T5,
2200 fn5: (x: T5) => T6,
2201 fn: (x: T6) => T7): (x: V0) => T7;
2202 pipe<V0, V1, T1, T2, T3, T4, T5, T6, T7>(
2203 fn0: (x0: V0, x1: V1) => T1,
2204 fn1: (x: T1) => T2,
2205 fn2: (x: T2) => T3,
2206 fn3: (x: T3) => T4,
2207 fn4: (x: T4) => T5,
2208 fn5: (x: T5) => T6,
2209 fn6: (x: T6) => T7): (x0: V0, x1: V1) => T7;
2210 pipe<V0, V1, V2, T1, T2, T3, T4, T5, T6, T7>(
2211 fn0: (x0: V0, x1: V1, x2: V2) => T1,
2212 fn1: (x: T1) => T2,
2213 fn2: (x: T2) => T3,
2214 fn3: (x: T3) => T4,
2215 fn4: (x: T4) => T5,
2216 fn5: (x: T5) => T6,
2217 fn6: (x: T6) => T7): (x0: V0, x1: V1, x2: V2) => T7;
2218
2219 pipe<T1, T2, T3, T4, T5, T6, T7, T8>(
2220 fn0: () => T1,
2221 fn1: (x: T1) => T2,
2222 fn2: (x: T2) => T3,
2223 fn3: (x: T3) => T4,
2224 fn4: (x: T4) => T5,
2225 fn5: (x: T5) => T6,
2226 fn6: (x: T6) => T7,
2227 fn: (x: T7) => T8): () => T8;
2228 pipe<V0, T1, T2, T3, T4, T5, T6, T7, T8>(
2229 fn0: (x: V0) => T1,
2230 fn1: (x: T1) => T2,
2231 fn2: (x: T2) => T3,
2232 fn3: (x: T3) => T4,
2233 fn4: (x: T4) => T5,
2234 fn5: (x: T5) => T6,
2235 fn6: (x: T6) => T7,
2236 fn: (x: T7) => T8): (x: V0) => T8;
2237 pipe<V0, V1, T1, T2, T3, T4, T5, T6, T7, T8>(
2238 fn0: (x0: V0, x1: V1) => T1,
2239 fn1: (x: T1) => T2,
2240 fn2: (x: T2) => T3,
2241 fn3: (x: T3) => T4,
2242 fn4: (x: T4) => T5,
2243 fn5: (x: T5) => T6,
2244 fn6: (x: T6) => T7,
2245 fn7: (x: T7) => T8): (x0: V0, x1: V1) => T8;
2246 pipe<V0, V1, V2, T1, T2, T3, T4, T5, T6, T7, T8>(
2247 fn0: (x0: V0, x1: V1, x2: V2) => T1,
2248 fn1: (x: T1) => T2,
2249 fn2: (x: T2) => T3,
2250 fn3: (x: T3) => T4,
2251 fn4: (x: T4) => T5,
2252 fn5: (x: T5) => T6,
2253 fn6: (x: T6) => T7,
2254 fn7: (x: T7) => T8): (x0: V0, x1: V1, x2: V2) => T8;
2255
2256 pipe<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
2257 fn0: () => T1,
2258 fn1: (x: T1) => T2,
2259 fn2: (x: T2) => T3,
2260 fn3: (x: T3) => T4,
2261 fn4: (x: T4) => T5,
2262 fn5: (x: T5) => T6,
2263 fn6: (x: T6) => T7,
2264 fn7: (x: T7) => T8,
2265 fn8: (x: T8) => T9): () => T9;
2266 pipe<V0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(
2267 fn0: (x0: V0) => T1,
2268 fn1: (x: T1) => T2,
2269 fn2: (x: T2) => T3,
2270 fn3: (x: T3) => T4,
2271 fn4: (x: T4) => T5,
2272 fn5: (x: T5) => T6,
2273 fn6: (x: T6) => T7,
2274 fn7: (x: T7) => T8,
2275 fn8: (x: T8) => T9): (x0: V0) => T9;
2276 pipe<V0, V1, T1, T2, T3, T4, T5, T6, T7, T8, T9>(
2277 fn0: (x0: V0, x1: V1) => T1,
2278 fn1: (x: T1) => T2,
2279 fn2: (x: T2) => T3,
2280 fn3: (x: T3) => T4,
2281 fn4: (x: T4) => T5,
2282 fn5: (x: T5) => T6,
2283 fn6: (x: T6) => T7,
2284 fn7: (x: T7) => T8,
2285 fn8: (x: T8) => T9): (x0: V0, x1: V1) => T9;
2286 pipe<V0, V1, V2, T1, T2, T3, T4, T5, T6, T7, T8, T9>(
2287 fn0: (x0: V0, x1: V1, x2: V2) => T1,
2288 fn1: (x: T1) => T2,
2289 fn2: (x: T2) => T3,
2290 fn3: (x: T3) => T4,
2291 fn4: (x: T4) => T5,
2292 fn5: (x: T5) => T6,
2293 fn6: (x: T6) => T7,
2294 fn7: (x: T7) => T8,
2295 fn8: (x: T8) => T9): (x0: V0, x1: V1, x2: V2) => T9;
2296
2297 pipe<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
2298 fn0: () => T1,
2299 fn1: (x: T1) => T2,
2300 fn2: (x: T2) => T3,
2301 fn3: (x: T3) => T4,
2302 fn4: (x: T4) => T5,
2303 fn5: (x: T5) => T6,
2304 fn6: (x: T6) => T7,
2305 fn7: (x: T7) => T8,
2306 fn8: (x: T8) => T9,
2307 fn9: (x: T9) => T10): () => T10;
2308 pipe<V0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
2309 fn0: (x0: V0) => T1,
2310 fn1: (x: T1) => T2,
2311 fn2: (x: T2) => T3,
2312 fn3: (x: T3) => T4,
2313 fn4: (x: T4) => T5,
2314 fn5: (x: T5) => T6,
2315 fn6: (x: T6) => T7,
2316 fn7: (x: T7) => T8,
2317 fn8: (x: T8) => T9,
2318 fn9: (x: T9) => T10): (x0: V0) => T10;
2319 pipe<V0, V1, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
2320 fn0: (x0: V0, x1: V1) => T1,
2321 fn1: (x: T1) => T2,
2322 fn2: (x: T2) => T3,
2323 fn3: (x: T3) => T4,
2324 fn4: (x: T4) => T5,
2325 fn5: (x: T5) => T6,
2326 fn6: (x: T6) => T7,
2327 fn7: (x: T7) => T8,
2328 fn8: (x: T8) => T9,
2329 fn9: (x: T9) => T10): (x0: V0, x1: V1) => T10;
2330 pipe<V0, V1, V2, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
2331 fn0: (x0: V0, x1: V1, x2: V2) => T1,
2332 fn1: (x: T1) => T2,
2333 fn2: (x: T2) => T3,
2334 fn3: (x: T3) => T4,
2335 fn4: (x: T4) => T5,
2336 fn5: (x: T5) => T6,
2337 fn6: (x: T6) => T7,
2338 fn7: (x: T7) => T8,
2339 fn8: (x: T8) => T9,
2340 fn9: (x: T9) => T10): (x0: V0, x1: V1, x2: V2) => T10;
2341
2342 /**
2343 * Returns the left-to-right Kleisli composition of the provided functions, each of which must return a value of a type supported by chain.
2344 * The typings currently support arrays only as return values.
2345 * All functions need to be unary.
2346 * R.pipeK(f, g, h) is equivalent to R.pipe(f, R.chain(g), R.chain(h)).
2347 *
2348 * @deprecated since 0.26 in favor of pipeWith(chain)
2349 */
2350 pipeK<V0, T1>(
2351 fn0: (x0: V0) => T1[]): (x0: V0) => T1[];
2352 pipeK<V0, T1, T2>(
2353 fn0: (x0: V0) => T1[],
2354 fn1: (x: T1) => T2[]): (x0: V0) => T2[];
2355 pipeK<V0, T1, T2, T3>(
2356 fn0: (x: V0) => T1[],
2357 fn1: (x: T1) => T2[],
2358 fn2: (x: T2) => T3[]): (x: V0) => T3[];
2359 pipeK<V0, T1, T2, T3, T4>(
2360 fn0: (x: V0) => T1[],
2361 fn1: (x: T1) => T2[],
2362 fn2: (x: T2) => T3[],
2363 fn3: (x: T3) => T4[]): (x: V0) => T4[];
2364 pipeK<V0, T1, T2, T3, T4, T5>(
2365 fn0: (x: V0) => T1[],
2366 fn1: (x: T1) => T2[],
2367 fn2: (x: T2) => T3[],
2368 fn3: (x: T3) => T4[],
2369 fn4: (x: T4) => T5[]): (x: V0) => T5[];
2370 pipeK<V0, T1, T2, T3, T4, T5, T6>(
2371 fn0: (x: V0) => T1[],
2372 fn1: (x: T1) => T2[],
2373 fn2: (x: T2) => T3[],
2374 fn3: (x: T3) => T4[],
2375 fn4: (x: T4) => T5[],
2376 fn5: (x: T5) => T6[]): (x: V0) => T6[];
2377 pipeK<V0, T1, T2, T3, T4, T5, T6, T7>(
2378 fn0: (x: V0) => T1[],
2379 fn1: (x: T1) => T2[],
2380 fn2: (x: T2) => T3[],
2381 fn3: (x: T3) => T4[],
2382 fn4: (x: T4) => T5[],
2383 fn5: (x: T5) => T6[],
2384 fn: (x: T6) => T7[]): (x: V0) => T7[];
2385 pipeK<V0, T1, T2, T3, T4, T5, T6, T7, T8>(
2386 fn0: (x: V0) => T1[],
2387 fn1: (x: T1) => T2[],
2388 fn2: (x: T2) => T3[],
2389 fn3: (x: T3) => T4[],
2390 fn4: (x: T4) => T5[],
2391 fn5: (x: T5) => T6[],
2392 fn6: (x: T6) => T7[],
2393 fn: (x: T7) => T8[]): (x: V0) => T8[];
2394 pipeK<V0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(
2395 fn0: (x0: V0) => T1[],
2396 fn1: (x: T1) => T2[],
2397 fn2: (x: T2) => T3[],
2398 fn3: (x: T3) => T4[],
2399 fn4: (x: T4) => T5[],
2400 fn5: (x: T5) => T6[],
2401 fn6: (x: T6) => T7[],
2402 fn7: (x: T7) => T8[],
2403 fn8: (x: T8) => T9[]): (x0: V0) => T9[];
2404 pipeK<V0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
2405 fn0: (x0: V0) => T1[],
2406 fn1: (x: T1) => T2[],
2407 fn2: (x: T2) => T3[],
2408 fn3: (x: T3) => T4[],
2409 fn4: (x: T4) => T5[],
2410 fn5: (x: T5) => T6[],
2411 fn6: (x: T6) => T7[],
2412 fn7: (x: T7) => T8[],
2413 fn8: (x: T8) => T9[],
2414 fn9: (x: T9) => T10[]): (x0: V0) => T10[];
2415
2416 /**
2417 * Performs left-to-right composition of one or more Promise-returning functions.
2418 * All functions need to be unary.
2419 *
2420 * @deprecated since 0.26 in favor of pipeWith(then)
2421 */
2422 pipeP<V0, T1>(
2423 fn0: (x0: V0) => Promise<T1>): (x0: V0) => Promise<T1>;
2424 pipeP<V0, T1, T2>(
2425 fn0: (x0: V0) => Promise<T1>,
2426 fn1: (x: T1) => Promise<T2>): (x0: V0) => Promise<T2>;
2427 pipeP<V0, T1, T2, T3>(
2428 fn0: (x: V0) => Promise<T1>,
2429 fn1: (x: T1) => Promise<T2>,
2430 fn2: (x: T2) => Promise<T3>): (x: V0) => Promise<T3>;
2431 pipeP<V0, T1, T2, T3, T4>(
2432 fn0: (x: V0) => Promise<T1>,
2433 fn1: (x: T1) => Promise<T2>,
2434 fn2: (x: T2) => Promise<T3>,
2435 fn3: (x: T3) => Promise<T4>): (x: V0) => Promise<T4>;
2436 pipeP<V0, T1, T2, T3, T4, T5>(
2437 fn0: (x: V0) => Promise<T1>,
2438 fn1: (x: T1) => Promise<T2>,
2439 fn2: (x: T2) => Promise<T3>,
2440 fn3: (x: T3) => Promise<T4>,
2441 fn4: (x: T4) => Promise<T5>): (x: V0) => Promise<T5>;
2442 pipeP<V0, T1, T2, T3, T4, T5, T6>(
2443 fn0: (x: V0) => Promise<T1>,
2444 fn1: (x: T1) => Promise<T2>,
2445 fn2: (x: T2) => Promise<T3>,
2446 fn3: (x: T3) => Promise<T4>,
2447 fn4: (x: T4) => Promise<T5>,
2448 fn5: (x: T5) => Promise<T6>): (x: V0) => Promise<T6>;
2449 pipeP<V0, T1, T2, T3, T4, T5, T6, T7>(
2450 fn0: (x: V0) => Promise<T1>,
2451 fn1: (x: T1) => Promise<T2>,
2452 fn2: (x: T2) => Promise<T3>,
2453 fn3: (x: T3) => Promise<T4>,
2454 fn4: (x: T4) => Promise<T5>,
2455 fn5: (x: T5) => Promise<T6>,
2456 fn: (x: T6) => Promise<T7>): (x: V0) => Promise<T7>;
2457 pipeP<V0, T1, T2, T3, T4, T5, T6, T7, T8>(
2458 fn0: (x: V0) => Promise<T1>,
2459 fn1: (x: T1) => Promise<T2>,
2460 fn2: (x: T2) => Promise<T3>,
2461 fn3: (x: T3) => Promise<T4>,
2462 fn4: (x: T4) => Promise<T5>,
2463 fn5: (x: T5) => Promise<T6>,
2464 fn6: (x: T6) => Promise<T7>,
2465 fn: (x: T7) => Promise<T8>): (x: V0) => Promise<T8>;
2466 pipeP<V0, T1, T2, T3, T4, T5, T6, T7, T8, T9>(
2467 fn0: (x0: V0) => Promise<T1>,
2468 fn1: (x: T1) => Promise<T2>,
2469 fn2: (x: T2) => Promise<T3>,
2470 fn3: (x: T3) => Promise<T4>,
2471 fn4: (x: T4) => Promise<T5>,
2472 fn5: (x: T5) => Promise<T6>,
2473 fn6: (x: T6) => Promise<T7>,
2474 fn7: (x: T7) => Promise<T8>,
2475 fn8: (x: T8) => Promise<T9>): (x0: V0) => Promise<T9>;
2476 pipeP<V0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
2477 fn0: (x0: V0) => Promise<T1>,
2478 fn1: (x: T1) => Promise<T2>,
2479 fn2: (x: T2) => Promise<T3>,
2480 fn3: (x: T3) => Promise<T4>,
2481 fn4: (x: T4) => Promise<T5>,
2482 fn5: (x: T5) => Promise<T6>,
2483 fn6: (x: T6) => Promise<T7>,
2484 fn7: (x: T7) => Promise<T8>,
2485 fn8: (x: T8) => Promise<T9>,
2486 fn9: (x: T9) => Promise<T10>): (x0: V0) => Promise<T10>;
2487
2488 /*
2489 * Performs left-to-right function composition using transforming function.
2490 * With the current typings, all functions must be unary.
2491 */
2492 pipeWith<V0, T>(composer: (a: any) => any, fns: PipeWithFns<V0, T>): (x0: V0) => T;
2493 pipeWith(composer: (a: any) => any): <V0, T>(fns: PipeWithFns<V0, T>) => (x0: V0) => T;
2494
2495 /**
2496 * Returns a new list by plucking the same named property off all objects in the list supplied.
2497 */
2498 pluck<K extends keyof T, T>(p: K, list: readonly T[]): Array<T[K]>;
2499 pluck<T>(p: number, list: Array<{ [k: number]: T }>): T[];
2500 pluck<P extends string>(p: P): <T>(list: Array<Record<P, T>>) => T[];
2501 pluck(p: number): <T>(list: Array<{ [k: number]: T }>) => T[];
2502
2503 /**
2504 * Returns a new list with the given element at the front, followed by the contents of the
2505 * list.
2506 */
2507 prepend<T>(el: T, list: readonly T[]): T[];
2508 prepend<T>(el: T): (list: readonly T[]) => T[];
2509
2510 /**
2511 * Multiplies together all the elements of a list.
2512 */
2513 product(list: readonly number[]): number;
2514
2515 /**
2516 * Reasonable analog to SQL `select` statement.
2517 */
2518 project<T, U>(props: readonly string[], objs: readonly T[]): U[];
2519 project<T, U>(props: readonly string[]): (objs: readonly T[]) => U[];
2520
2521 /**
2522 * Returns a function that when supplied an object returns the indicated property of that object, if it exists.
2523 */
2524 prop<T>(__: Placeholder, obj: T): <P extends keyof T>(p: P) => T[P];
2525 prop<P extends keyof T, T>(p: P, obj: T): T[P];
2526 prop<P extends string>(p: P): <T>(obj: Record<P, T>) => T;
2527 prop<P extends string, T>(p: P): (obj: Record<P, T>) => T;
2528
2529 /**
2530 * Determines whether the given property of an object has a specific
2531 * value according to strict equality (`===`). Most likely used to
2532 * filter a list.
2533 */
2534 propEq<T>(name: string | number, val: T, obj: any): boolean;
2535 propEq<T>(name: string | number, val: T): (obj: any) => boolean;
2536 propEq(name: string | number): {
2537 <T>(val: T, obj: any): boolean;
2538 <T>(val: T): (obj: any) => boolean;
2539 };
2540
2541 /**
2542 * Returns true if the specified object property is of the given type; false otherwise.
2543 */
2544 propIs(type: any, name: string, obj: any): boolean;
2545 propIs(type: any, name: string): (obj: any) => boolean;
2546 propIs(type: any): {
2547 (name: string, obj: any): boolean;
2548 (name: string): (obj: any) => boolean;
2549 };
2550
2551 /**
2552 * If the given, non-null object has an own property with the specified name, returns the value of that property.
2553 * Otherwise returns the provided default value.
2554 */
2555 propOr<T, U>(val: T, __: Placeholder, obj: U): <V>(p: string) => V;
2556 propOr<U>(__: Placeholder, p: string, obj: U): <T, V>(val: T) => V;
2557 propOr<T, U, V>(val: T, p: string, obj: U): V;
2558 propOr<T>(val: T, p: string): <U, V>(obj: U) => V;
2559 propOr<T>(val: T): <U, V>(p: string, obj: U) => V;
2560
2561 /**
2562 * Returns the value at the specified property.
2563 * The only difference from `prop` is the parameter order.
2564 * Note: TS1.9 # replace any by dictionary
2565 */
2566 props<P extends string, T>(ps: readonly P[], obj: Record<P, T>): T[];
2567 props<P extends string>(ps: readonly P[]): <T>(obj: Record<P, T>) => T[];
2568 props<P extends string, T>(ps: readonly P[]): (obj: Record<P, T>) => T[];
2569
2570 /**
2571 * Returns true if the specified object property satisfies the given predicate; false otherwise.
2572 */
2573 propSatisfies<T, U>(pred: (val: T) => boolean, name: string, obj: U): boolean;
2574 propSatisfies<T, U>(pred: (val: T) => boolean, name: string): (obj: U) => boolean;
2575 propSatisfies<T, U>(pred: (val: T) => boolean): F.Curry<(a: string, b: U) => boolean>;
2576
2577 /**
2578 * Returns a list of numbers from `from` (inclusive) to `to`
2579 * (exclusive). In mathematical terms, `range(a, b)` is equivalent to
2580 * the half-open interval `[a, b)`.
2581 */
2582 range(from: number, to: number): number[];
2583 range(from: number): (to: number) => number[];
2584
2585 /**
2586 * Returns a single item by iterating through the list, successively calling the iterator
2587 * function and passing it an accumulator value and the current value from the array, and
2588 * then passing the result to the next call.
2589 */
2590 reduce<T, TResult>(fn: (acc: TResult, elem: T) => TResult | Reduced<TResult>, acc: TResult, list: readonly T[]): TResult;
2591 reduce<T, TResult>(fn: (acc: TResult, elem: T) => TResult | Reduced<TResult>): (acc: TResult, list: readonly T[]) => TResult;
2592 reduce<T, TResult>(fn: (acc: TResult, elem: T) => TResult | Reduced<TResult>, acc: TResult): (list: readonly T[]) => TResult;
2593
2594 /**
2595 * Groups the elements of the list according to the result of calling the String-returning function keyFn on each
2596 * element and reduces the elements of each group to a single value via the reducer function valueFn.
2597 */
2598 reduceBy<T, TResult>(valueFn: (acc: TResult, elem: T) => TResult, acc: TResult, keyFn: (elem: T) => string, list: readonly T[]): { [index: string]: TResult };
2599 reduceBy<T, TResult>(valueFn: (acc: TResult, elem: T) => TResult, acc: TResult, keyFn: (elem: T) => string): (list: readonly T[]) => { [index: string]: TResult };
2600 reduceBy<T, TResult>(valueFn: (acc: TResult, elem: T) => TResult, acc: TResult): F.Curry<(a: (elem: T) => string, b: readonly T[]) => { [index: string]: TResult }>;
2601 reduceBy<T, TResult>(valueFn: (acc: TResult, elem: T) => TResult): F.Curry<(a: TResult, b: (elem: T) => string, c: readonly T[]) => { [index: string]: TResult }>;
2602
2603 /**
2604 * Returns a value wrapped to indicate that it is the final value of the reduce and
2605 * transduce functions. The returned value should be considered a black box: the internal
2606 * structure is not guaranteed to be stable.
2607 */
2608 reduced<T>(elem: T): Reduced<T>;
2609
2610 /**
2611 * Returns a single item by iterating through the list, successively calling the iterator
2612 * function and passing it an accumulator value and the current value from the array, and
2613 * then passing the result to the next call.
2614 */
2615 reduceRight<T, TResult>(fn: (elem: T, acc: TResult) => TResult, acc: TResult, list: readonly T[]): TResult;
2616 reduceRight<T, TResult>(fn: (elem: T, acc: TResult) => TResult): (acc: TResult, list: readonly T[]) => TResult;
2617 reduceRight<T, TResult>(fn: (elem: T, acc: TResult) => TResult, acc: TResult): (list: readonly T[]) => TResult;
2618
2619 /**
2620 * Like reduce, reduceWhile returns a single item by iterating through the list, successively
2621 * calling the iterator function. reduceWhile also takes a predicate that is evaluated before
2622 * each step. If the predicate returns false, it "short-circuits" the iteration and returns
2623 * the current value of the accumulator.
2624 */
2625 reduceWhile<T, TResult>(predicate: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult, acc: TResult, list: readonly T[]): TResult;
2626 reduceWhile<T, TResult>(predicate: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult, acc: TResult): (list: readonly T[]) => TResult;
2627 reduceWhile<T, TResult>(predicate: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult): F.Curry<(a: TResult, b: readonly T[]) => TResult>;
2628 reduceWhile<T, TResult>(predicate: (acc: TResult, elem: T) => boolean): F.Curry<(a: (acc: TResult, elem: T) => TResult, b: TResult, c: readonly T[]) => TResult>;
2629
2630 /**
2631 * Similar to `filter`, except that it keeps only values for which the given predicate
2632 * function returns falsy.
2633 */
2634 reject: Filter;
2635
2636 /**
2637 * Removes the sub-list of `list` starting at index `start` and containing `count` elements.
2638 */
2639 remove<T>(start: number, count: number, list: readonly T[]): T[];
2640 remove<T>(start: number): (count: number, list: readonly T[]) => T[];
2641 remove<T>(start: number, count: number): (list: readonly T[]) => T[];
2642
2643 /**
2644 * Returns a fixed list of size n containing a specified identical value.
2645 */
2646 repeat<T>(a: T, n: number): T[];
2647 repeat<T>(a: T): (n: number) => T[];
2648
2649 /**
2650 * Replace a substring or regex match in a string with a replacement.
2651 */
2652 replace(pattern: RegExp | string, replacement: string | ((match: string, ...args: readonly any[]) => string), str: string): string;
2653 replace(pattern: RegExp | string, replacement: string | ((match: string, ...args: readonly any[]) => string)): (str: string) => string;
2654 replace(pattern: RegExp | string): (replacement: string | ((match: string, ...args: readonly any[]) => string)) => (str: string) => string;
2655
2656 /**
2657 * Returns a new list with the same elements as the original list, just in the reverse order.
2658 */
2659 reverse<T>(list: readonly T[]): T[];
2660 /**
2661 * Returns a new string with the characters in reverse order.
2662 */
2663 reverse(str: string): string;
2664
2665 /**
2666 * Scan is similar to reduce, but returns a list of successively reduced values from the left.
2667 */
2668 scan<T, TResult>(fn: (acc: TResult, elem: T) => any, acc: TResult, list: readonly T[]): TResult[];
2669 scan<T, TResult>(fn: (acc: TResult, elem: T) => any, acc: TResult): (list: readonly T[]) => TResult[];
2670 scan<T, TResult>(fn: (acc: TResult, elem: T) => any): (acc: TResult, list: readonly T[]) => TResult[];
2671
2672 /**
2673 * Returns the result of "setting" the portion of the given data structure focused by the given lens to the
2674 * given value.
2675 */
2676 set<T, U>(lens: Lens, a: U, obj: T): T;
2677 set<U>(lens: Lens, a: U): <T>(obj: T) => T;
2678 set(lens: Lens): <T, U>(a: U, obj: T) => T;
2679
2680 /**
2681 * Returns the elements from `xs` starting at `a` and ending at `b - 1`.
2682 */
2683 slice(a: number, b: number, list: string): string;
2684 slice<T>(a: number, b: number, list: readonly T[]): T[];
2685 slice(a: number, b: number): {
2686 (list: string): string;
2687 <T>(list: readonly T[]): T[];
2688 };
2689 slice(a: number): {
2690 (b: number, list: string): string;
2691 <T>(b: number, list: readonly T[]): T[];
2692 };
2693
2694 /**
2695 * Returns a copy of the list, sorted according to the comparator function, which should accept two values at a
2696 * time and return a negative number if the first value is smaller, a positive number if it's larger, and zero
2697 * if they are equal.
2698 */
2699 sort<T>(fn: (a: T, b: T) => number, list: readonly T[]): T[];
2700 sort<T>(fn: (a: T, b: T) => number): (list: readonly T[]) => T[];
2701
2702 /**
2703 * Sorts the list according to a key generated by the supplied function.
2704 */
2705 sortBy<T>(fn: (a: T) => Ord, list: readonly T[]): T[];
2706 sortBy(fn: (a: any) => Ord): <T>(list: readonly T[]) => T[];
2707
2708 /**
2709 * Sorts a list according to a list of comparators.
2710 */
2711 sortWith<T>(fns: Array<((a: T, b: T) => number)>, list: readonly T[]): T[];
2712 sortWith<T>(fns: Array<((a: T, b: T) => number)>): (list: readonly T[]) => T[];
2713
2714 /**
2715 * Splits a string into an array of strings based on the given
2716 * separator.
2717 */
2718 split(sep: string | RegExp): (str: string) => string[];
2719 split(sep: string | RegExp, str: string): string[];
2720
2721 /**
2722 * Splits a given list or string at a given index.
2723 */
2724 splitAt<T>(index: number, list: readonly T[]): [T[], T[]];
2725 splitAt(index: number, list: string): [string, string];
2726 splitAt(index: number): {
2727 <T>(list: readonly T[]): [T[], T[]];
2728 (list: string): [string, string];
2729 };
2730
2731 /**
2732 * Splits a collection into slices of the specified length.
2733 */
2734 splitEvery<T>(a: number, list: readonly T[]): T[][];
2735 splitEvery(a: number, list: string): string[];
2736 splitEvery(a: number): {
2737 (list: string): string[];
2738 <T>(list: readonly T[]): T[][];
2739 };
2740
2741 /**
2742 * Takes a list and a predicate and returns a pair of lists with the following properties:
2743 * - the result of concatenating the two output lists is equivalent to the input list;
2744 * - none of the elements of the first output list satisfies the predicate; and
2745 * - if the second output list is non-empty, its first element satisfies the predicate.
2746 */
2747 splitWhen<T, U>(pred: (val: T) => boolean, list: readonly U[]): U[][];
2748 splitWhen<T>(pred: (val: T) => boolean): <U>(list: readonly U[]) => U[][];
2749
2750 /**
2751 * Checks if a list starts with the provided values
2752 */
2753 startsWith(a: string, list: string): boolean;
2754 startsWith(a: string): (list: string) => boolean;
2755 startsWith<T>(a: T | readonly T[], list: readonly T[]): boolean;
2756 startsWith<T>(a: T | readonly T[]): (list: readonly T[]) => boolean;
2757
2758 /**
2759 * Subtracts two numbers. Equivalent to `a - b` but curried.
2760 */
2761 subtract(__: Placeholder, b: number): (a: number) => number;
2762 subtract(__: Placeholder): (b: number, a: number) => number;
2763 subtract(a: number, b: number): number;
2764 subtract(a: number): (b: number) => number;
2765
2766 /**
2767 * Adds together all the elements of a list.
2768 */
2769 sum(list: readonly number[]): number;
2770
2771 /**
2772 * Finds the set (i.e. no duplicates) of all elements contained in the first or second list, but not both.
2773 */
2774 symmetricDifference<T>(list1: readonly T[], list2: readonly T[]): T[];
2775 symmetricDifference<T>(list: readonly T[]): <T>(list: readonly T[]) => T[];
2776
2777 /**
2778 * Finds the set (i.e. no duplicates) of all elements contained in the first or second list, but not both.
2779 * Duplication is determined according to the value returned by applying the supplied predicate to two list elements.
2780 */
2781 symmetricDifferenceWith<T>(pred: (a: T, b: T) => boolean, list1: readonly T[], list2: readonly T[]): T[];
2782 symmetricDifferenceWith<T>(pred: (a: T, b: T) => boolean): F.Curry<(a: readonly T[], b: readonly T[]) => T[]>;
2783
2784 /**
2785 * A function that always returns true. Any passed in parameters are ignored.
2786 */
2787 T(): boolean;
2788
2789 /**
2790 * Returns all but the first element of a list or string.
2791 */
2792 tail(list: string): string;
2793 tail<T extends any>(list: readonly T[]): T[];
2794
2795 /**
2796 * Returns a new list containing the first `n` elements of the given list. If
2797 * `n > * list.length`, returns a list of `list.length` elements.
2798 */
2799 take<T>(n: number, xs: readonly T[]): T[];
2800 take(n: number, xs: string): string;
2801 take(n: number): {
2802 (xs: string): string;
2803 <T>(xs: readonly T[]): T[];
2804 };
2805
2806 /**
2807 * Returns a new list containing the last n elements of the given list. If n > list.length,
2808 * returns a list of list.length elements.
2809 */
2810 takeLast<T>(n: number, xs: readonly T[]): T[];
2811 takeLast(n: number, xs: string): string;
2812 takeLast(n: number): {
2813 <T>(xs: readonly T[]): T[];
2814 (xs: string): string;
2815 };
2816
2817 /**
2818 * Returns a new list containing the last n elements of a given list, passing each value
2819 * to the supplied predicate function, and terminating when the predicate function returns
2820 * false. Excludes the element that caused the predicate function to fail. The predicate
2821 * function is passed one argument: (value).
2822 */
2823 takeLastWhile<T>(pred: (a: T) => boolean, list: readonly T[]): T[];
2824 takeLastWhile<T>(pred: (a: T) => boolean): <T>(list: readonly T[]) => T[];
2825
2826 /**
2827 * Returns a new list containing the first `n` elements of a given list, passing each value
2828 * to the supplied predicate function, and terminating when the predicate function returns
2829 * `false`.
2830 */
2831 takeWhile<T>(fn: (x: T) => boolean, list: readonly T[]): T[];
2832 takeWhile<T>(fn: (x: T) => boolean): (list: readonly T[]) => T[];
2833
2834 /**
2835 * The function to call with x. The return value of fn will be thrown away.
2836 */
2837 tap<T>(fn: (a: T) => any, value: T): T;
2838 tap<T>(fn: (a: T) => any): (value: T) => T;
2839
2840 /**
2841 * Determines whether a given string matches a given regular expression.
2842 */
2843 test(regexp: RegExp, str: string): boolean;
2844 test(regexp: RegExp): (str: string) => boolean;
2845
2846 /**
2847 * 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.
2848 */
2849 then<A, B>(onSuccess: (a: A) => B | Promise<B>, promise: Promise<A>): Promise<B>;
2850 then<A, B>(onSuccess: (a: A) => B | Promise<B>): (promise: Promise<A>) => Promise<B>;
2851
2852 /**
2853 * Creates a thunk out of a function.
2854 * A thunk delays a calculation until its result is needed, providing lazy evaluation of arguments.
2855 */
2856 thunkify<F extends (...args: readonly any[]) => any>(fn: F): F.Curry<(...args: Parameters<F>) => (() => ReturnType<F>)>;
2857
2858 /**
2859 * Calls an input function `n` times, returning an array containing the results of those
2860 * function calls.
2861 */
2862 times<T>(fn: (i: number) => T, n: number): T[];
2863 times<T>(fn: (i: number) => T): (n: number) => T[];
2864
2865 /**
2866 * The lower case version of a string.
2867 */
2868 toLower(str: string): string;
2869
2870 /**
2871 * Converts an object into an array of key, value arrays.
2872 * Only the object's own properties are used.
2873 * Note that the order of the output array is not guaranteed to be
2874 * consistent across different JS platforms.
2875 */
2876 toPairs<S>(obj: { [k: string]: S } | { [k: number]: S }): Array<[string, S]>;
2877
2878 /**
2879 * Converts an object into an array of key, value arrays.
2880 * The object's own properties and prototype properties are used.
2881 * Note that the order of the output array is not guaranteed to be
2882 * consistent across different JS platforms.
2883 */
2884 toPairsIn<S>(obj: { [k: string]: S } | { [k: number]: S }): Array<[string, S]>;
2885
2886 /**
2887 * Returns the string representation of the given value. eval'ing the output should
2888 * result in a value equivalent to the input value. Many of the built-in toString
2889 * methods do not satisfy this requirement.
2890 *
2891 * If the given value is an [object Object] with a toString method other than
2892 * Object.prototype.toString, this method is invoked with no arguments to produce the
2893 * return value. This means user-defined constructor functions can provide a suitable
2894 * toString method.
2895 */
2896 toString<T>(val: T): string;
2897
2898 /**
2899 * The upper case version of a string.
2900 */
2901 toUpper(str: string): string;
2902
2903 /**
2904 * Initializes a transducer using supplied iterator function. Returns a single item by iterating through the
2905 * list, successively calling the transformed iterator function and passing it an accumulator value and the
2906 * current value from the array, and then passing the result to the next call.
2907 */
2908 transduce<T, U>(xf: (arg: readonly T[]) => T[], fn: (acc: readonly U[], val: U) => U[], acc: readonly T[], list: readonly T[]): U;
2909 transduce<T, U>(xf: (arg: readonly T[]) => T[]): (fn: (acc: readonly U[], val: U) => U[], acc: readonly T[], list: readonly T[]) => U;
2910 transduce<T, U>(xf: (arg: readonly T[]) => T[], fn: (acc: readonly U[], val: U) => U[]): (acc: readonly T[], list: readonly T[]) => U;
2911 transduce<T, U>(xf: (arg: readonly T[]) => T[], fn: (acc: readonly U[], val: U) => U[], acc: readonly T[]): (list: readonly T[]) => U;
2912
2913 /**
2914 * 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.
2915 */
2916 transpose<T>(list: readonly T[][]): T[][];
2917
2918 /**
2919 * Maps an Applicative-returning function over a Traversable, then uses
2920 * sequence to transform the resulting Traversable of Applicative into
2921 * an Applicative of Traversable.
2922 */
2923 traverse<A, B>(of: (a: B) => B[], fn: (t: A) => B[], list: readonly A[]): B[][];
2924 traverse<A, B>(of: (a: B) => B[], fn: (t: A) => B[]): (list: readonly A[]) => B[][];
2925 traverse<A, B>(of: (a: B) => B[]): (fn: (t: A) => B[], list: readonly A[]) => B[][];
2926
2927 /**
2928 * Removes (strips) whitespace from both ends of the string.
2929 */
2930 trim(str: string): string;
2931
2932 /**
2933 * tryCatch takes two functions, a tryer and a catcher. The returned function evaluates the tryer; if it does
2934 * not throw, it simply returns the result. If the tryer does throw, the returned function evaluates the catcher
2935 * function and returns its result. Note that for effective composition with this function, both the tryer and
2936 * catcher functions must return the same type of results.
2937 */
2938 tryCatch<T>(tryer: (...args: readonly any[]) => T, catcher: (...args: readonly any[]) => T): (...args: readonly any[]) => T;
2939
2940 /**
2941 * Gives a single-word string description of the (native) type of a value, returning such answers as 'Object',
2942 * 'Number', 'Array', or 'Null'. Does not attempt to distinguish user Object types any further, reporting them
2943 * all as 'Object'.
2944 */
2945 type(val: any): 'Object' | 'Number' | 'Boolean' | 'String' | 'Null' | 'Array' | 'RegExp' | 'Function' | 'Undefined';
2946
2947 /**
2948 * Takes a function fn, which takes a single array argument, and returns a function which:
2949 * - takes any number of positional arguments;
2950 * - passes these arguments to fn as an array; and
2951 * - returns the result.
2952 * In other words, R.unapply derives a variadic function from a function which takes an array.
2953 * R.unapply is the inverse of R.apply.
2954 */
2955 unapply<T>(fn: (args: readonly any[]) => T): (...args: readonly any[]) => T;
2956
2957 /**
2958 * Wraps a function of any arity (including nullary) in a function that accepts exactly 1 parameter.
2959 * Any extraneous parameters will not be passed to the supplied function.
2960 */
2961 unary<T>(fn: (a: T, ...args: readonly any[]) => any): (a: T) => any;
2962
2963 /**
2964 * Returns a function of arity n from a (manually) curried function.
2965 */
2966 uncurryN<T>(len: number, fn: (a: any) => any): (...a: readonly any[]) => T;
2967
2968 /**
2969 * Builds a list from a seed value. Accepts an iterator function, which returns either false
2970 * to stop iteration or an array of length 2 containing the value to add to the resulting
2971 * list and the seed to be used in the next call to the iterator function.
2972 */
2973 unfold<T, TResult>(fn: (seed: T) => [TResult, T] | false, seed: T): TResult[];
2974 unfold<T, TResult>(fn: (seed: T) => [TResult, T] | false): (seed: T) => TResult[];
2975
2976 /**
2977 * Combines two lists into a set (i.e. no duplicates) composed of the
2978 * elements of each list.
2979 */
2980 union<T>(as: readonly T[], bs: readonly T[]): T[];
2981 union<T>(as: readonly T[]): (bs: readonly T[]) => T[];
2982
2983 /**
2984 * Combines two lists into a set (i.e. no duplicates) composed of the elements of each list. Duplication is
2985 * determined according to the value returned by applying the supplied predicate to two list elements.
2986 */
2987 unionWith<T>(pred: (a: T, b: T) => boolean, list1: readonly T[], list2: readonly T[]): T[];
2988 unionWith<T>(pred: (a: T, b: T) => boolean): F.Curry<(a: readonly T[], b: readonly T[]) => T[]>;
2989
2990 /**
2991 * Returns a new list containing only one copy of each element in the original list.
2992 */
2993 uniq<T>(list: readonly T[]): T[];
2994
2995 /**
2996 * Returns a new list containing only one copy of each element in the original list,
2997 * based upon the value returned by applying the supplied function to each list element.
2998 * Prefers the first item if the supplied function produces the same value on two items.
2999 * R.equals is used for comparison.
3000 */
3001 uniqBy<T, U>(fn: (a: T) => U, list: readonly T[]): T[];
3002 uniqBy<T, U>(fn: (a: T) => U): (list: readonly T[]) => T[];
3003
3004 /**
3005 * Returns a new list containing only one copy of each element in the original list, based upon the value
3006 * returned by applying the supplied predicate to two list elements.
3007 */
3008 uniqWith<T, U>(pred: (x: T, y: T) => boolean, list: readonly T[]): T[];
3009 uniqWith<T, U>(pred: (x: T, y: T) => boolean): (list: readonly T[]) => T[];
3010
3011 /**
3012 * Tests the final argument by passing it to the given predicate function. If the predicate is not satisfied,
3013 * the function will return the result of calling the whenFalseFn function with the same argument. If the
3014 * predicate is satisfied, the argument is returned as is.
3015 */
3016 unless<T, U>(pred: (a: T) => boolean, whenFalseFn: (a: T) => U, obj: T): U;
3017 unless<T, U>(pred: (a: T) => boolean, whenFalseFn: (a: T) => U): (obj: T) => U;
3018
3019 /**
3020 * Returns a new list by pulling every item at the first level of nesting out, and putting
3021 * them in a new array.
3022 */
3023 unnest<T extends readonly any[]>(list: T): T.UnNest<T>;
3024
3025 /**
3026 * Takes a predicate, a transformation function, and an initial value, and returns a value of the same type as
3027 * the initial value. It does so by applying the transformation until the predicate is satisfied, at which point
3028 * it returns the satisfactory value.
3029 */
3030 until<T, U>(pred: (val: T) => boolean, fn: (val: T) => U, init: U): U;
3031 until<T, U>(pred: (val: T) => boolean, fn: (val: T) => U): (init: U) => U;
3032
3033 /**
3034 * Returns a new copy of the array with the element at the provided index replaced with the given value.
3035 */
3036 update<T>(index: number, value: T, list: readonly T[]): T[];
3037 update<T>(index: number, value: T): (list: readonly T[]) => T[];
3038
3039 /**
3040 * Accepts a function fn and a list of transformer functions and returns a new curried function.
3041 * When the new function is invoked, it calls the function fn with parameters consisting of the
3042 * result of calling each supplied handler on successive arguments to the new function.
3043 *
3044 * If more arguments are passed to the returned function than transformer functions, those arguments
3045 * are passed directly to fn as additional parameters. If you expect additional arguments that don't
3046 * need to be transformed, although you can ignore them, it's best to pass an identity function so
3047 * that the new function reports the correct arity.
3048 */
3049 useWith(fn: ((...a: readonly any[]) => any), transformers: Array<((...a: readonly any[]) => any)>): (...a: readonly any[]) => any;
3050
3051 /**
3052 * Returns a list of all the enumerable own properties of the supplied object.
3053 * Note that the order of the output array is not guaranteed across
3054 * different JS platforms.
3055 */
3056 values<T extends object, K extends keyof T>(obj: T): Array<T[K]>;
3057
3058 /**
3059 * Returns a list of all the properties, including prototype properties, of the supplied
3060 * object. Note that the order of the output array is not guaranteed to be consistent across different JS platforms.
3061 */
3062 valuesIn<T>(obj: any): T[];
3063
3064 /**
3065 * Returns a "view" of the given data structure, determined by the given lens. The lens's focus determines which
3066 * portion of the data structure is visible.
3067 */
3068 view<T, U>(lens: Lens): (obj: T) => U;
3069 view<T, U>(lens: Lens, obj: T): U;
3070
3071 /**
3072 * Tests the final argument by passing it to the given predicate function. If the predicate is satisfied, the function
3073 * will return the result of calling the whenTrueFn function with the same argument. If the predicate is not satisfied,
3074 * the argument is returned as is.
3075 */
3076 when<T, U>(pred: (a: T) => boolean, whenTrueFn: (a: T) => U, obj: T): U;
3077 when<T, U>(pred: (a: T) => boolean, whenTrueFn: (a: T) => U): (obj: T) => U;
3078
3079 /**
3080 * Takes a spec object and a test object and returns true if the test satisfies the spec.
3081 * Any property on the spec that is not a function is interpreted as an equality
3082 * relation.
3083 *
3084 * If the spec has a property mapped to a function, then `where` evaluates the function, passing in
3085 * the test object's value for the property in question, as well as the whole test object.
3086 *
3087 * `where` is well suited to declarativley expressing constraints for other functions, e.g.,
3088 * `filter`, `find`, `pickWith`, etc.
3089 */
3090 where<T, U>(spec: T, testObj: U): boolean;
3091 where<T>(spec: T): <U>(testObj: U) => boolean;
3092 where<ObjFunc2, U>(spec: ObjFunc2, testObj: U): boolean;
3093 where<ObjFunc2>(spec: ObjFunc2): <U>(testObj: U) => boolean;
3094
3095 /**
3096 * Takes a spec object and a test object; returns true if the test satisfies the spec,
3097 * false otherwise. An object satisfies the spec if, for each of the spec's own properties,
3098 * accessing that property of the object gives the same value (in R.eq terms) as accessing
3099 * that property of the spec.
3100 */
3101 whereEq<T, U>(spec: T, obj: U): boolean;
3102 whereEq<T>(spec: T): <U>(obj: U) => boolean;
3103
3104 /**
3105 * Returns a new list without values in the first argument. R.equals is used to determine equality.
3106 * Acts as a transducer if a transformer is given in list position.
3107 */
3108 without<T>(list1: readonly T[], list2: readonly T[]): T[];
3109 without<T>(list1: readonly T[]): (list2: readonly T[]) => T[];
3110
3111 /**
3112 * Creates a new list out of the two supplied by creating each possible pair from the lists.
3113 */
3114 xprod<K, V>(as: readonly K[], bs: readonly V[]): Array<KeyValuePair<K, V>>;
3115 xprod<K>(as: readonly K[]): <V>(bs: readonly V[]) => Array<KeyValuePair<K, V>>;
3116
3117 /**
3118 * Creates a new list out of the two supplied by pairing up equally-positioned items from
3119 * both lists. Note: `zip` is equivalent to `zipWith(function(a, b) { return [a, b] })`.
3120 */
3121 zip<K, V>(list1: readonly K[], list2: readonly V[]): Array<KeyValuePair<K, V>>;
3122 zip<K>(list1: readonly K[]): <V>(list2: readonly V[]) => Array<KeyValuePair<K, V>>;
3123
3124 /**
3125 * Creates a new object out of a list of keys and a list of values.
3126 */
3127 // TODO: Dictionary<T> as a return value is to specific, any seems to loose
3128 zipObj<T>(keys: readonly string[], values: readonly T[]): { [index: string]: T };
3129 zipObj(keys: readonly string[]): <T>(values: readonly T[]) => { [index: string]: T };
3130 zipObj<T>(keys: readonly number[], values: readonly T[]): { [index: number]: T };
3131 zipObj(keys: readonly number[]): <T>(values: readonly T[]) => { [index: number]: T };
3132
3133 /**
3134 * Creates a new list out of the two supplied by applying the function to each
3135 * equally-positioned pair in the lists.
3136 */
3137 zipWith<T, U, TResult>(fn: (x: T, y: U) => TResult, list1: readonly T[], list2: readonly U[]): TResult[];
3138 zipWith<T, U, TResult>(fn: (x: T, y: U) => TResult, list1: readonly T[]): (list2: readonly U[]) => TResult[];
3139 zipWith<T, U, TResult>(fn: (x: T, y: U) => TResult): (list1: readonly T[], list2: readonly U[]) => TResult[];
3140 }
3141}
3142
3143export = R;
3144export as namespace R;