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