rambda 7.3.0 → 7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +298 -2270
- package/dist/rambda.js +6 -359
- package/dist/rambda.mjs +13 -369
- package/dist/rambda.umd.js +1 -1
- package/immutable.d.ts +285 -238
- package/index.d.ts +285 -238
- package/package.json +23 -21
- package/rambda.js +187 -0
- package/src/equals.js +0 -12
- package/src/map.js +1 -0
- package/src/nop.js +1 -0
- package/src/test.js +1 -1
package/dist/rambda.mjs
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
function F() {
|
|
2
|
-
return false;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
function T() {
|
|
6
|
-
return true;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
1
|
function add(a, b) {
|
|
10
2
|
if (arguments.length === 1) return _b => add(a, _b);
|
|
11
3
|
return Number(a) + Number(b);
|
|
@@ -24,31 +16,25 @@ function adjustFn(index, replaceFn, list) {
|
|
|
24
16
|
clone[actualIndex] = replaceFn(clone[actualIndex]);
|
|
25
17
|
return clone;
|
|
26
18
|
}
|
|
27
|
-
|
|
28
19
|
const adjust = curry(adjustFn);
|
|
29
20
|
|
|
30
21
|
function all(predicate, list) {
|
|
31
22
|
if (arguments.length === 1) return _list => all(predicate, _list);
|
|
32
|
-
|
|
33
23
|
for (let i = 0; i < list.length; i++) {
|
|
34
24
|
if (!predicate(list[i])) return false;
|
|
35
25
|
}
|
|
36
|
-
|
|
37
26
|
return true;
|
|
38
27
|
}
|
|
39
28
|
|
|
40
29
|
function allPass(predicates) {
|
|
41
30
|
return (...input) => {
|
|
42
31
|
let counter = 0;
|
|
43
|
-
|
|
44
32
|
while (counter < predicates.length) {
|
|
45
33
|
if (!predicates[counter](...input)) {
|
|
46
34
|
return false;
|
|
47
35
|
}
|
|
48
|
-
|
|
49
36
|
counter++;
|
|
50
37
|
}
|
|
51
|
-
|
|
52
38
|
return true;
|
|
53
39
|
};
|
|
54
40
|
}
|
|
@@ -65,30 +51,24 @@ function and(a, b) {
|
|
|
65
51
|
function any(predicate, list) {
|
|
66
52
|
if (arguments.length === 1) return _list => any(predicate, _list);
|
|
67
53
|
let counter = 0;
|
|
68
|
-
|
|
69
54
|
while (counter < list.length) {
|
|
70
55
|
if (predicate(list[counter], counter)) {
|
|
71
56
|
return true;
|
|
72
57
|
}
|
|
73
|
-
|
|
74
58
|
counter++;
|
|
75
59
|
}
|
|
76
|
-
|
|
77
60
|
return false;
|
|
78
61
|
}
|
|
79
62
|
|
|
80
63
|
function anyPass(predicates) {
|
|
81
64
|
return (...input) => {
|
|
82
65
|
let counter = 0;
|
|
83
|
-
|
|
84
66
|
while (counter < predicates.length) {
|
|
85
67
|
if (predicates[counter](...input)) {
|
|
86
68
|
return true;
|
|
87
69
|
}
|
|
88
|
-
|
|
89
70
|
counter++;
|
|
90
71
|
}
|
|
91
|
-
|
|
92
72
|
return false;
|
|
93
73
|
};
|
|
94
74
|
}
|
|
@@ -105,7 +85,6 @@ function apply(fn, args) {
|
|
|
105
85
|
if (arguments.length === 1) {
|
|
106
86
|
return _args => apply(fn, _args);
|
|
107
87
|
}
|
|
108
|
-
|
|
109
88
|
return fn.apply(this, args);
|
|
110
89
|
}
|
|
111
90
|
|
|
@@ -116,33 +95,26 @@ const {
|
|
|
116
95
|
function __findHighestArity(spec, max = 0) {
|
|
117
96
|
for (const key in spec) {
|
|
118
97
|
if (spec.hasOwnProperty(key) === false || key === 'constructor') continue;
|
|
119
|
-
|
|
120
98
|
if (typeof spec[key] === 'object') {
|
|
121
99
|
max = Math.max(max, __findHighestArity(spec[key]));
|
|
122
100
|
}
|
|
123
|
-
|
|
124
101
|
if (typeof spec[key] === 'function') {
|
|
125
102
|
max = Math.max(max, spec[key].length);
|
|
126
103
|
}
|
|
127
104
|
}
|
|
128
|
-
|
|
129
105
|
return max;
|
|
130
106
|
}
|
|
131
|
-
|
|
132
107
|
function __filterUndefined() {
|
|
133
108
|
const defined = [];
|
|
134
109
|
let i = 0;
|
|
135
110
|
const l = arguments.length;
|
|
136
|
-
|
|
137
111
|
while (i < l) {
|
|
138
112
|
if (typeof arguments[i] === 'undefined') break;
|
|
139
113
|
defined[i] = arguments[i];
|
|
140
114
|
i++;
|
|
141
115
|
}
|
|
142
|
-
|
|
143
116
|
return defined;
|
|
144
117
|
}
|
|
145
|
-
|
|
146
118
|
function __applySpecWithArity(spec, arity, cache) {
|
|
147
119
|
const remaining = arity - cache.length;
|
|
148
120
|
if (remaining === 1) return x => __applySpecWithArity(spec, arity, __filterUndefined(...cache, x));
|
|
@@ -150,52 +122,39 @@ function __applySpecWithArity(spec, arity, cache) {
|
|
|
150
122
|
if (remaining === 3) return (x, y, z) => __applySpecWithArity(spec, arity, __filterUndefined(...cache, x, y, z));
|
|
151
123
|
if (remaining === 4) return (x, y, z, a) => __applySpecWithArity(spec, arity, __filterUndefined(...cache, x, y, z, a));
|
|
152
124
|
if (remaining > 4) return (...args) => __applySpecWithArity(spec, arity, __filterUndefined(...cache, ...args));
|
|
153
|
-
|
|
154
125
|
if (isArray(spec)) {
|
|
155
126
|
const ret = [];
|
|
156
127
|
let i = 0;
|
|
157
128
|
const l = spec.length;
|
|
158
|
-
|
|
159
129
|
for (; i < l; i++) {
|
|
160
130
|
if (typeof spec[i] === 'object' || isArray(spec[i])) {
|
|
161
131
|
ret[i] = __applySpecWithArity(spec[i], arity, cache);
|
|
162
132
|
}
|
|
163
|
-
|
|
164
133
|
if (typeof spec[i] === 'function') {
|
|
165
134
|
ret[i] = spec[i](...cache);
|
|
166
135
|
}
|
|
167
136
|
}
|
|
168
|
-
|
|
169
137
|
return ret;
|
|
170
138
|
}
|
|
171
|
-
|
|
172
139
|
const ret = {};
|
|
173
|
-
|
|
174
140
|
for (const key in spec) {
|
|
175
141
|
if (spec.hasOwnProperty(key) === false || key === 'constructor') continue;
|
|
176
|
-
|
|
177
142
|
if (typeof spec[key] === 'object') {
|
|
178
143
|
ret[key] = __applySpecWithArity(spec[key], arity, cache);
|
|
179
144
|
continue;
|
|
180
145
|
}
|
|
181
|
-
|
|
182
146
|
if (typeof spec[key] === 'function') {
|
|
183
147
|
ret[key] = spec[key](...cache);
|
|
184
148
|
}
|
|
185
149
|
}
|
|
186
|
-
|
|
187
150
|
return ret;
|
|
188
151
|
}
|
|
189
|
-
|
|
190
152
|
function applySpec(spec, ...args) {
|
|
191
153
|
const arity = __findHighestArity(spec);
|
|
192
|
-
|
|
193
154
|
if (arity === 0) {
|
|
194
155
|
return () => ({});
|
|
195
156
|
}
|
|
196
|
-
|
|
197
157
|
const toReturn = __applySpecWithArity(spec, arity, args);
|
|
198
|
-
|
|
199
158
|
return toReturn;
|
|
200
159
|
}
|
|
201
160
|
|
|
@@ -204,39 +163,31 @@ function assocFn(prop, newValue, obj) {
|
|
|
204
163
|
[prop]: newValue
|
|
205
164
|
});
|
|
206
165
|
}
|
|
207
|
-
|
|
208
166
|
const assoc = curry(assocFn);
|
|
209
167
|
|
|
210
168
|
function _isInteger(n) {
|
|
211
169
|
return n << 0 === n;
|
|
212
170
|
}
|
|
213
|
-
|
|
214
171
|
const isInteger = Number.isInteger || _isInteger;
|
|
215
172
|
|
|
216
173
|
function assocPathFn(path, newValue, input) {
|
|
217
174
|
const pathArrValue = typeof path === 'string' ? path.split('.').map(x => isInteger(Number(x)) ? Number(x) : x) : path;
|
|
218
|
-
|
|
219
175
|
if (pathArrValue.length === 0) {
|
|
220
176
|
return newValue;
|
|
221
177
|
}
|
|
222
|
-
|
|
223
178
|
const index = pathArrValue[0];
|
|
224
|
-
|
|
225
179
|
if (pathArrValue.length > 1) {
|
|
226
180
|
const condition = typeof input !== 'object' || input === null || !input.hasOwnProperty(index);
|
|
227
181
|
const nextInput = condition ? isInteger(pathArrValue[1]) ? [] : {} : input[index];
|
|
228
182
|
newValue = assocPathFn(Array.prototype.slice.call(pathArrValue, 1), newValue, nextInput);
|
|
229
183
|
}
|
|
230
|
-
|
|
231
184
|
if (isInteger(index) && isArray(input)) {
|
|
232
185
|
const arr = cloneList(input);
|
|
233
186
|
arr[index] = newValue;
|
|
234
187
|
return arr;
|
|
235
188
|
}
|
|
236
|
-
|
|
237
189
|
return assoc(index, newValue, input);
|
|
238
190
|
}
|
|
239
|
-
|
|
240
191
|
const assocPath = curry(assocPathFn);
|
|
241
192
|
|
|
242
193
|
function _curryN(n, cache, fn) {
|
|
@@ -246,88 +197,71 @@ function _curryN(n, cache, fn) {
|
|
|
246
197
|
const cl = cache.length;
|
|
247
198
|
const al = arguments.length;
|
|
248
199
|
const args = new Array(cl + al);
|
|
249
|
-
|
|
250
200
|
while (ci < cl) {
|
|
251
201
|
args[ci] = cache[ci];
|
|
252
202
|
ci++;
|
|
253
203
|
}
|
|
254
|
-
|
|
255
204
|
while (ai < al) {
|
|
256
205
|
args[cl + ai] = arguments[ai];
|
|
257
206
|
ai++;
|
|
258
207
|
}
|
|
259
|
-
|
|
260
208
|
const remaining = n - args.length;
|
|
261
209
|
return args.length >= n ? fn.apply(this, args) : _arity$1(remaining, _curryN(n, args, fn));
|
|
262
210
|
};
|
|
263
211
|
}
|
|
264
|
-
|
|
265
212
|
function _arity$1(n, fn) {
|
|
266
213
|
switch (n) {
|
|
267
214
|
case 0:
|
|
268
215
|
return function () {
|
|
269
216
|
return fn.apply(this, arguments);
|
|
270
217
|
};
|
|
271
|
-
|
|
272
218
|
case 1:
|
|
273
219
|
return function (_1) {
|
|
274
220
|
return fn.apply(this, arguments);
|
|
275
221
|
};
|
|
276
|
-
|
|
277
222
|
case 2:
|
|
278
223
|
return function (_1, _2) {
|
|
279
224
|
return fn.apply(this, arguments);
|
|
280
225
|
};
|
|
281
|
-
|
|
282
226
|
case 3:
|
|
283
227
|
return function (_1, _2, _3) {
|
|
284
228
|
return fn.apply(this, arguments);
|
|
285
229
|
};
|
|
286
|
-
|
|
287
230
|
case 4:
|
|
288
231
|
return function (_1, _2, _3, _4) {
|
|
289
232
|
return fn.apply(this, arguments);
|
|
290
233
|
};
|
|
291
|
-
|
|
292
234
|
case 5:
|
|
293
235
|
return function (_1, _2, _3, _4, _5) {
|
|
294
236
|
return fn.apply(this, arguments);
|
|
295
237
|
};
|
|
296
|
-
|
|
297
238
|
case 6:
|
|
298
239
|
return function (_1, _2, _3, _4, _5, _6) {
|
|
299
240
|
return fn.apply(this, arguments);
|
|
300
241
|
};
|
|
301
|
-
|
|
302
242
|
case 7:
|
|
303
243
|
return function (_1, _2, _3, _4, _5, _6, _7) {
|
|
304
244
|
return fn.apply(this, arguments);
|
|
305
245
|
};
|
|
306
|
-
|
|
307
246
|
case 8:
|
|
308
247
|
return function (_1, _2, _3, _4, _5, _6, _7, _8) {
|
|
309
248
|
return fn.apply(this, arguments);
|
|
310
249
|
};
|
|
311
|
-
|
|
312
250
|
case 9:
|
|
313
251
|
return function (_1, _2, _3, _4, _5, _6, _7, _8, _9) {
|
|
314
252
|
return fn.apply(this, arguments);
|
|
315
253
|
};
|
|
316
|
-
|
|
317
254
|
default:
|
|
318
255
|
return function (_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) {
|
|
319
256
|
return fn.apply(this, arguments);
|
|
320
257
|
};
|
|
321
258
|
}
|
|
322
259
|
}
|
|
323
|
-
|
|
324
260
|
function curryN(n, fn) {
|
|
325
261
|
if (arguments.length === 1) return _fn => curryN(n, _fn);
|
|
326
|
-
|
|
327
262
|
if (n > 10) {
|
|
328
263
|
throw new Error('First argument to _arity must be a non-negative integer no greater than ten');
|
|
329
264
|
}
|
|
330
|
-
|
|
331
265
|
return _arity$1(n, _curryN(n, [], fn));
|
|
332
266
|
}
|
|
333
267
|
|
|
@@ -335,7 +269,6 @@ function bind(fn, thisObj) {
|
|
|
335
269
|
if (arguments.length === 1) {
|
|
336
270
|
return _thisObj => bind(fn, _thisObj);
|
|
337
271
|
}
|
|
338
|
-
|
|
339
272
|
return curryN(fn.length, (...args) => fn.apply(thisObj, args));
|
|
340
273
|
}
|
|
341
274
|
|
|
@@ -348,7 +281,6 @@ function chain(fn, list) {
|
|
|
348
281
|
if (arguments.length === 1) {
|
|
349
282
|
return _list => chain(fn, _list);
|
|
350
283
|
}
|
|
351
|
-
|
|
352
284
|
return [].concat(...list.map(fn));
|
|
353
285
|
}
|
|
354
286
|
|
|
@@ -356,23 +288,19 @@ function clampFn(min, max, input) {
|
|
|
356
288
|
if (min > max) {
|
|
357
289
|
throw new Error('min must not be greater than max in clamp(min, max, value)');
|
|
358
290
|
}
|
|
359
|
-
|
|
360
291
|
if (input >= min && input <= max) return input;
|
|
361
292
|
if (input > max) return max;
|
|
362
293
|
if (input < min) return min;
|
|
363
294
|
}
|
|
364
|
-
|
|
365
295
|
const clamp = curry(clampFn);
|
|
366
296
|
|
|
367
297
|
function clone(input) {
|
|
368
298
|
const out = isArray(input) ? Array(input.length) : {};
|
|
369
299
|
if (input && input.getTime) return new Date(input.getTime());
|
|
370
|
-
|
|
371
300
|
for (const key in input) {
|
|
372
301
|
const v = input[key];
|
|
373
302
|
out[key] = typeof v === 'object' && v !== null ? v.getTime ? new Date(v.getTime()) : clone(v) : v;
|
|
374
303
|
}
|
|
375
|
-
|
|
376
304
|
return out;
|
|
377
305
|
}
|
|
378
306
|
|
|
@@ -384,27 +312,20 @@ class ReduceStopper {
|
|
|
384
312
|
constructor(value) {
|
|
385
313
|
this.value = value;
|
|
386
314
|
}
|
|
387
|
-
|
|
388
315
|
}
|
|
389
|
-
|
|
390
316
|
function reduceFn(reducer, acc, list) {
|
|
391
317
|
if (!isArray(list)) {
|
|
392
318
|
throw new TypeError('reduce: list must be array or iterable');
|
|
393
319
|
}
|
|
394
|
-
|
|
395
320
|
let index = 0;
|
|
396
321
|
const len = list.length;
|
|
397
|
-
|
|
398
322
|
while (index < len) {
|
|
399
323
|
acc = reducer(acc, list[index], index, list);
|
|
400
|
-
|
|
401
324
|
if (acc instanceof ReduceStopper) {
|
|
402
325
|
return acc.value;
|
|
403
326
|
}
|
|
404
|
-
|
|
405
327
|
index++;
|
|
406
328
|
}
|
|
407
|
-
|
|
408
329
|
return acc;
|
|
409
330
|
}
|
|
410
331
|
const reduce = curry(reduceFn);
|
|
@@ -416,57 +337,46 @@ function _arity(n, fn) {
|
|
|
416
337
|
return function () {
|
|
417
338
|
return fn.apply(this, arguments);
|
|
418
339
|
};
|
|
419
|
-
|
|
420
340
|
case 1:
|
|
421
341
|
return function (a0) {
|
|
422
342
|
return fn.apply(this, arguments);
|
|
423
343
|
};
|
|
424
|
-
|
|
425
344
|
case 2:
|
|
426
345
|
return function (a0, a1) {
|
|
427
346
|
return fn.apply(this, arguments);
|
|
428
347
|
};
|
|
429
|
-
|
|
430
348
|
case 3:
|
|
431
349
|
return function (a0, a1, a2) {
|
|
432
350
|
return fn.apply(this, arguments);
|
|
433
351
|
};
|
|
434
|
-
|
|
435
352
|
case 4:
|
|
436
353
|
return function (a0, a1, a2, a3) {
|
|
437
354
|
return fn.apply(this, arguments);
|
|
438
355
|
};
|
|
439
|
-
|
|
440
356
|
case 5:
|
|
441
357
|
return function (a0, a1, a2, a3, a4) {
|
|
442
358
|
return fn.apply(this, arguments);
|
|
443
359
|
};
|
|
444
|
-
|
|
445
360
|
case 6:
|
|
446
361
|
return function (a0, a1, a2, a3, a4, a5) {
|
|
447
362
|
return fn.apply(this, arguments);
|
|
448
363
|
};
|
|
449
|
-
|
|
450
364
|
case 7:
|
|
451
365
|
return function (a0, a1, a2, a3, a4, a5, a6) {
|
|
452
366
|
return fn.apply(this, arguments);
|
|
453
367
|
};
|
|
454
|
-
|
|
455
368
|
case 8:
|
|
456
369
|
return function (a0, a1, a2, a3, a4, a5, a6, a7) {
|
|
457
370
|
return fn.apply(this, arguments);
|
|
458
371
|
};
|
|
459
|
-
|
|
460
372
|
case 9:
|
|
461
373
|
return function (a0, a1, a2, a3, a4, a5, a6, a7, a8) {
|
|
462
374
|
return fn.apply(this, arguments);
|
|
463
375
|
};
|
|
464
|
-
|
|
465
376
|
case 10:
|
|
466
377
|
return function (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {
|
|
467
378
|
return fn.apply(this, arguments);
|
|
468
379
|
};
|
|
469
|
-
|
|
470
380
|
default:
|
|
471
381
|
throw new Error('First argument to _arity must be a non-negative integer no greater than ten');
|
|
472
382
|
}
|
|
@@ -480,7 +390,6 @@ function pipe() {
|
|
|
480
390
|
if (arguments.length === 0) {
|
|
481
391
|
throw new Error('pipe requires at least one argument');
|
|
482
392
|
}
|
|
483
|
-
|
|
484
393
|
return _arity(arguments[0].length, reduceFn(_pipe, arguments[0], Array.prototype.slice.call(arguments, 1, Infinity)));
|
|
485
394
|
}
|
|
486
395
|
|
|
@@ -488,7 +397,6 @@ function compose() {
|
|
|
488
397
|
if (arguments.length === 0) {
|
|
489
398
|
throw new Error('compose requires at least one argument');
|
|
490
399
|
}
|
|
491
|
-
|
|
492
400
|
return pipe.apply(this, Array.prototype.slice.call(arguments, 0).reverse());
|
|
493
401
|
}
|
|
494
402
|
|
|
@@ -518,40 +426,33 @@ const {
|
|
|
518
426
|
function mapArray(fn, list, isIndexed = false) {
|
|
519
427
|
let index = 0;
|
|
520
428
|
const willReturn = Array(list.length);
|
|
521
|
-
|
|
522
429
|
while (index < list.length) {
|
|
523
430
|
willReturn[index] = isIndexed ? fn(list[index], index) : fn(list[index]);
|
|
524
431
|
index++;
|
|
525
432
|
}
|
|
526
|
-
|
|
527
433
|
return willReturn;
|
|
528
434
|
}
|
|
529
435
|
function mapObject(fn, obj) {
|
|
530
436
|
if (arguments.length === 1) {
|
|
531
437
|
return _obj => mapObject(fn, _obj);
|
|
532
438
|
}
|
|
533
|
-
|
|
534
439
|
let index = 0;
|
|
535
440
|
const objKeys = keys$1(obj);
|
|
536
441
|
const len = objKeys.length;
|
|
537
442
|
const willReturn = {};
|
|
538
|
-
|
|
539
443
|
while (index < len) {
|
|
540
444
|
const key = objKeys[index];
|
|
541
445
|
willReturn[key] = fn(obj[key], key, obj);
|
|
542
446
|
index++;
|
|
543
447
|
}
|
|
544
|
-
|
|
545
448
|
return willReturn;
|
|
546
449
|
}
|
|
547
450
|
const mapObjIndexed = mapObject;
|
|
548
451
|
function map(fn, iterable) {
|
|
549
452
|
if (arguments.length === 1) return _iterable => map(fn, _iterable);
|
|
550
|
-
|
|
551
453
|
if (!iterable) {
|
|
552
454
|
throw new Error(INCORRECT_ITERABLE_INPUT);
|
|
553
455
|
}
|
|
554
|
-
|
|
555
456
|
if (isArray(iterable)) return mapArray(fn, iterable);
|
|
556
457
|
return mapObject(fn, iterable);
|
|
557
458
|
}
|
|
@@ -573,7 +474,6 @@ function count(predicate, list) {
|
|
|
573
474
|
if (arguments.length === 1) {
|
|
574
475
|
return _list => count(predicate, _list);
|
|
575
476
|
}
|
|
576
|
-
|
|
577
477
|
if (!isArray(list)) return 0;
|
|
578
478
|
return list.filter(x => predicate(x)).length;
|
|
579
479
|
}
|
|
@@ -582,11 +482,9 @@ function countBy(fn, list) {
|
|
|
582
482
|
if (arguments.length === 1) {
|
|
583
483
|
return _list => countBy(fn, _list);
|
|
584
484
|
}
|
|
585
|
-
|
|
586
485
|
const willReturn = {};
|
|
587
486
|
list.forEach(item => {
|
|
588
487
|
const key = fn(item);
|
|
589
|
-
|
|
590
488
|
if (!willReturn[key]) {
|
|
591
489
|
willReturn[key] = 1;
|
|
592
490
|
} else {
|
|
@@ -601,12 +499,10 @@ const dec = x => x - 1;
|
|
|
601
499
|
function isFalsy(input) {
|
|
602
500
|
return input === undefined || input === null || Number.isNaN(input) === true;
|
|
603
501
|
}
|
|
604
|
-
|
|
605
502
|
function defaultTo(defaultArgument, input) {
|
|
606
503
|
if (arguments.length === 1) {
|
|
607
504
|
return _input => defaultTo(defaultArgument, _input);
|
|
608
505
|
}
|
|
609
|
-
|
|
610
506
|
return isFalsy(input) ? defaultArgument : input;
|
|
611
507
|
}
|
|
612
508
|
|
|
@@ -618,7 +514,6 @@ function type(input) {
|
|
|
618
514
|
} else if (Number.isNaN(input)) {
|
|
619
515
|
return 'NaN';
|
|
620
516
|
}
|
|
621
|
-
|
|
622
517
|
const typeResult = Object.prototype.toString.call(input).slice(8, -1);
|
|
623
518
|
return typeResult === 'AsyncFunction' ? 'Promise' : typeResult;
|
|
624
519
|
}
|
|
@@ -627,7 +522,6 @@ function _lastIndexOf(valueToFind, list) {
|
|
|
627
522
|
if (!isArray(list)) {
|
|
628
523
|
throw new Error(`Cannot read property 'indexOf' of ${list}`);
|
|
629
524
|
}
|
|
630
|
-
|
|
631
525
|
const typeOfValue = type(valueToFind);
|
|
632
526
|
if (!['Object', 'Array', 'NaN', 'RegExp'].includes(typeOfValue)) return list.lastIndexOf(valueToFind);
|
|
633
527
|
const {
|
|
@@ -635,20 +529,17 @@ function _lastIndexOf(valueToFind, list) {
|
|
|
635
529
|
} = list;
|
|
636
530
|
let index = length;
|
|
637
531
|
let foundIndex = -1;
|
|
638
|
-
|
|
639
532
|
while (--index > -1 && foundIndex === -1) {
|
|
640
533
|
if (equals(list[index], valueToFind)) {
|
|
641
534
|
foundIndex = index;
|
|
642
535
|
}
|
|
643
536
|
}
|
|
644
|
-
|
|
645
537
|
return foundIndex;
|
|
646
538
|
}
|
|
647
539
|
function _indexOf(valueToFind, list) {
|
|
648
540
|
if (!isArray(list)) {
|
|
649
541
|
throw new Error(`Cannot read property 'indexOf' of ${list}`);
|
|
650
542
|
}
|
|
651
|
-
|
|
652
543
|
const typeOfValue = type(valueToFind);
|
|
653
544
|
if (!['Object', 'Array', 'NaN', 'RegExp'].includes(typeOfValue)) return list.indexOf(valueToFind);
|
|
654
545
|
let index = -1;
|
|
@@ -656,85 +547,64 @@ function _indexOf(valueToFind, list) {
|
|
|
656
547
|
const {
|
|
657
548
|
length
|
|
658
549
|
} = list;
|
|
659
|
-
|
|
660
550
|
while (++index < length && foundIndex === -1) {
|
|
661
551
|
if (equals(list[index], valueToFind)) {
|
|
662
552
|
foundIndex = index;
|
|
663
553
|
}
|
|
664
554
|
}
|
|
665
|
-
|
|
666
555
|
return foundIndex;
|
|
667
556
|
}
|
|
668
|
-
|
|
669
557
|
function _arrayFromIterator(iter) {
|
|
670
558
|
const list = [];
|
|
671
559
|
let next;
|
|
672
|
-
|
|
673
560
|
while (!(next = iter.next()).done) {
|
|
674
561
|
list.push(next.value);
|
|
675
562
|
}
|
|
676
|
-
|
|
677
563
|
return list;
|
|
678
564
|
}
|
|
679
|
-
|
|
680
565
|
function _equalsSets(a, b) {
|
|
681
566
|
if (a.size !== b.size) {
|
|
682
567
|
return false;
|
|
683
568
|
}
|
|
684
|
-
|
|
685
569
|
const aList = _arrayFromIterator(a.values());
|
|
686
|
-
|
|
687
570
|
const bList = _arrayFromIterator(b.values());
|
|
688
|
-
|
|
689
571
|
const filtered = aList.filter(aInstance => _indexOf(aInstance, bList) === -1);
|
|
690
572
|
return filtered.length === 0;
|
|
691
573
|
}
|
|
692
|
-
|
|
693
574
|
function parseError(maybeError) {
|
|
694
575
|
const typeofError = maybeError.__proto__.toString();
|
|
695
|
-
|
|
696
576
|
if (!['Error', 'TypeError'].includes(typeofError)) return [];
|
|
697
577
|
return [typeofError, maybeError.message];
|
|
698
578
|
}
|
|
699
|
-
|
|
700
579
|
function parseDate(maybeDate) {
|
|
701
580
|
if (!maybeDate.toDateString) return [false];
|
|
702
581
|
return [true, maybeDate.getTime()];
|
|
703
582
|
}
|
|
704
|
-
|
|
705
583
|
function parseRegex(maybeRegex) {
|
|
706
584
|
if (maybeRegex.constructor !== RegExp) return [false];
|
|
707
585
|
return [true, maybeRegex.toString()];
|
|
708
586
|
}
|
|
709
|
-
|
|
710
587
|
function equals(a, b) {
|
|
711
588
|
if (arguments.length === 1) return _b => equals(a, _b);
|
|
712
589
|
const aType = type(a);
|
|
713
590
|
if (aType !== type(b)) return false;
|
|
714
|
-
|
|
715
591
|
if (aType === 'Function') {
|
|
716
592
|
return a.name === undefined ? false : a.name === b.name;
|
|
717
593
|
}
|
|
718
|
-
|
|
719
594
|
if (['NaN', 'Undefined', 'Null'].includes(aType)) return true;
|
|
720
|
-
|
|
721
595
|
if (aType === 'Number') {
|
|
722
596
|
if (Object.is(-0, a) !== Object.is(-0, b)) return false;
|
|
723
597
|
return a.toString() === b.toString();
|
|
724
598
|
}
|
|
725
|
-
|
|
726
599
|
if (['String', 'Boolean'].includes(aType)) {
|
|
727
600
|
return a.toString() === b.toString();
|
|
728
601
|
}
|
|
729
|
-
|
|
730
602
|
if (aType === 'Array') {
|
|
731
603
|
const aClone = Array.from(a);
|
|
732
604
|
const bClone = Array.from(b);
|
|
733
|
-
|
|
734
605
|
if (aClone.toString() !== bClone.toString()) {
|
|
735
606
|
return false;
|
|
736
607
|
}
|
|
737
|
-
|
|
738
608
|
let loopArrayFlag = true;
|
|
739
609
|
aClone.forEach((aCloneInstance, aCloneIndex) => {
|
|
740
610
|
if (loopArrayFlag) {
|
|
@@ -745,45 +615,34 @@ function equals(a, b) {
|
|
|
745
615
|
});
|
|
746
616
|
return loopArrayFlag;
|
|
747
617
|
}
|
|
748
|
-
|
|
749
618
|
const aRegex = parseRegex(a);
|
|
750
619
|
const bRegex = parseRegex(b);
|
|
751
|
-
|
|
752
620
|
if (aRegex[0]) {
|
|
753
621
|
return bRegex[0] ? aRegex[1] === bRegex[1] : false;
|
|
754
622
|
} else if (bRegex[0]) return false;
|
|
755
|
-
|
|
756
623
|
const aDate = parseDate(a);
|
|
757
624
|
const bDate = parseDate(b);
|
|
758
|
-
|
|
759
625
|
if (aDate[0]) {
|
|
760
626
|
return bDate[0] ? aDate[1] === bDate[1] : false;
|
|
761
627
|
} else if (bDate[0]) return false;
|
|
762
|
-
|
|
763
628
|
const aError = parseError(a);
|
|
764
629
|
const bError = parseError(b);
|
|
765
|
-
|
|
766
630
|
if (aError[0]) {
|
|
767
631
|
return bError[0] ? aError[0] === bError[0] && aError[1] === bError[1] : false;
|
|
768
632
|
}
|
|
769
|
-
|
|
770
633
|
if (aType === 'Set') {
|
|
771
634
|
return _equalsSets(a, b);
|
|
772
635
|
}
|
|
773
|
-
|
|
774
636
|
if (aType === 'Object') {
|
|
775
637
|
const aKeys = Object.keys(a);
|
|
776
|
-
|
|
777
638
|
if (aKeys.length !== Object.keys(b).length) {
|
|
778
639
|
return false;
|
|
779
640
|
}
|
|
780
|
-
|
|
781
641
|
let loopObjectFlag = true;
|
|
782
642
|
aKeys.forEach(aKeyInstance => {
|
|
783
643
|
if (loopObjectFlag) {
|
|
784
644
|
const aValue = a[aKeyInstance];
|
|
785
645
|
const bValue = b[aKeyInstance];
|
|
786
|
-
|
|
787
646
|
if (aValue !== bValue && !equals(aValue, bValue)) {
|
|
788
647
|
loopObjectFlag = false;
|
|
789
648
|
}
|
|
@@ -791,21 +650,17 @@ function equals(a, b) {
|
|
|
791
650
|
});
|
|
792
651
|
return loopObjectFlag;
|
|
793
652
|
}
|
|
794
|
-
|
|
795
653
|
return false;
|
|
796
654
|
}
|
|
797
655
|
|
|
798
656
|
function includes(valueToFind, iterable) {
|
|
799
657
|
if (arguments.length === 1) return _iterable => includes(valueToFind, _iterable);
|
|
800
|
-
|
|
801
658
|
if (typeof iterable === 'string') {
|
|
802
659
|
return iterable.includes(valueToFind);
|
|
803
660
|
}
|
|
804
|
-
|
|
805
661
|
if (!iterable) {
|
|
806
662
|
throw new TypeError(`Cannot read property \'indexOf\' of ${iterable}`);
|
|
807
663
|
}
|
|
808
|
-
|
|
809
664
|
if (!isArray(iterable)) return false;
|
|
810
665
|
return _indexOf(valueToFind, iterable) > -1;
|
|
811
666
|
}
|
|
@@ -815,38 +670,30 @@ class _Set {
|
|
|
815
670
|
this.set = new Set();
|
|
816
671
|
this.items = {};
|
|
817
672
|
}
|
|
818
|
-
|
|
819
673
|
checkUniqueness(item) {
|
|
820
674
|
const type$1 = type(item);
|
|
821
|
-
|
|
822
675
|
if (['Null', 'Undefined', 'NaN'].includes(type$1)) {
|
|
823
676
|
if (type$1 in this.items) {
|
|
824
677
|
return false;
|
|
825
678
|
}
|
|
826
|
-
|
|
827
679
|
this.items[type$1] = true;
|
|
828
680
|
return true;
|
|
829
681
|
}
|
|
830
|
-
|
|
831
682
|
if (!['Object', 'Array'].includes(type$1)) {
|
|
832
683
|
const prevSize = this.set.size;
|
|
833
684
|
this.set.add(item);
|
|
834
685
|
return this.set.size !== prevSize;
|
|
835
686
|
}
|
|
836
|
-
|
|
837
687
|
if (!(type$1 in this.items)) {
|
|
838
688
|
this.items[type$1] = [item];
|
|
839
689
|
return true;
|
|
840
690
|
}
|
|
841
|
-
|
|
842
691
|
if (_indexOf(item, this.items[type$1]) === -1) {
|
|
843
692
|
this.items[type$1].push(item);
|
|
844
693
|
return true;
|
|
845
694
|
}
|
|
846
|
-
|
|
847
695
|
return false;
|
|
848
696
|
}
|
|
849
|
-
|
|
850
697
|
}
|
|
851
698
|
|
|
852
699
|
function uniq(list) {
|
|
@@ -869,11 +716,9 @@ function dissoc(prop, obj) {
|
|
|
869
716
|
if (arguments.length === 1) return _obj => dissoc(prop, _obj);
|
|
870
717
|
if (obj === null || obj === undefined) return {};
|
|
871
718
|
const willReturn = {};
|
|
872
|
-
|
|
873
719
|
for (const p in obj) {
|
|
874
720
|
willReturn[p] = obj[p];
|
|
875
721
|
}
|
|
876
|
-
|
|
877
722
|
delete willReturn[prop];
|
|
878
723
|
return willReturn;
|
|
879
724
|
}
|
|
@@ -892,7 +737,6 @@ function dropLast(howManyToDrop, listOrString) {
|
|
|
892
737
|
if (arguments.length === 1) {
|
|
893
738
|
return _listOrString => dropLast(howManyToDrop, _listOrString);
|
|
894
739
|
}
|
|
895
|
-
|
|
896
740
|
return howManyToDrop > 0 ? listOrString.slice(0, -howManyToDrop) : listOrString.slice();
|
|
897
741
|
}
|
|
898
742
|
|
|
@@ -900,25 +744,19 @@ function dropLastWhile(predicate, iterable) {
|
|
|
900
744
|
if (arguments.length === 1) {
|
|
901
745
|
return _iterable => dropLastWhile(predicate, _iterable);
|
|
902
746
|
}
|
|
903
|
-
|
|
904
747
|
if (iterable.length === 0) return iterable;
|
|
905
748
|
const isArray$1 = isArray(iterable);
|
|
906
|
-
|
|
907
749
|
if (typeof predicate !== 'function') {
|
|
908
750
|
throw new Error(`'predicate' is from wrong type ${typeof predicate}`);
|
|
909
751
|
}
|
|
910
|
-
|
|
911
752
|
if (!isArray$1 && typeof iterable !== 'string') {
|
|
912
753
|
throw new Error(`'iterable' is from wrong type ${typeof iterable}`);
|
|
913
754
|
}
|
|
914
|
-
|
|
915
755
|
let found = false;
|
|
916
756
|
const toReturn = [];
|
|
917
757
|
let counter = iterable.length;
|
|
918
|
-
|
|
919
758
|
while (counter > 0) {
|
|
920
759
|
counter--;
|
|
921
|
-
|
|
922
760
|
if (!found && predicate(iterable[counter]) === false) {
|
|
923
761
|
found = true;
|
|
924
762
|
toReturn.push(iterable[counter]);
|
|
@@ -926,7 +764,6 @@ function dropLastWhile(predicate, iterable) {
|
|
|
926
764
|
toReturn.push(iterable[counter]);
|
|
927
765
|
}
|
|
928
766
|
}
|
|
929
|
-
|
|
930
767
|
return isArray$1 ? toReturn.reverse() : toReturn.reverse().join('');
|
|
931
768
|
}
|
|
932
769
|
|
|
@@ -934,13 +771,11 @@ function dropRepeats(list) {
|
|
|
934
771
|
if (!isArray(list)) {
|
|
935
772
|
throw new Error(`${list} is not a list`);
|
|
936
773
|
}
|
|
937
|
-
|
|
938
774
|
const toReturn = [];
|
|
939
775
|
list.reduce((prev, current) => {
|
|
940
776
|
if (!equals(prev, current)) {
|
|
941
777
|
toReturn.push(current);
|
|
942
778
|
}
|
|
943
|
-
|
|
944
779
|
return current;
|
|
945
780
|
}, undefined);
|
|
946
781
|
return toReturn;
|
|
@@ -950,22 +785,18 @@ function dropRepeatsWith(predicate, list) {
|
|
|
950
785
|
if (arguments.length === 1) {
|
|
951
786
|
return _iterable => dropRepeatsWith(predicate, _iterable);
|
|
952
787
|
}
|
|
953
|
-
|
|
954
788
|
if (!isArray(list)) {
|
|
955
789
|
throw new Error(`${list} is not a list`);
|
|
956
790
|
}
|
|
957
|
-
|
|
958
791
|
const toReturn = [];
|
|
959
792
|
list.reduce((prev, current) => {
|
|
960
793
|
if (prev === undefined) {
|
|
961
794
|
toReturn.push(current);
|
|
962
795
|
return current;
|
|
963
796
|
}
|
|
964
|
-
|
|
965
797
|
if (!predicate(prev, current)) {
|
|
966
798
|
toReturn.push(current);
|
|
967
799
|
}
|
|
968
|
-
|
|
969
800
|
return current;
|
|
970
801
|
}, undefined);
|
|
971
802
|
return toReturn;
|
|
@@ -975,17 +806,13 @@ function dropWhile(predicate, iterable) {
|
|
|
975
806
|
if (arguments.length === 1) {
|
|
976
807
|
return _iterable => dropWhile(predicate, _iterable);
|
|
977
808
|
}
|
|
978
|
-
|
|
979
809
|
const isArray$1 = isArray(iterable);
|
|
980
|
-
|
|
981
810
|
if (!isArray$1 && typeof iterable !== 'string') {
|
|
982
811
|
throw new Error('`iterable` is neither list nor a string');
|
|
983
812
|
}
|
|
984
|
-
|
|
985
813
|
let flag = false;
|
|
986
814
|
const holder = [];
|
|
987
815
|
let counter = -1;
|
|
988
|
-
|
|
989
816
|
while (counter++ < iterable.length - 1) {
|
|
990
817
|
if (flag) {
|
|
991
818
|
holder.push(iterable[counter]);
|
|
@@ -994,7 +821,6 @@ function dropWhile(predicate, iterable) {
|
|
|
994
821
|
holder.push(iterable[counter]);
|
|
995
822
|
}
|
|
996
823
|
}
|
|
997
|
-
|
|
998
824
|
return isArray$1 ? holder : holder.join('');
|
|
999
825
|
}
|
|
1000
826
|
|
|
@@ -1002,17 +828,14 @@ function either(firstPredicate, secondPredicate) {
|
|
|
1002
828
|
if (arguments.length === 1) {
|
|
1003
829
|
return _secondPredicate => either(firstPredicate, _secondPredicate);
|
|
1004
830
|
}
|
|
1005
|
-
|
|
1006
831
|
return (...input) => Boolean(firstPredicate(...input) || secondPredicate(...input));
|
|
1007
832
|
}
|
|
1008
833
|
|
|
1009
834
|
function endsWith(target, iterable) {
|
|
1010
835
|
if (arguments.length === 1) return _iterable => endsWith(target, _iterable);
|
|
1011
|
-
|
|
1012
836
|
if (typeof iterable === 'string') {
|
|
1013
837
|
return iterable.endsWith(target);
|
|
1014
838
|
}
|
|
1015
|
-
|
|
1016
839
|
if (!isArray(target)) return false;
|
|
1017
840
|
const diff = iterable.length - target.length;
|
|
1018
841
|
let correct = true;
|
|
@@ -1034,7 +857,6 @@ function prop(propToFind, obj) {
|
|
|
1034
857
|
function eqPropsFn(property, objA, objB) {
|
|
1035
858
|
return equals(prop(property, objA), prop(property, objB));
|
|
1036
859
|
}
|
|
1037
|
-
|
|
1038
860
|
const eqProps = curry(eqPropsFn);
|
|
1039
861
|
|
|
1040
862
|
function evolveArray(rules, list) {
|
|
@@ -1042,7 +864,6 @@ function evolveArray(rules, list) {
|
|
|
1042
864
|
if (type(rules[i]) === 'Function') {
|
|
1043
865
|
return rules[i](x);
|
|
1044
866
|
}
|
|
1045
|
-
|
|
1046
867
|
return x;
|
|
1047
868
|
}, list, true);
|
|
1048
869
|
}
|
|
@@ -1050,22 +871,17 @@ function evolveObject(rules, iterable) {
|
|
|
1050
871
|
return mapObject((x, prop) => {
|
|
1051
872
|
if (type(x) === 'Object') {
|
|
1052
873
|
const typeRule = type(rules[prop]);
|
|
1053
|
-
|
|
1054
874
|
if (typeRule === 'Function') {
|
|
1055
875
|
return rules[prop](x);
|
|
1056
876
|
}
|
|
1057
|
-
|
|
1058
877
|
if (typeRule === 'Object') {
|
|
1059
878
|
return evolve(rules[prop], x);
|
|
1060
879
|
}
|
|
1061
|
-
|
|
1062
880
|
return x;
|
|
1063
881
|
}
|
|
1064
|
-
|
|
1065
882
|
if (type(rules[prop]) === 'Function') {
|
|
1066
883
|
return rules[prop](x);
|
|
1067
884
|
}
|
|
1068
|
-
|
|
1069
885
|
return x;
|
|
1070
886
|
}, iterable);
|
|
1071
887
|
}
|
|
@@ -1073,60 +889,51 @@ function evolve(rules, iterable) {
|
|
|
1073
889
|
if (arguments.length === 1) {
|
|
1074
890
|
return _iterable => evolve(rules, _iterable);
|
|
1075
891
|
}
|
|
1076
|
-
|
|
1077
892
|
const rulesType = type(rules);
|
|
1078
893
|
const iterableType = type(iterable);
|
|
1079
|
-
|
|
1080
894
|
if (iterableType !== rulesType) {
|
|
1081
895
|
throw new Error('iterableType !== rulesType');
|
|
1082
896
|
}
|
|
1083
|
-
|
|
1084
897
|
if (!['Object', 'Array'].includes(rulesType)) {
|
|
1085
898
|
throw new Error(`'iterable' and 'rules' are from wrong type ${rulesType}`);
|
|
1086
899
|
}
|
|
1087
|
-
|
|
1088
900
|
if (iterableType === 'Object') {
|
|
1089
901
|
return evolveObject(rules, iterable);
|
|
1090
902
|
}
|
|
1091
|
-
|
|
1092
903
|
return evolveArray(rules, iterable);
|
|
1093
904
|
}
|
|
1094
905
|
|
|
906
|
+
function F() {
|
|
907
|
+
return false;
|
|
908
|
+
}
|
|
909
|
+
|
|
1095
910
|
function filterObject(predicate, obj) {
|
|
1096
911
|
const willReturn = {};
|
|
1097
|
-
|
|
1098
912
|
for (const prop in obj) {
|
|
1099
913
|
if (predicate(obj[prop], prop, obj)) {
|
|
1100
914
|
willReturn[prop] = obj[prop];
|
|
1101
915
|
}
|
|
1102
916
|
}
|
|
1103
|
-
|
|
1104
917
|
return willReturn;
|
|
1105
918
|
}
|
|
1106
919
|
function filterArray(predicate, list, indexed = false) {
|
|
1107
920
|
let index = 0;
|
|
1108
921
|
const len = list.length;
|
|
1109
922
|
const willReturn = [];
|
|
1110
|
-
|
|
1111
923
|
while (index < len) {
|
|
1112
924
|
const predicateResult = indexed ? predicate(list[index], index) : predicate(list[index]);
|
|
1113
|
-
|
|
1114
925
|
if (predicateResult) {
|
|
1115
926
|
willReturn.push(list[index]);
|
|
1116
927
|
}
|
|
1117
|
-
|
|
1118
928
|
index++;
|
|
1119
929
|
}
|
|
1120
|
-
|
|
1121
930
|
return willReturn;
|
|
1122
931
|
}
|
|
1123
932
|
function filter(predicate, iterable) {
|
|
1124
933
|
if (arguments.length === 1) return _iterable => filter(predicate, _iterable);
|
|
1125
|
-
|
|
1126
934
|
if (!iterable) {
|
|
1127
935
|
throw new Error('Incorrect iterable input');
|
|
1128
936
|
}
|
|
1129
|
-
|
|
1130
937
|
if (isArray(iterable)) return filterArray(predicate, iterable, false);
|
|
1131
938
|
return filterObject(predicate, iterable);
|
|
1132
939
|
}
|
|
@@ -1135,14 +942,11 @@ function find(predicate, list) {
|
|
|
1135
942
|
if (arguments.length === 1) return _list => find(predicate, _list);
|
|
1136
943
|
let index = 0;
|
|
1137
944
|
const len = list.length;
|
|
1138
|
-
|
|
1139
945
|
while (index < len) {
|
|
1140
946
|
const x = list[index];
|
|
1141
|
-
|
|
1142
947
|
if (predicate(x)) {
|
|
1143
948
|
return x;
|
|
1144
949
|
}
|
|
1145
|
-
|
|
1146
950
|
index++;
|
|
1147
951
|
}
|
|
1148
952
|
}
|
|
@@ -1151,45 +955,38 @@ function findIndex(predicate, list) {
|
|
|
1151
955
|
if (arguments.length === 1) return _list => findIndex(predicate, _list);
|
|
1152
956
|
const len = list.length;
|
|
1153
957
|
let index = -1;
|
|
1154
|
-
|
|
1155
958
|
while (++index < len) {
|
|
1156
959
|
if (predicate(list[index])) {
|
|
1157
960
|
return index;
|
|
1158
961
|
}
|
|
1159
962
|
}
|
|
1160
|
-
|
|
1161
963
|
return -1;
|
|
1162
964
|
}
|
|
1163
965
|
|
|
1164
966
|
function findLast(predicate, list) {
|
|
1165
967
|
if (arguments.length === 1) return _list => findLast(predicate, _list);
|
|
1166
968
|
let index = list.length;
|
|
1167
|
-
|
|
1168
969
|
while (--index >= 0) {
|
|
1169
970
|
if (predicate(list[index])) {
|
|
1170
971
|
return list[index];
|
|
1171
972
|
}
|
|
1172
973
|
}
|
|
1173
|
-
|
|
1174
974
|
return undefined;
|
|
1175
975
|
}
|
|
1176
976
|
|
|
1177
977
|
function findLastIndex(fn, list) {
|
|
1178
978
|
if (arguments.length === 1) return _list => findLastIndex(fn, _list);
|
|
1179
979
|
let index = list.length;
|
|
1180
|
-
|
|
1181
980
|
while (--index >= 0) {
|
|
1182
981
|
if (fn(list[index])) {
|
|
1183
982
|
return index;
|
|
1184
983
|
}
|
|
1185
984
|
}
|
|
1186
|
-
|
|
1187
985
|
return -1;
|
|
1188
986
|
}
|
|
1189
987
|
|
|
1190
988
|
function flatten(list, input) {
|
|
1191
989
|
const willReturn = input === undefined ? [] : input;
|
|
1192
|
-
|
|
1193
990
|
for (let i = 0; i < list.length; i++) {
|
|
1194
991
|
if (isArray(list[i])) {
|
|
1195
992
|
flatten(list[i], willReturn);
|
|
@@ -1197,7 +994,6 @@ function flatten(list, input) {
|
|
|
1197
994
|
willReturn.push(list[i]);
|
|
1198
995
|
}
|
|
1199
996
|
}
|
|
1200
|
-
|
|
1201
997
|
return willReturn;
|
|
1202
998
|
}
|
|
1203
999
|
|
|
@@ -1212,26 +1008,21 @@ function flipFn(fn) {
|
|
|
1212
1008
|
} else if (input.length === 4) {
|
|
1213
1009
|
return fn(input[1], input[0], input[2], input[3]);
|
|
1214
1010
|
}
|
|
1215
|
-
|
|
1216
1011
|
throw new Error('R.flip doesn\'t work with arity > 4');
|
|
1217
1012
|
};
|
|
1218
1013
|
}
|
|
1219
|
-
|
|
1220
1014
|
function flip(fn) {
|
|
1221
1015
|
return flipFn(fn);
|
|
1222
1016
|
}
|
|
1223
1017
|
|
|
1224
1018
|
function forEach(fn, list) {
|
|
1225
1019
|
if (arguments.length === 1) return _list => forEach(fn, _list);
|
|
1226
|
-
|
|
1227
1020
|
if (list === undefined) {
|
|
1228
1021
|
return;
|
|
1229
1022
|
}
|
|
1230
|
-
|
|
1231
1023
|
if (isArray(list)) {
|
|
1232
1024
|
let index = 0;
|
|
1233
1025
|
const len = list.length;
|
|
1234
|
-
|
|
1235
1026
|
while (index < len) {
|
|
1236
1027
|
fn(list[index]);
|
|
1237
1028
|
index++;
|
|
@@ -1240,14 +1031,12 @@ function forEach(fn, list) {
|
|
|
1240
1031
|
let index = 0;
|
|
1241
1032
|
const listKeys = keys$1(list);
|
|
1242
1033
|
const len = listKeys.length;
|
|
1243
|
-
|
|
1244
1034
|
while (index < len) {
|
|
1245
1035
|
const key = listKeys[index];
|
|
1246
1036
|
fn(list[key], key, list);
|
|
1247
1037
|
index++;
|
|
1248
1038
|
}
|
|
1249
1039
|
}
|
|
1250
|
-
|
|
1251
1040
|
return list;
|
|
1252
1041
|
}
|
|
1253
1042
|
|
|
@@ -1260,18 +1049,14 @@ function fromPairs(listOfPairs) {
|
|
|
1260
1049
|
function groupBy(groupFn, list) {
|
|
1261
1050
|
if (arguments.length === 1) return _list => groupBy(groupFn, _list);
|
|
1262
1051
|
const result = {};
|
|
1263
|
-
|
|
1264
1052
|
for (let i = 0; i < list.length; i++) {
|
|
1265
1053
|
const item = list[i];
|
|
1266
1054
|
const key = groupFn(item);
|
|
1267
|
-
|
|
1268
1055
|
if (!result[key]) {
|
|
1269
1056
|
result[key] = [];
|
|
1270
1057
|
}
|
|
1271
|
-
|
|
1272
1058
|
result[key].push(item);
|
|
1273
1059
|
}
|
|
1274
|
-
|
|
1275
1060
|
return result;
|
|
1276
1061
|
}
|
|
1277
1062
|
|
|
@@ -1286,20 +1071,17 @@ function groupWith(compareFn, list) {
|
|
|
1286
1071
|
const okCompare = compareFn(prev, current);
|
|
1287
1072
|
const holderIsEmpty = holder.length === 0;
|
|
1288
1073
|
const lastCall = i === list.length - 1;
|
|
1289
|
-
|
|
1290
1074
|
if (okCompare) {
|
|
1291
1075
|
if (holderIsEmpty) holder.push(prev);
|
|
1292
1076
|
holder.push(current);
|
|
1293
1077
|
if (lastCall) toReturn.push(holder);
|
|
1294
1078
|
return current;
|
|
1295
1079
|
}
|
|
1296
|
-
|
|
1297
1080
|
if (holderIsEmpty) {
|
|
1298
1081
|
toReturn.push([prev]);
|
|
1299
1082
|
if (lastCall) toReturn.push([current]);
|
|
1300
1083
|
return current;
|
|
1301
1084
|
}
|
|
1302
|
-
|
|
1303
1085
|
toReturn.push(holder);
|
|
1304
1086
|
if (lastCall) toReturn.push([current]);
|
|
1305
1087
|
holder = [];
|
|
@@ -1320,25 +1102,20 @@ function createPath(path, delimiter = '.') {
|
|
|
1320
1102
|
|
|
1321
1103
|
function path(pathInput, obj) {
|
|
1322
1104
|
if (arguments.length === 1) return _obj => path(pathInput, _obj);
|
|
1323
|
-
|
|
1324
1105
|
if (obj === null || obj === undefined) {
|
|
1325
1106
|
return undefined;
|
|
1326
1107
|
}
|
|
1327
|
-
|
|
1328
1108
|
let willReturn = obj;
|
|
1329
1109
|
let counter = 0;
|
|
1330
1110
|
const pathArrValue = createPath(pathInput);
|
|
1331
|
-
|
|
1332
1111
|
while (counter < pathArrValue.length) {
|
|
1333
1112
|
if (willReturn === null || willReturn === undefined) {
|
|
1334
1113
|
return undefined;
|
|
1335
1114
|
}
|
|
1336
|
-
|
|
1337
1115
|
if (willReturn[pathArrValue[counter]] === null) return undefined;
|
|
1338
1116
|
willReturn = willReturn[pathArrValue[counter]];
|
|
1339
1117
|
counter++;
|
|
1340
1118
|
}
|
|
1341
|
-
|
|
1342
1119
|
return willReturn;
|
|
1343
1120
|
}
|
|
1344
1121
|
|
|
@@ -1346,7 +1123,6 @@ function hasPath(pathInput, obj) {
|
|
|
1346
1123
|
if (arguments.length === 1) {
|
|
1347
1124
|
return objHolder => hasPath(pathInput, objHolder);
|
|
1348
1125
|
}
|
|
1349
|
-
|
|
1350
1126
|
return path(pathInput, obj) !== undefined;
|
|
1351
1127
|
}
|
|
1352
1128
|
|
|
@@ -1359,10 +1135,8 @@ function _objectIs(a, b) {
|
|
|
1359
1135
|
if (a === b) {
|
|
1360
1136
|
return a !== 0 || 1 / a === 1 / b;
|
|
1361
1137
|
}
|
|
1362
|
-
|
|
1363
1138
|
return a !== a && b !== b;
|
|
1364
1139
|
}
|
|
1365
|
-
|
|
1366
1140
|
const objectIs = Object.is || _objectIs;
|
|
1367
1141
|
|
|
1368
1142
|
function identical(a, b) {
|
|
@@ -1377,46 +1151,36 @@ function identity(x) {
|
|
|
1377
1151
|
function ifElseFn(condition, onTrue, onFalse) {
|
|
1378
1152
|
return (...input) => {
|
|
1379
1153
|
const conditionResult = typeof condition === 'boolean' ? condition : condition(...input);
|
|
1380
|
-
|
|
1381
1154
|
if (conditionResult === true) {
|
|
1382
1155
|
return onTrue(...input);
|
|
1383
1156
|
}
|
|
1384
|
-
|
|
1385
1157
|
return onFalse(...input);
|
|
1386
1158
|
};
|
|
1387
1159
|
}
|
|
1388
|
-
|
|
1389
1160
|
const ifElse = curry(ifElseFn);
|
|
1390
1161
|
|
|
1391
1162
|
const inc = x => x + 1;
|
|
1392
1163
|
|
|
1393
1164
|
function indexByPath(pathInput, list) {
|
|
1394
1165
|
const toReturn = {};
|
|
1395
|
-
|
|
1396
1166
|
for (let i = 0; i < list.length; i++) {
|
|
1397
1167
|
const item = list[i];
|
|
1398
1168
|
toReturn[path(pathInput, item)] = item;
|
|
1399
1169
|
}
|
|
1400
|
-
|
|
1401
1170
|
return toReturn;
|
|
1402
1171
|
}
|
|
1403
|
-
|
|
1404
1172
|
function indexBy(condition, list) {
|
|
1405
1173
|
if (arguments.length === 1) {
|
|
1406
1174
|
return _list => indexBy(condition, _list);
|
|
1407
1175
|
}
|
|
1408
|
-
|
|
1409
1176
|
if (typeof condition === 'string') {
|
|
1410
1177
|
return indexByPath(condition, list);
|
|
1411
1178
|
}
|
|
1412
|
-
|
|
1413
1179
|
const toReturn = {};
|
|
1414
|
-
|
|
1415
1180
|
for (let i = 0; i < list.length; i++) {
|
|
1416
1181
|
const item = list[i];
|
|
1417
1182
|
toReturn[condition(item)] = item;
|
|
1418
1183
|
}
|
|
1419
|
-
|
|
1420
1184
|
return toReturn;
|
|
1421
1185
|
}
|
|
1422
1186
|
|
|
@@ -1424,7 +1188,6 @@ function indexOf(valueToFind, list) {
|
|
|
1424
1188
|
if (arguments.length === 1) {
|
|
1425
1189
|
return _list => _indexOf(valueToFind, _list);
|
|
1426
1190
|
}
|
|
1427
|
-
|
|
1428
1191
|
return _indexOf(valueToFind, list);
|
|
1429
1192
|
}
|
|
1430
1193
|
|
|
@@ -1434,19 +1197,15 @@ function baseSlice(array, start, end) {
|
|
|
1434
1197
|
length
|
|
1435
1198
|
} = array;
|
|
1436
1199
|
end = end > length ? length : end;
|
|
1437
|
-
|
|
1438
1200
|
if (end < 0) {
|
|
1439
1201
|
end += length;
|
|
1440
1202
|
}
|
|
1441
|
-
|
|
1442
1203
|
length = start > end ? 0 : end - start >>> 0;
|
|
1443
1204
|
start >>>= 0;
|
|
1444
1205
|
const result = Array(length);
|
|
1445
|
-
|
|
1446
1206
|
while (++index < length) {
|
|
1447
1207
|
result[index] = array[index + start];
|
|
1448
1208
|
}
|
|
1449
|
-
|
|
1450
1209
|
return result;
|
|
1451
1210
|
}
|
|
1452
1211
|
|
|
@@ -1465,7 +1224,6 @@ function intersperse(separator, list) {
|
|
|
1465
1224
|
let index = -1;
|
|
1466
1225
|
const len = list.length;
|
|
1467
1226
|
const willReturn = [];
|
|
1468
|
-
|
|
1469
1227
|
while (++index < len) {
|
|
1470
1228
|
if (index === len - 1) {
|
|
1471
1229
|
willReturn.push(list[index]);
|
|
@@ -1473,7 +1231,6 @@ function intersperse(separator, list) {
|
|
|
1473
1231
|
willReturn.push(list[index], separator);
|
|
1474
1232
|
}
|
|
1475
1233
|
}
|
|
1476
|
-
|
|
1477
1234
|
return willReturn;
|
|
1478
1235
|
}
|
|
1479
1236
|
|
|
@@ -1486,15 +1243,12 @@ function isEmpty(input) {
|
|
|
1486
1243
|
const inputType = type(input);
|
|
1487
1244
|
if (['Undefined', 'NaN', 'Number', 'Null'].includes(inputType)) return false;
|
|
1488
1245
|
if (!input) return true;
|
|
1489
|
-
|
|
1490
1246
|
if (inputType === 'Object') {
|
|
1491
1247
|
return Object.keys(input).length === 0;
|
|
1492
1248
|
}
|
|
1493
|
-
|
|
1494
1249
|
if (inputType === 'Array') {
|
|
1495
1250
|
return input.length === 0;
|
|
1496
1251
|
}
|
|
1497
|
-
|
|
1498
1252
|
return false;
|
|
1499
1253
|
}
|
|
1500
1254
|
|
|
@@ -1519,7 +1273,6 @@ function last(listOrString) {
|
|
|
1519
1273
|
if (typeof listOrString === 'string') {
|
|
1520
1274
|
return listOrString[listOrString.length - 1] || '';
|
|
1521
1275
|
}
|
|
1522
|
-
|
|
1523
1276
|
return listOrString[listOrString.length - 1];
|
|
1524
1277
|
}
|
|
1525
1278
|
|
|
@@ -1527,7 +1280,6 @@ function lastIndexOf(valueToFind, list) {
|
|
|
1527
1280
|
if (arguments.length === 1) {
|
|
1528
1281
|
return _list => _lastIndexOf(valueToFind, _list);
|
|
1529
1282
|
}
|
|
1530
|
-
|
|
1531
1283
|
return _lastIndexOf(valueToFind, list);
|
|
1532
1284
|
}
|
|
1533
1285
|
|
|
@@ -1623,7 +1375,6 @@ function mergeDeepRight(target, source) {
|
|
|
1623
1375
|
if (arguments.length === 1) {
|
|
1624
1376
|
return sourceHolder => mergeDeepRight(target, sourceHolder);
|
|
1625
1377
|
}
|
|
1626
|
-
|
|
1627
1378
|
const willReturn = clone(target);
|
|
1628
1379
|
Object.keys(source).forEach(key => {
|
|
1629
1380
|
if (type(source[key]) === 'Object') {
|
|
@@ -1655,7 +1406,6 @@ function mergeWithFn(mergeFn, a, b) {
|
|
|
1655
1406
|
});
|
|
1656
1407
|
Object.keys(b).forEach(key => {
|
|
1657
1408
|
if (willReturn[key] !== undefined) return;
|
|
1658
|
-
|
|
1659
1409
|
if (a[key] === undefined) {
|
|
1660
1410
|
willReturn[key] = b[key];
|
|
1661
1411
|
} else {
|
|
@@ -1664,7 +1414,6 @@ function mergeWithFn(mergeFn, a, b) {
|
|
|
1664
1414
|
});
|
|
1665
1415
|
return willReturn;
|
|
1666
1416
|
}
|
|
1667
|
-
|
|
1668
1417
|
const mergeWith = curry(mergeWithFn);
|
|
1669
1418
|
|
|
1670
1419
|
function min(x, y) {
|
|
@@ -1679,17 +1428,14 @@ const minBy = curry(minByFn);
|
|
|
1679
1428
|
|
|
1680
1429
|
function ownKeys(object, enumerableOnly) {
|
|
1681
1430
|
var keys = Object.keys(object);
|
|
1682
|
-
|
|
1683
1431
|
if (Object.getOwnPropertySymbols) {
|
|
1684
1432
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
1685
1433
|
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
1686
1434
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
1687
1435
|
})), keys.push.apply(keys, symbols);
|
|
1688
1436
|
}
|
|
1689
|
-
|
|
1690
1437
|
return keys;
|
|
1691
1438
|
}
|
|
1692
|
-
|
|
1693
1439
|
function _objectSpread2(target) {
|
|
1694
1440
|
for (var i = 1; i < arguments.length; i++) {
|
|
1695
1441
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
@@ -1699,10 +1445,8 @@ function _objectSpread2(target) {
|
|
|
1699
1445
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1700
1446
|
});
|
|
1701
1447
|
}
|
|
1702
|
-
|
|
1703
1448
|
return target;
|
|
1704
1449
|
}
|
|
1705
|
-
|
|
1706
1450
|
function _defineProperty(obj, key, value) {
|
|
1707
1451
|
if (key in obj) {
|
|
1708
1452
|
Object.defineProperty(obj, key, {
|
|
@@ -1714,7 +1458,6 @@ function _defineProperty(obj, key, value) {
|
|
|
1714
1458
|
} else {
|
|
1715
1459
|
obj[key] = value;
|
|
1716
1460
|
}
|
|
1717
|
-
|
|
1718
1461
|
return obj;
|
|
1719
1462
|
}
|
|
1720
1463
|
|
|
@@ -1725,34 +1468,27 @@ function isIterable(input) {
|
|
|
1725
1468
|
function modifyFn(property, fn, iterable) {
|
|
1726
1469
|
if (!isIterable(iterable)) return iterable;
|
|
1727
1470
|
if (iterable[property] === undefined) return iterable;
|
|
1728
|
-
|
|
1729
1471
|
if (isArray(iterable)) {
|
|
1730
1472
|
return updateFn(property, fn(iterable[property]), iterable);
|
|
1731
1473
|
}
|
|
1732
|
-
|
|
1733
1474
|
return _objectSpread2(_objectSpread2({}, iterable), {}, {
|
|
1734
1475
|
[property]: fn(iterable[property])
|
|
1735
1476
|
});
|
|
1736
1477
|
}
|
|
1737
|
-
|
|
1738
1478
|
const modify = curry(modifyFn);
|
|
1739
1479
|
|
|
1740
1480
|
function modifyPathFn(pathInput, fn, object) {
|
|
1741
1481
|
const path$1 = createPath(pathInput);
|
|
1742
|
-
|
|
1743
1482
|
if (path$1.length === 1) {
|
|
1744
1483
|
return _objectSpread2(_objectSpread2({}, object), {}, {
|
|
1745
1484
|
[path$1[0]]: fn(object[path$1[0]])
|
|
1746
1485
|
});
|
|
1747
1486
|
}
|
|
1748
|
-
|
|
1749
1487
|
if (path(path$1, object) === undefined) return object;
|
|
1750
1488
|
const val = modifyPath(Array.prototype.slice.call(path$1, 1), fn, object[path$1[0]]);
|
|
1751
|
-
|
|
1752
1489
|
if (val === object[path$1[0]]) {
|
|
1753
1490
|
return object;
|
|
1754
1491
|
}
|
|
1755
|
-
|
|
1756
1492
|
return assoc(path$1[0], val, object);
|
|
1757
1493
|
}
|
|
1758
1494
|
const modifyPath = curry(modifyPathFn);
|
|
@@ -1766,14 +1502,12 @@ function moveFn(fromIndex, toIndex, list) {
|
|
|
1766
1502
|
if (fromIndex < 0 || toIndex < 0) {
|
|
1767
1503
|
throw new Error('Rambda.move does not support negative indexes');
|
|
1768
1504
|
}
|
|
1769
|
-
|
|
1770
1505
|
if (fromIndex > list.length - 1 || toIndex > list.length - 1) return list;
|
|
1771
1506
|
const clone = cloneList(list);
|
|
1772
1507
|
clone[fromIndex] = list[toIndex];
|
|
1773
1508
|
clone[toIndex] = list[fromIndex];
|
|
1774
1509
|
return clone;
|
|
1775
1510
|
}
|
|
1776
|
-
|
|
1777
1511
|
const move = curry(moveFn);
|
|
1778
1512
|
|
|
1779
1513
|
function multiply(x, y) {
|
|
@@ -1787,11 +1521,9 @@ function negate(x) {
|
|
|
1787
1521
|
|
|
1788
1522
|
function none(predicate, list) {
|
|
1789
1523
|
if (arguments.length === 1) return _list => none(predicate, _list);
|
|
1790
|
-
|
|
1791
1524
|
for (let i = 0; i < list.length; i++) {
|
|
1792
1525
|
if (predicate(list[i])) return false;
|
|
1793
1526
|
}
|
|
1794
|
-
|
|
1795
1527
|
return true;
|
|
1796
1528
|
}
|
|
1797
1529
|
|
|
@@ -1803,7 +1535,6 @@ function objOf(key, value) {
|
|
|
1803
1535
|
if (arguments.length === 1) {
|
|
1804
1536
|
return _value => objOf(key, _value);
|
|
1805
1537
|
}
|
|
1806
|
-
|
|
1807
1538
|
return {
|
|
1808
1539
|
[key]: value
|
|
1809
1540
|
};
|
|
@@ -1815,20 +1546,16 @@ function of(value) {
|
|
|
1815
1546
|
|
|
1816
1547
|
function omit(propsToOmit, obj) {
|
|
1817
1548
|
if (arguments.length === 1) return _obj => omit(propsToOmit, _obj);
|
|
1818
|
-
|
|
1819
1549
|
if (obj === null || obj === undefined) {
|
|
1820
1550
|
return undefined;
|
|
1821
1551
|
}
|
|
1822
|
-
|
|
1823
1552
|
const propsToOmitValue = createPath(propsToOmit, ',');
|
|
1824
1553
|
const willReturn = {};
|
|
1825
|
-
|
|
1826
1554
|
for (const key in obj) {
|
|
1827
1555
|
if (!propsToOmitValue.includes(key)) {
|
|
1828
1556
|
willReturn[key] = obj[key];
|
|
1829
1557
|
}
|
|
1830
1558
|
}
|
|
1831
|
-
|
|
1832
1559
|
return willReturn;
|
|
1833
1560
|
}
|
|
1834
1561
|
|
|
@@ -1836,11 +1563,9 @@ function on(binaryFn, unaryFn, a, b) {
|
|
|
1836
1563
|
if (arguments.length === 3) {
|
|
1837
1564
|
return _b => on(binaryFn, unaryFn, a, _b);
|
|
1838
1565
|
}
|
|
1839
|
-
|
|
1840
1566
|
if (arguments.length === 2) {
|
|
1841
1567
|
return (_a, _b) => on(binaryFn, unaryFn, _a, _b);
|
|
1842
1568
|
}
|
|
1843
|
-
|
|
1844
1569
|
return binaryFn(unaryFn(a), unaryFn(b));
|
|
1845
1570
|
}
|
|
1846
1571
|
|
|
@@ -1851,17 +1576,14 @@ function onceFn(fn, context) {
|
|
|
1851
1576
|
result = fn.apply(context || this, arguments);
|
|
1852
1577
|
fn = null;
|
|
1853
1578
|
}
|
|
1854
|
-
|
|
1855
1579
|
return result;
|
|
1856
1580
|
};
|
|
1857
1581
|
}
|
|
1858
|
-
|
|
1859
1582
|
function once(fn, context) {
|
|
1860
1583
|
if (arguments.length === 1) {
|
|
1861
1584
|
const wrap = onceFn(fn, context);
|
|
1862
1585
|
return curry(wrap);
|
|
1863
1586
|
}
|
|
1864
|
-
|
|
1865
1587
|
return onceFn(fn, context);
|
|
1866
1588
|
}
|
|
1867
1589
|
|
|
@@ -1874,11 +1596,9 @@ const Identity = x => ({
|
|
|
1874
1596
|
x,
|
|
1875
1597
|
map: fn => Identity(fn(x))
|
|
1876
1598
|
});
|
|
1877
|
-
|
|
1878
1599
|
function overFn(lens, fn, object) {
|
|
1879
1600
|
return lens(x => Identity(fn(x)))(object).x;
|
|
1880
1601
|
}
|
|
1881
|
-
|
|
1882
1602
|
const over = curry(overFn);
|
|
1883
1603
|
|
|
1884
1604
|
function partial(fn, ...args) {
|
|
@@ -1887,7 +1607,6 @@ function partial(fn, ...args) {
|
|
|
1887
1607
|
if (args.length + rest.length >= len) {
|
|
1888
1608
|
return fn(...args, ...rest);
|
|
1889
1609
|
}
|
|
1890
|
-
|
|
1891
1610
|
return partial(fn, ...[...args, ...rest]);
|
|
1892
1611
|
};
|
|
1893
1612
|
}
|
|
@@ -1912,7 +1631,6 @@ function partitionArray(predicate, list, indexed = false) {
|
|
|
1912
1631
|
const yes = [];
|
|
1913
1632
|
const no = [];
|
|
1914
1633
|
let counter = -1;
|
|
1915
|
-
|
|
1916
1634
|
while (counter++ < list.length - 1) {
|
|
1917
1635
|
if (indexed ? predicate(list[counter], counter) : predicate(list[counter])) {
|
|
1918
1636
|
yes.push(list[counter]);
|
|
@@ -1920,14 +1638,12 @@ function partitionArray(predicate, list, indexed = false) {
|
|
|
1920
1638
|
no.push(list[counter]);
|
|
1921
1639
|
}
|
|
1922
1640
|
}
|
|
1923
|
-
|
|
1924
1641
|
return [yes, no];
|
|
1925
1642
|
}
|
|
1926
1643
|
function partition(predicate, iterable) {
|
|
1927
1644
|
if (arguments.length === 1) {
|
|
1928
1645
|
return listHolder => partition(predicate, listHolder);
|
|
1929
1646
|
}
|
|
1930
|
-
|
|
1931
1647
|
if (!isArray(iterable)) return partitionObject(predicate, iterable);
|
|
1932
1648
|
return partitionArray(predicate, iterable);
|
|
1933
1649
|
}
|
|
@@ -1935,66 +1651,53 @@ function partition(predicate, iterable) {
|
|
|
1935
1651
|
function pathEqFn(pathToSearch, target, input) {
|
|
1936
1652
|
return equals(path(pathToSearch, input), target);
|
|
1937
1653
|
}
|
|
1938
|
-
|
|
1939
1654
|
const pathEq = curry(pathEqFn);
|
|
1940
1655
|
|
|
1941
1656
|
function pathOrFn(defaultValue, pathInput, obj) {
|
|
1942
1657
|
return defaultTo(defaultValue, path(pathInput, obj));
|
|
1943
1658
|
}
|
|
1944
|
-
|
|
1945
1659
|
const pathOr = curry(pathOrFn);
|
|
1946
1660
|
|
|
1947
1661
|
function paths(pathsToSearch, obj) {
|
|
1948
1662
|
if (arguments.length === 1) {
|
|
1949
1663
|
return _obj => paths(pathsToSearch, _obj);
|
|
1950
1664
|
}
|
|
1951
|
-
|
|
1952
1665
|
return pathsToSearch.map(singlePath => path(singlePath, obj));
|
|
1953
1666
|
}
|
|
1954
1667
|
|
|
1955
1668
|
function pick(propsToPick, input) {
|
|
1956
1669
|
if (arguments.length === 1) return _input => pick(propsToPick, _input);
|
|
1957
|
-
|
|
1958
1670
|
if (input === null || input === undefined) {
|
|
1959
1671
|
return undefined;
|
|
1960
1672
|
}
|
|
1961
|
-
|
|
1962
1673
|
const keys = createPath(propsToPick, ',');
|
|
1963
1674
|
const willReturn = {};
|
|
1964
1675
|
let counter = 0;
|
|
1965
|
-
|
|
1966
1676
|
while (counter < keys.length) {
|
|
1967
1677
|
if (keys[counter] in input) {
|
|
1968
1678
|
willReturn[keys[counter]] = input[keys[counter]];
|
|
1969
1679
|
}
|
|
1970
|
-
|
|
1971
1680
|
counter++;
|
|
1972
1681
|
}
|
|
1973
|
-
|
|
1974
1682
|
return willReturn;
|
|
1975
1683
|
}
|
|
1976
1684
|
|
|
1977
1685
|
function pickAll(propsToPick, obj) {
|
|
1978
1686
|
if (arguments.length === 1) return _obj => pickAll(propsToPick, _obj);
|
|
1979
|
-
|
|
1980
1687
|
if (obj === null || obj === undefined) {
|
|
1981
1688
|
return undefined;
|
|
1982
1689
|
}
|
|
1983
|
-
|
|
1984
1690
|
const keysValue = createPath(propsToPick, ',');
|
|
1985
1691
|
const willReturn = {};
|
|
1986
1692
|
let counter = 0;
|
|
1987
|
-
|
|
1988
1693
|
while (counter < keysValue.length) {
|
|
1989
1694
|
if (keysValue[counter] in obj) {
|
|
1990
1695
|
willReturn[keysValue[counter]] = obj[keysValue[counter]];
|
|
1991
1696
|
} else {
|
|
1992
1697
|
willReturn[keysValue[counter]] = undefined;
|
|
1993
1698
|
}
|
|
1994
|
-
|
|
1995
1699
|
counter++;
|
|
1996
1700
|
}
|
|
1997
|
-
|
|
1998
1701
|
return willReturn;
|
|
1999
1702
|
}
|
|
2000
1703
|
|
|
@@ -2021,55 +1724,45 @@ function propEqFn(propToFind, valueToMatch, obj) {
|
|
|
2021
1724
|
if (!obj) return false;
|
|
2022
1725
|
return equals(valueToMatch, prop(propToFind, obj));
|
|
2023
1726
|
}
|
|
2024
|
-
|
|
2025
1727
|
const propEq = curry(propEqFn);
|
|
2026
1728
|
|
|
2027
1729
|
function propIsFn(targetPrototype, property, obj) {
|
|
2028
1730
|
return is(targetPrototype, obj[property]);
|
|
2029
1731
|
}
|
|
2030
|
-
|
|
2031
1732
|
const propIs = curry(propIsFn);
|
|
2032
1733
|
|
|
2033
1734
|
function propOrFn(defaultValue, property, obj) {
|
|
2034
1735
|
if (!obj) return defaultValue;
|
|
2035
1736
|
return defaultTo(defaultValue, obj[property]);
|
|
2036
1737
|
}
|
|
2037
|
-
|
|
2038
1738
|
const propOr = curry(propOrFn);
|
|
2039
1739
|
|
|
2040
|
-
function propSatisfiesFn(predicate, property, obj) {
|
|
2041
|
-
return predicate(prop(property, obj));
|
|
2042
|
-
}
|
|
2043
|
-
|
|
2044
|
-
const propSatisfies = curry(propSatisfiesFn);
|
|
2045
|
-
|
|
2046
1740
|
function props(propsToPick, obj) {
|
|
2047
1741
|
if (arguments.length === 1) {
|
|
2048
1742
|
return _obj => props(propsToPick, _obj);
|
|
2049
1743
|
}
|
|
2050
|
-
|
|
2051
1744
|
if (!isArray(propsToPick)) {
|
|
2052
1745
|
throw new Error('propsToPick is not a list');
|
|
2053
1746
|
}
|
|
2054
|
-
|
|
2055
1747
|
return mapArray(prop => obj[prop], propsToPick);
|
|
2056
1748
|
}
|
|
2057
1749
|
|
|
1750
|
+
function propSatisfiesFn(predicate, property, obj) {
|
|
1751
|
+
return predicate(prop(property, obj));
|
|
1752
|
+
}
|
|
1753
|
+
const propSatisfies = curry(propSatisfiesFn);
|
|
1754
|
+
|
|
2058
1755
|
function range(start, end) {
|
|
2059
1756
|
if (arguments.length === 1) return _end => range(start, _end);
|
|
2060
|
-
|
|
2061
1757
|
if (Number.isNaN(Number(start)) || Number.isNaN(Number(end))) {
|
|
2062
1758
|
throw new TypeError('Both arguments to range must be numbers');
|
|
2063
1759
|
}
|
|
2064
|
-
|
|
2065
1760
|
if (end < start) return [];
|
|
2066
1761
|
const len = end - start;
|
|
2067
1762
|
const willReturn = Array(len);
|
|
2068
|
-
|
|
2069
1763
|
for (let i = 0; i < len; i++) {
|
|
2070
1764
|
willReturn[i] = start + i;
|
|
2071
1765
|
}
|
|
2072
|
-
|
|
2073
1766
|
return willReturn;
|
|
2074
1767
|
}
|
|
2075
1768
|
|
|
@@ -2082,21 +1775,18 @@ function repeat(x, timesToRepeat) {
|
|
|
2082
1775
|
if (arguments.length === 1) {
|
|
2083
1776
|
return _timesToRepeat => repeat(x, _timesToRepeat);
|
|
2084
1777
|
}
|
|
2085
|
-
|
|
2086
1778
|
return Array(timesToRepeat).fill(x);
|
|
2087
1779
|
}
|
|
2088
1780
|
|
|
2089
1781
|
function replaceFn(pattern, replacer, str) {
|
|
2090
1782
|
return str.replace(pattern, replacer);
|
|
2091
1783
|
}
|
|
2092
|
-
|
|
2093
1784
|
const replace = curry(replaceFn);
|
|
2094
1785
|
|
|
2095
1786
|
function reverse(listOrString) {
|
|
2096
1787
|
if (typeof listOrString === 'string') {
|
|
2097
1788
|
return listOrString.split('').reverse().join('');
|
|
2098
1789
|
}
|
|
2099
|
-
|
|
2100
1790
|
const clone = listOrString.slice();
|
|
2101
1791
|
return clone.reverse();
|
|
2102
1792
|
}
|
|
@@ -2104,13 +1794,11 @@ function reverse(listOrString) {
|
|
|
2104
1794
|
function setFn(lens, replacer, x) {
|
|
2105
1795
|
return over(lens, always(replacer), x);
|
|
2106
1796
|
}
|
|
2107
|
-
|
|
2108
1797
|
const set = curry(setFn);
|
|
2109
1798
|
|
|
2110
1799
|
function sliceFn(from, to, list) {
|
|
2111
1800
|
return list.slice(from, to);
|
|
2112
1801
|
}
|
|
2113
|
-
|
|
2114
1802
|
const slice = curry(sliceFn);
|
|
2115
1803
|
|
|
2116
1804
|
function sort(sortFn, list) {
|
|
@@ -2151,7 +1839,6 @@ function splitAt(index, input) {
|
|
|
2151
1839
|
if (arguments.length === 1) {
|
|
2152
1840
|
return _list => splitAt(index, _list);
|
|
2153
1841
|
}
|
|
2154
|
-
|
|
2155
1842
|
if (!input) throw new TypeError(`Cannot read property 'slice' of ${input}`);
|
|
2156
1843
|
if (!isArray(input) && typeof input !== 'string') return [[], []];
|
|
2157
1844
|
const correctIndex = maybe(index < 0, input.length + index < 0 ? 0 : input.length + index, index);
|
|
@@ -2162,18 +1849,14 @@ function splitEvery(sliceLength, listOrString) {
|
|
|
2162
1849
|
if (arguments.length === 1) {
|
|
2163
1850
|
return _listOrString => splitEvery(sliceLength, _listOrString);
|
|
2164
1851
|
}
|
|
2165
|
-
|
|
2166
1852
|
if (sliceLength < 1) {
|
|
2167
1853
|
throw new Error('First argument to splitEvery must be a positive integer');
|
|
2168
1854
|
}
|
|
2169
|
-
|
|
2170
1855
|
const willReturn = [];
|
|
2171
1856
|
let counter = 0;
|
|
2172
|
-
|
|
2173
1857
|
while (counter < listOrString.length) {
|
|
2174
1858
|
willReturn.push(listOrString.slice(counter, counter += sliceLength));
|
|
2175
1859
|
}
|
|
2176
|
-
|
|
2177
1860
|
return willReturn;
|
|
2178
1861
|
}
|
|
2179
1862
|
|
|
@@ -2181,13 +1864,11 @@ function splitWhen(predicate, input) {
|
|
|
2181
1864
|
if (arguments.length === 1) {
|
|
2182
1865
|
return _input => splitWhen(predicate, _input);
|
|
2183
1866
|
}
|
|
2184
|
-
|
|
2185
1867
|
if (!input) throw new TypeError(`Cannot read property 'length' of ${input}`);
|
|
2186
1868
|
const preFound = [];
|
|
2187
1869
|
const postFound = [];
|
|
2188
1870
|
let found = false;
|
|
2189
1871
|
let counter = -1;
|
|
2190
|
-
|
|
2191
1872
|
while (counter++ < input.length - 1) {
|
|
2192
1873
|
if (found) {
|
|
2193
1874
|
postFound.push(input[counter]);
|
|
@@ -2198,17 +1879,14 @@ function splitWhen(predicate, input) {
|
|
|
2198
1879
|
preFound.push(input[counter]);
|
|
2199
1880
|
}
|
|
2200
1881
|
}
|
|
2201
|
-
|
|
2202
1882
|
return [preFound, postFound];
|
|
2203
1883
|
}
|
|
2204
1884
|
|
|
2205
1885
|
function startsWith(target, iterable) {
|
|
2206
1886
|
if (arguments.length === 1) return _iterable => startsWith(target, _iterable);
|
|
2207
|
-
|
|
2208
1887
|
if (typeof iterable === 'string') {
|
|
2209
1888
|
return iterable.startsWith(target);
|
|
2210
1889
|
}
|
|
2211
|
-
|
|
2212
1890
|
if (!isArray(target)) return false;
|
|
2213
1891
|
let correct = true;
|
|
2214
1892
|
const filtered = target.filter((x, index) => {
|
|
@@ -2229,10 +1907,13 @@ function symmetricDifference(x, y) {
|
|
|
2229
1907
|
if (arguments.length === 1) {
|
|
2230
1908
|
return _y => symmetricDifference(x, _y);
|
|
2231
1909
|
}
|
|
2232
|
-
|
|
2233
1910
|
return concat(filter(value => !includes(value, y), x), filter(value => !includes(value, x), y));
|
|
2234
1911
|
}
|
|
2235
1912
|
|
|
1913
|
+
function T() {
|
|
1914
|
+
return true;
|
|
1915
|
+
}
|
|
1916
|
+
|
|
2236
1917
|
function tail(listOrString) {
|
|
2237
1918
|
return drop(1, listOrString);
|
|
2238
1919
|
}
|
|
@@ -2251,22 +1932,18 @@ function takeLastWhile(predicate, input) {
|
|
|
2251
1932
|
if (arguments.length === 1) {
|
|
2252
1933
|
return _input => takeLastWhile(predicate, _input);
|
|
2253
1934
|
}
|
|
2254
|
-
|
|
2255
1935
|
if (input.length === 0) return input;
|
|
2256
1936
|
let found = false;
|
|
2257
1937
|
const toReturn = [];
|
|
2258
1938
|
let counter = input.length;
|
|
2259
|
-
|
|
2260
1939
|
while (!found || counter === 0) {
|
|
2261
1940
|
counter--;
|
|
2262
|
-
|
|
2263
1941
|
if (predicate(input[counter]) === false) {
|
|
2264
1942
|
found = true;
|
|
2265
1943
|
} else if (!found) {
|
|
2266
1944
|
toReturn.push(input[counter]);
|
|
2267
1945
|
}
|
|
2268
1946
|
}
|
|
2269
|
-
|
|
2270
1947
|
return isArray(input) ? toReturn.reverse() : toReturn.reverse().join('');
|
|
2271
1948
|
}
|
|
2272
1949
|
|
|
@@ -2274,17 +1951,13 @@ function takeWhile(predicate, iterable) {
|
|
|
2274
1951
|
if (arguments.length === 1) {
|
|
2275
1952
|
return _iterable => takeWhile(predicate, _iterable);
|
|
2276
1953
|
}
|
|
2277
|
-
|
|
2278
1954
|
const isArray$1 = isArray(iterable);
|
|
2279
|
-
|
|
2280
1955
|
if (!isArray$1 && typeof iterable !== 'string') {
|
|
2281
1956
|
throw new Error('`iterable` is neither list nor a string');
|
|
2282
1957
|
}
|
|
2283
|
-
|
|
2284
1958
|
let flag = true;
|
|
2285
1959
|
const holder = [];
|
|
2286
1960
|
let counter = -1;
|
|
2287
|
-
|
|
2288
1961
|
while (counter++ < iterable.length - 1) {
|
|
2289
1962
|
if (!predicate(iterable[counter])) {
|
|
2290
1963
|
if (flag) flag = false;
|
|
@@ -2303,21 +1976,17 @@ function tap(fn, x) {
|
|
|
2303
1976
|
|
|
2304
1977
|
function test(pattern, str) {
|
|
2305
1978
|
if (arguments.length === 1) return _str => test(pattern, _str);
|
|
2306
|
-
|
|
2307
1979
|
if (typeof pattern === 'string') {
|
|
2308
1980
|
throw new TypeError(`‘test’ requires a value of type RegExp as its first argument; received "${pattern}"`);
|
|
2309
1981
|
}
|
|
2310
|
-
|
|
2311
1982
|
return str.search(pattern) !== -1;
|
|
2312
1983
|
}
|
|
2313
1984
|
|
|
2314
1985
|
function times(fn, howMany) {
|
|
2315
1986
|
if (arguments.length === 1) return _howMany => times(fn, _howMany);
|
|
2316
|
-
|
|
2317
1987
|
if (!isInteger(howMany) || howMany < 0) {
|
|
2318
1988
|
throw new RangeError('n must be an integer');
|
|
2319
1989
|
}
|
|
2320
|
-
|
|
2321
1990
|
return map(fn, range(0, howMany));
|
|
2322
1991
|
}
|
|
2323
1992
|
|
|
@@ -2349,12 +2018,10 @@ function trim(str) {
|
|
|
2349
2018
|
}
|
|
2350
2019
|
|
|
2351
2020
|
const isFunction = x => ['Promise', 'Function'].includes(type(x));
|
|
2352
|
-
|
|
2353
2021
|
function tryCatch(fn, fallback) {
|
|
2354
2022
|
if (!isFunction(fn)) {
|
|
2355
2023
|
throw new Error(`R.tryCatch | fn '${fn}'`);
|
|
2356
2024
|
}
|
|
2357
|
-
|
|
2358
2025
|
const passFallback = isFunction(fallback);
|
|
2359
2026
|
return (...inputs) => {
|
|
2360
2027
|
try {
|
|
@@ -2384,7 +2051,6 @@ function uniqBy(fn, list) {
|
|
|
2384
2051
|
if (arguments.length === 1) {
|
|
2385
2052
|
return _list => uniqBy(fn, _list);
|
|
2386
2053
|
}
|
|
2387
|
-
|
|
2388
2054
|
const set = new Set();
|
|
2389
2055
|
return list.filter(item => {
|
|
2390
2056
|
if (set.has(fn(item))) return false;
|
|
@@ -2396,31 +2062,24 @@ function uniqBy(fn, list) {
|
|
|
2396
2062
|
function includesWith(predicate, target, list) {
|
|
2397
2063
|
let willReturn = false;
|
|
2398
2064
|
let index = -1;
|
|
2399
|
-
|
|
2400
2065
|
while (++index < list.length && !willReturn) {
|
|
2401
2066
|
const value = list[index];
|
|
2402
|
-
|
|
2403
2067
|
if (predicate(target, value)) {
|
|
2404
2068
|
willReturn = true;
|
|
2405
2069
|
}
|
|
2406
2070
|
}
|
|
2407
|
-
|
|
2408
2071
|
return willReturn;
|
|
2409
2072
|
}
|
|
2410
|
-
|
|
2411
2073
|
function uniqWith(predicate, list) {
|
|
2412
2074
|
if (arguments.length === 1) return _list => uniqWith(predicate, _list);
|
|
2413
2075
|
let index = -1;
|
|
2414
2076
|
const willReturn = [];
|
|
2415
|
-
|
|
2416
2077
|
while (++index < list.length) {
|
|
2417
2078
|
const value = list[index];
|
|
2418
|
-
|
|
2419
2079
|
if (!includesWith(predicate, value, willReturn)) {
|
|
2420
2080
|
willReturn.push(value);
|
|
2421
2081
|
}
|
|
2422
2082
|
}
|
|
2423
|
-
|
|
2424
2083
|
return willReturn;
|
|
2425
2084
|
}
|
|
2426
2085
|
|
|
@@ -2428,7 +2087,6 @@ function unless(predicate, whenFalse) {
|
|
|
2428
2087
|
if (arguments.length === 1) {
|
|
2429
2088
|
return _whenFalse => unless(predicate, _whenFalse);
|
|
2430
2089
|
}
|
|
2431
|
-
|
|
2432
2090
|
return input => predicate(input) ? input : whenFalse(input);
|
|
2433
2091
|
}
|
|
2434
2092
|
|
|
@@ -2436,7 +2094,6 @@ function unwind(property, obj) {
|
|
|
2436
2094
|
if (arguments.length === 1) {
|
|
2437
2095
|
return _obj => unwind(property, _obj);
|
|
2438
2096
|
}
|
|
2439
|
-
|
|
2440
2097
|
if (!isArray(obj[property])) return [obj];
|
|
2441
2098
|
return mapArray(x => _objectSpread2(_objectSpread2({}, obj), {}, {
|
|
2442
2099
|
[property]: x
|
|
@@ -2452,7 +2109,6 @@ const Const = x => ({
|
|
|
2452
2109
|
x,
|
|
2453
2110
|
map: fn => Const(x)
|
|
2454
2111
|
});
|
|
2455
|
-
|
|
2456
2112
|
function view(lens, target) {
|
|
2457
2113
|
if (arguments.length === 1) return _target => view(lens, _target);
|
|
2458
2114
|
return lens(Const)(target).x;
|
|
@@ -2462,25 +2118,20 @@ function whenFn(predicate, whenTrueFn, input) {
|
|
|
2462
2118
|
if (!predicate(input)) return input;
|
|
2463
2119
|
return whenTrueFn(input);
|
|
2464
2120
|
}
|
|
2465
|
-
|
|
2466
2121
|
const when = curry(whenFn);
|
|
2467
2122
|
|
|
2468
2123
|
function where(conditions, input) {
|
|
2469
2124
|
if (input === undefined) {
|
|
2470
2125
|
return _input => where(conditions, _input);
|
|
2471
2126
|
}
|
|
2472
|
-
|
|
2473
2127
|
let flag = true;
|
|
2474
|
-
|
|
2475
2128
|
for (const prop in conditions) {
|
|
2476
2129
|
if (!flag) continue;
|
|
2477
2130
|
const result = conditions[prop](input[prop]);
|
|
2478
|
-
|
|
2479
2131
|
if (flag && result === false) {
|
|
2480
2132
|
flag = false;
|
|
2481
2133
|
}
|
|
2482
2134
|
}
|
|
2483
|
-
|
|
2484
2135
|
return flag;
|
|
2485
2136
|
}
|
|
2486
2137
|
|
|
@@ -2488,13 +2139,11 @@ function whereAny(conditions, input) {
|
|
|
2488
2139
|
if (input === undefined) {
|
|
2489
2140
|
return _input => whereAny(conditions, _input);
|
|
2490
2141
|
}
|
|
2491
|
-
|
|
2492
2142
|
for (const prop in conditions) {
|
|
2493
2143
|
if (conditions[prop](input[prop])) {
|
|
2494
2144
|
return true;
|
|
2495
2145
|
}
|
|
2496
2146
|
}
|
|
2497
|
-
|
|
2498
2147
|
return false;
|
|
2499
2148
|
}
|
|
2500
2149
|
|
|
@@ -2502,7 +2151,6 @@ function whereEq(condition, input) {
|
|
|
2502
2151
|
if (arguments.length === 1) {
|
|
2503
2152
|
return _input => whereEq(condition, _input);
|
|
2504
2153
|
}
|
|
2505
|
-
|
|
2506
2154
|
const result = filter((conditionValue, conditionProp) => equals(conditionValue, input[conditionProp]), condition);
|
|
2507
2155
|
return Object.keys(result).length === Object.keys(condition).length;
|
|
2508
2156
|
}
|
|
@@ -2511,7 +2159,6 @@ function without(matchAgainst, source) {
|
|
|
2511
2159
|
if (source === undefined) {
|
|
2512
2160
|
return _source => without(matchAgainst, _source);
|
|
2513
2161
|
}
|
|
2514
|
-
|
|
2515
2162
|
return reduce((prev, current) => _indexOf(current, matchAgainst) > -1 ? prev : prev.concat(current), [], source);
|
|
2516
2163
|
}
|
|
2517
2164
|
|
|
@@ -2524,11 +2171,9 @@ function zip(left, right) {
|
|
|
2524
2171
|
if (arguments.length === 1) return _right => zip(left, _right);
|
|
2525
2172
|
const result = [];
|
|
2526
2173
|
const length = Math.min(left.length, right.length);
|
|
2527
|
-
|
|
2528
2174
|
for (let i = 0; i < length; i++) {
|
|
2529
2175
|
result[i] = [left[i], right[i]];
|
|
2530
2176
|
}
|
|
2531
|
-
|
|
2532
2177
|
return result;
|
|
2533
2178
|
}
|
|
2534
2179
|
|
|
@@ -2543,7 +2188,6 @@ function zipObj(keys, values) {
|
|
|
2543
2188
|
function zipWithFn(fn, x, y) {
|
|
2544
2189
|
return take(x.length > y.length ? y.length : x.length, x).map((xInstance, i) => fn(xInstance, y[i]));
|
|
2545
2190
|
}
|
|
2546
|
-
|
|
2547
2191
|
const zipWith = curry(zipWithFn);
|
|
2548
2192
|
|
|
2549
2193
|
export { F, T, __findHighestArity, _arity, _indexOf, _lastIndexOf, _pipe, add, adjust, all, allPass, always, and, any, anyPass, append, apply, applySpec, assoc, assocPath, bind, both, chain, clamp, clone, complement, compose, concat, cond, converge, count, countBy, curry, curryN, dec, defaultTo, difference, dissoc, divide, drop, dropLast, dropLastWhile, dropRepeats, dropRepeatsWith, dropWhile, either, endsWith, eqProps, equals, evolve, evolveArray, evolveObject, filter, filterArray, filterObject, find, findIndex, findLast, findLastIndex, flatten, flip, forEach, fromPairs, groupBy, groupWith, has, hasPath, head, identical, identity, ifElse, inc, includes, indexBy, indexOf, init, intersection, intersperse, is, isEmpty, isNil, join, juxt, keys, last, lastIndexOf, length, lens, lensIndex, lensPath, lensProp, map, mapArray, mapObjIndexed, mapObject, match, mathMod, max, maxBy, maxByFn, mean, median, mergeRight as merge, mergeAll, mergeDeepRight, mergeLeft, mergeRight, mergeWith, min, minBy, minByFn, modify, modifyPath, modifyPathFn, modulo, move, multiply, negate, none, not, nth, objOf, of, omit, on, once, or, over, partial, partialObject, partition, partitionArray, partitionObject, path, pathEq, pathOr, paths, pick, pickAll, pipe, pluck, prepend, product, prop, propEq, propIs, propOr, propSatisfies, props, range, reduce, reduceFn, reduceStopper, reject, repeat, replace, reverse, set, slice, sort, sortBy, split, splitAt, splitEvery, splitWhen, startsWith, subtract, sum, symmetricDifference, tail, take, takeLast, takeLastWhile, takeWhile, tap, test, times, toLower, toPairs, toString, toUpper, transpose, trim, tryCatch, type, unapply, union, uniq, uniqBy, uniqWith, unless, unwind, update, updateFn, values, view, when, where, whereAny, whereEq, without, xor, zip, zipObj, zipWith };
|