rambda 7.0.2 → 7.1.1
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 +28 -2
- package/README.md +3703 -3294
- package/dist/rambda.js +284 -78
- package/dist/rambda.mjs +270 -78
- package/dist/rambda.umd.js +1 -1
- package/immutable.d.ts +95 -13
- package/index.d.ts +95 -13
- package/package.json +119 -119
- package/src/F.js +1 -1
- package/src/T.js +1 -1
- package/src/_internals/_isInteger.js +1 -1
- package/src/_internals/_keys.js +0 -1
- package/src/_internals/_objectIs.js +2 -7
- package/src/_internals/baseSlice.js +8 -6
- package/src/_internals/cloneList.js +1 -3
- package/src/_internals/createPath.js +3 -0
- package/src/_internals/isFalsy.js +5 -5
- package/src/_internals/isObject.js +2 -2
- package/src/_internals/isTruthy.js +5 -5
- package/src/_internals/set.js +19 -13
- package/src/add.js +1 -1
- package/src/adjust.js +6 -4
- package/src/all.js +3 -3
- package/src/allPass.js +3 -3
- package/src/always.js +2 -2
- package/src/and.js +1 -1
- package/src/any.js +3 -3
- package/src/anyPass.js +3 -3
- package/src/append.js +2 -2
- package/src/apply.js +2 -2
- package/src/applySpec.js +59 -33
- package/src/assoc.js +7 -3
- package/src/assocPath.js +25 -21
- package/src/bind.js +3 -3
- package/src/both.js +1 -1
- package/src/chain.js +2 -2
- package/src/clamp.js +6 -6
- package/src/clone.js +10 -10
- package/src/complement.js +1 -1
- package/src/compose.js +5 -14
- package/src/concat.js +2 -2
- package/src/cond.js +3 -3
- package/src/converge.js +11 -11
- package/src/count.js +10 -0
- package/src/countBy.js +17 -0
- package/src/curry.js +2 -2
- package/src/curryN.js +81 -61
- package/src/defaultTo.js +3 -3
- package/src/difference.js +3 -3
- package/src/dissoc.js +4 -4
- package/src/divide.js +1 -1
- package/src/drop.js +1 -1
- package/src/dropLast.js +5 -5
- package/src/dropLastWhile.js +12 -12
- package/src/dropRepeats.js +6 -6
- package/src/dropRepeatsWith.js +7 -7
- package/src/dropWhile.js +9 -9
- package/src/either.js +2 -2
- package/src/endsWith.js +6 -5
- package/src/eqProps.js +6 -4
- package/src/equals.js +64 -65
- package/src/evolve.js +21 -23
- package/src/filter.js +21 -15
- package/src/find.js +4 -4
- package/src/findIndex.js +3 -3
- package/src/findLast.js +4 -4
- package/src/findLastIndex.js +3 -3
- package/src/flatten.js +6 -6
- package/src/flip.js +15 -11
- package/src/forEach.js +12 -10
- package/src/fromPairs.js +2 -2
- package/src/groupBy.js +6 -6
- package/src/groupWith.js +12 -10
- package/src/has.js +1 -1
- package/src/hasPath.js +3 -3
- package/src/head.js +3 -3
- package/src/identical.js +2 -2
- package/src/identity.js +1 -1
- package/src/ifElse.js +5 -3
- package/src/includes.js +6 -6
- package/src/indexBy.js +11 -11
- package/src/indexOf.js +3 -3
- package/src/init.js +7 -3
- package/src/intersection.js +3 -3
- package/src/intersperse.js +5 -5
- package/src/is.js +2 -2
- package/src/isEmpty.js +5 -5
- package/src/isNil.js +1 -1
- package/src/isPromise.js +3 -3
- package/src/join.js +1 -1
- package/src/juxt.js +3 -0
- package/src/keys.js +1 -1
- package/src/last.js +4 -4
- package/src/lastIndexOf.js +3 -3
- package/src/length.js +2 -2
- package/src/lens.js +3 -3
- package/src/lensIndex.js +4 -4
- package/src/lensPath.js +4 -4
- package/src/lensProp.js +4 -4
- package/src/map.js +15 -11
- package/src/match.js +1 -1
- package/src/mathMod.js +3 -3
- package/src/max.js +1 -1
- package/src/maxBy.js +4 -2
- package/src/maybe.js +4 -2
- package/src/mean.js +2 -2
- package/src/median.js +10 -12
- package/src/merge.js +1 -5
- package/src/mergeAll.js +4 -4
- package/src/mergeDeepRight.js +8 -8
- package/src/mergeLeft.js +3 -3
- package/src/mergeRight.js +7 -0
- package/src/mergeWith.js +29 -0
- package/src/min.js +1 -1
- package/src/minBy.js +4 -2
- package/src/modulo.js +1 -1
- package/src/move.js +8 -6
- package/src/multiply.js +1 -1
- package/src/negate.js +1 -1
- package/src/none.js +4 -4
- package/src/not.js +1 -1
- package/src/nth.js +6 -6
- package/src/objOf.js +3 -5
- package/src/of.js +2 -2
- package/src/omit.js +8 -8
- package/src/on.js +16 -0
- package/src/once.js +6 -6
- package/src/or.js +1 -1
- package/src/over.js +5 -3
- package/src/partial.js +3 -3
- package/src/partialObject.js +15 -0
- package/src/partition.js +18 -16
- package/src/path.js +9 -8
- package/src/pathEq.js +6 -4
- package/src/pathOr.js +6 -4
- package/src/paths.js +3 -3
- package/src/pick.js +8 -8
- package/src/pickAll.js +9 -9
- package/src/pipe.js +85 -13
- package/src/pluck.js +4 -4
- package/src/prepend.js +3 -3
- package/src/product.js +2 -2
- package/src/prop.js +2 -2
- package/src/propEq.js +5 -3
- package/src/propIs.js +6 -4
- package/src/propOr.js +6 -4
- package/src/propSatisfies.js +10 -0
- package/src/props.js +6 -6
- package/src/range.js +4 -4
- package/src/reduce.js +11 -7
- package/src/reject.js +2 -2
- package/src/repeat.js +2 -2
- package/src/replace.js +4 -2
- package/src/reverse.js +4 -3
- package/src/set.js +9 -5
- package/src/slice.js +4 -2
- package/src/sort.js +2 -2
- package/src/sortBy.js +2 -2
- package/src/split.js +1 -1
- package/src/splitAt.js +9 -9
- package/src/splitEvery.js +6 -8
- package/src/splitWhen.js +10 -10
- package/src/startsWith.js +6 -5
- package/src/subtract.js +1 -1
- package/src/sum.js +1 -1
- package/src/symmetricDifference.js +7 -9
- package/src/tail.js +2 -2
- package/src/take.js +5 -3
- package/src/takeLast.js +5 -3
- package/src/takeLastWhile.js +7 -7
- package/src/takeWhile.js +8 -8
- package/src/tap.js +1 -1
- package/src/test.js +3 -5
- package/src/times.js +4 -4
- package/src/toLower.js +1 -1
- package/src/toPairs.js +1 -1
- package/src/toString.js +1 -1
- package/src/toUpper.js +1 -1
- package/src/transpose.js +3 -4
- package/src/trim.js +1 -1
- package/src/tryCatch.js +7 -5
- package/src/type.js +5 -5
- package/src/unapply.js +2 -2
- package/src/union.js +3 -3
- package/src/uniq.js +3 -3
- package/src/uniqWith.js +12 -8
- package/src/unless.js +3 -3
- package/src/unwind.js +15 -0
- package/src/update.js +8 -4
- package/src/values.js +2 -2
- package/src/view.js +2 -2
- package/src/when.js +4 -2
- package/src/where.js +5 -5
- package/src/whereAny.js +12 -0
- package/src/whereEq.js +7 -9
- package/src/without.js +4 -4
- package/src/xor.js +2 -2
- package/src/zip.js +3 -3
- package/src/zipObj.js +6 -4
- package/src/zipWith.js +6 -6
- package/src/isFunction.js +0 -5
package/dist/rambda.js
CHANGED
|
@@ -15,14 +15,12 @@ function add(a, b) {
|
|
|
15
15
|
return Number(a) + Number(b);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
const cloneList = list => Array.prototype.slice.call(list);
|
|
19
|
+
|
|
18
20
|
function curry(fn, args = []) {
|
|
19
21
|
return (..._args) => (rest => rest.length >= fn.length ? fn(...rest) : curry(fn, rest))([...args, ..._args]);
|
|
20
22
|
}
|
|
21
23
|
|
|
22
|
-
const cloneList = list => {
|
|
23
|
-
return Array.prototype.slice.call(list);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
24
|
function adjustFn(index, replaceFn, list) {
|
|
27
25
|
const actualIndex = index < 0 ? list.length + index : index;
|
|
28
26
|
if (index >= list.length || actualIndex < 0) return list;
|
|
@@ -60,7 +58,7 @@ function allPass(predicates) {
|
|
|
60
58
|
}
|
|
61
59
|
|
|
62
60
|
function always(x) {
|
|
63
|
-
return
|
|
61
|
+
return _ => x;
|
|
64
62
|
}
|
|
65
63
|
|
|
66
64
|
function and(a, b) {
|
|
@@ -261,11 +259,11 @@ function _curryN(n, cache, fn) {
|
|
|
261
259
|
}
|
|
262
260
|
|
|
263
261
|
const remaining = n - args.length;
|
|
264
|
-
return args.length >= n ? fn.apply(this, args) : _arity(remaining, _curryN(n, args, fn));
|
|
262
|
+
return args.length >= n ? fn.apply(this, args) : _arity$1(remaining, _curryN(n, args, fn));
|
|
265
263
|
};
|
|
266
264
|
}
|
|
267
265
|
|
|
268
|
-
function _arity(n, fn) {
|
|
266
|
+
function _arity$1(n, fn) {
|
|
269
267
|
switch (n) {
|
|
270
268
|
case 0:
|
|
271
269
|
return function () {
|
|
@@ -331,7 +329,7 @@ function curryN(n, fn) {
|
|
|
331
329
|
throw new Error('First argument to _arity must be a non-negative integer no greater than ten');
|
|
332
330
|
}
|
|
333
331
|
|
|
334
|
-
return _arity(n, _curryN(n, [], fn));
|
|
332
|
+
return _arity$1(n, _curryN(n, [], fn));
|
|
335
333
|
}
|
|
336
334
|
|
|
337
335
|
function bind(fn, thisObj) {
|
|
@@ -383,26 +381,106 @@ function complement(fn) {
|
|
|
383
381
|
return (...input) => !fn(...input);
|
|
384
382
|
}
|
|
385
383
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
384
|
+
const _keys = Object.keys;
|
|
385
|
+
|
|
386
|
+
function reduceFn(reducer, acc, list) {
|
|
387
|
+
if (!_isArray(list)) {
|
|
388
|
+
throw new TypeError('reduce: list must be array or iterable');
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
-
|
|
392
|
-
|
|
391
|
+
let index = 0;
|
|
392
|
+
const len = list.length;
|
|
393
393
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
394
|
+
while (index < len) {
|
|
395
|
+
acc = reducer(acc, list[index], index, list);
|
|
396
|
+
index++;
|
|
397
|
+
}
|
|
397
398
|
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
399
|
+
return acc;
|
|
400
|
+
}
|
|
401
|
+
const reduce = curry(reduceFn);
|
|
401
402
|
|
|
402
|
-
|
|
403
|
-
|
|
403
|
+
function _arity(n, fn) {
|
|
404
|
+
switch (n) {
|
|
405
|
+
case 0:
|
|
406
|
+
return function () {
|
|
407
|
+
return fn.apply(this, arguments);
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
case 1:
|
|
411
|
+
return function (a0) {
|
|
412
|
+
return fn.apply(this, arguments);
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
case 2:
|
|
416
|
+
return function (a0, a1) {
|
|
417
|
+
return fn.apply(this, arguments);
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
case 3:
|
|
421
|
+
return function (a0, a1, a2) {
|
|
422
|
+
return fn.apply(this, arguments);
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
case 4:
|
|
426
|
+
return function (a0, a1, a2, a3) {
|
|
427
|
+
return fn.apply(this, arguments);
|
|
428
|
+
};
|
|
429
|
+
|
|
430
|
+
case 5:
|
|
431
|
+
return function (a0, a1, a2, a3, a4) {
|
|
432
|
+
return fn.apply(this, arguments);
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
case 6:
|
|
436
|
+
return function (a0, a1, a2, a3, a4, a5) {
|
|
437
|
+
return fn.apply(this, arguments);
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
case 7:
|
|
441
|
+
return function (a0, a1, a2, a3, a4, a5, a6) {
|
|
442
|
+
return fn.apply(this, arguments);
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
case 8:
|
|
446
|
+
return function (a0, a1, a2, a3, a4, a5, a6, a7) {
|
|
447
|
+
return fn.apply(this, arguments);
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
case 9:
|
|
451
|
+
return function (a0, a1, a2, a3, a4, a5, a6, a7, a8) {
|
|
452
|
+
return fn.apply(this, arguments);
|
|
453
|
+
};
|
|
454
|
+
|
|
455
|
+
case 10:
|
|
456
|
+
return function (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {
|
|
457
|
+
return fn.apply(this, arguments);
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
default:
|
|
461
|
+
throw new Error('First argument to _arity must be a non-negative integer no greater than ten');
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
function _pipe(f, g) {
|
|
465
|
+
return function () {
|
|
466
|
+
return g.call(this, f.apply(this, arguments));
|
|
404
467
|
};
|
|
405
468
|
}
|
|
469
|
+
function pipe() {
|
|
470
|
+
if (arguments.length === 0) {
|
|
471
|
+
throw new Error('pipe requires at least one argument');
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
return _arity(arguments[0].length, reduceFn(_pipe, arguments[0], Array.prototype.slice.call(arguments, 1, Infinity)));
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
function compose() {
|
|
478
|
+
if (arguments.length === 0) {
|
|
479
|
+
throw new Error('compose requires at least one argument');
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
return pipe.apply(this, Array.prototype.slice.call(arguments, 0).reverse());
|
|
483
|
+
}
|
|
406
484
|
|
|
407
485
|
function concat(x, y) {
|
|
408
486
|
if (arguments.length === 1) return _y => concat(x, _y);
|
|
@@ -423,8 +501,6 @@ function cond(conditions) {
|
|
|
423
501
|
};
|
|
424
502
|
}
|
|
425
503
|
|
|
426
|
-
const _keys = Object.keys;
|
|
427
|
-
|
|
428
504
|
function mapArray(fn, list, isIndexed = false) {
|
|
429
505
|
let index = 0;
|
|
430
506
|
const willReturn = Array(list.length);
|
|
@@ -469,30 +545,39 @@ function max(x, y) {
|
|
|
469
545
|
return y > x ? y : x;
|
|
470
546
|
}
|
|
471
547
|
|
|
472
|
-
function
|
|
473
|
-
if (
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
548
|
+
function converge(fn, transformers) {
|
|
549
|
+
if (arguments.length === 1) return _transformers => converge(fn, _transformers);
|
|
550
|
+
const highestArity = reduce((a, b) => max(a, b.length), 0, transformers);
|
|
551
|
+
return curryN(highestArity, function () {
|
|
552
|
+
return fn.apply(this, map(g => g.apply(this, arguments), transformers));
|
|
553
|
+
});
|
|
554
|
+
}
|
|
479
555
|
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
556
|
+
function count(predicate, list) {
|
|
557
|
+
if (arguments.length === 1) {
|
|
558
|
+
return _list => count(predicate, _list);
|
|
483
559
|
}
|
|
484
560
|
|
|
485
|
-
return
|
|
561
|
+
if (!_isArray(list)) return 0;
|
|
562
|
+
return list.filter(x => predicate(x)).length;
|
|
486
563
|
}
|
|
487
564
|
|
|
488
|
-
|
|
565
|
+
function countBy(fn, list) {
|
|
566
|
+
if (arguments.length === 1) {
|
|
567
|
+
return _list => countBy(fn, _list);
|
|
568
|
+
}
|
|
489
569
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
570
|
+
const willReturn = {};
|
|
571
|
+
list.forEach(item => {
|
|
572
|
+
const key = fn(item);
|
|
573
|
+
|
|
574
|
+
if (!willReturn[key]) {
|
|
575
|
+
willReturn[key] = 1;
|
|
576
|
+
} else {
|
|
577
|
+
willReturn[key]++;
|
|
578
|
+
}
|
|
495
579
|
});
|
|
580
|
+
return willReturn;
|
|
496
581
|
}
|
|
497
582
|
|
|
498
583
|
const dec = x => x - 1;
|
|
@@ -519,7 +604,7 @@ function type(input) {
|
|
|
519
604
|
}
|
|
520
605
|
|
|
521
606
|
const typeResult = Object.prototype.toString.call(input).slice(8, -1);
|
|
522
|
-
return typeResult === 'AsyncFunction' ? '
|
|
607
|
+
return typeResult === 'AsyncFunction' ? 'Promise' : typeResult;
|
|
523
608
|
}
|
|
524
609
|
|
|
525
610
|
function _lastIndexOf(valueToFind, list) {
|
|
@@ -1113,7 +1198,7 @@ function flipFn(fn) {
|
|
|
1113
1198
|
return fn(input[1], input[0], input[2], input[3]);
|
|
1114
1199
|
}
|
|
1115
1200
|
|
|
1116
|
-
throw new Error(
|
|
1201
|
+
throw new Error('R.flip doesn\'t work with arity > 4');
|
|
1117
1202
|
};
|
|
1118
1203
|
}
|
|
1119
1204
|
|
|
@@ -1216,6 +1301,10 @@ function has(prop, obj) {
|
|
|
1216
1301
|
return obj.hasOwnProperty(prop);
|
|
1217
1302
|
}
|
|
1218
1303
|
|
|
1304
|
+
function createPath(path, delimiter = '.') {
|
|
1305
|
+
return typeof path === 'string' ? path.split(delimiter) : path;
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1219
1308
|
function path(pathInput, obj) {
|
|
1220
1309
|
if (arguments.length === 1) return _obj => path(pathInput, _obj);
|
|
1221
1310
|
|
|
@@ -1225,7 +1314,7 @@ function path(pathInput, obj) {
|
|
|
1225
1314
|
|
|
1226
1315
|
let willReturn = obj;
|
|
1227
1316
|
let counter = 0;
|
|
1228
|
-
const pathArrValue =
|
|
1317
|
+
const pathArrValue = createPath(pathInput);
|
|
1229
1318
|
|
|
1230
1319
|
while (counter < pathArrValue.length) {
|
|
1231
1320
|
if (willReturn === null || willReturn === undefined) {
|
|
@@ -1404,6 +1493,10 @@ function join(glue, list) {
|
|
|
1404
1493
|
return list.join(glue);
|
|
1405
1494
|
}
|
|
1406
1495
|
|
|
1496
|
+
function juxt(listOfFunctions) {
|
|
1497
|
+
return (...args) => listOfFunctions.map(fn => fn(...args));
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1407
1500
|
function keys(x) {
|
|
1408
1501
|
return Object.keys(x);
|
|
1409
1502
|
}
|
|
@@ -1438,10 +1531,10 @@ function lens(getter, setter) {
|
|
|
1438
1531
|
};
|
|
1439
1532
|
}
|
|
1440
1533
|
|
|
1441
|
-
function nth(index,
|
|
1442
|
-
if (arguments.length === 1) return
|
|
1443
|
-
const idx = index < 0 ?
|
|
1444
|
-
return Object.prototype.toString.call(
|
|
1534
|
+
function nth(index, input) {
|
|
1535
|
+
if (arguments.length === 1) return _input => nth(index, _input);
|
|
1536
|
+
const idx = index < 0 ? input.length + index : index;
|
|
1537
|
+
return Object.prototype.toString.call(input) === '[object String]' ? input.charAt(idx) : input[idx];
|
|
1445
1538
|
}
|
|
1446
1539
|
|
|
1447
1540
|
function updateFn(index, newValue, list) {
|
|
@@ -1500,15 +1593,15 @@ function median(list) {
|
|
|
1500
1593
|
}).slice(idx, idx + width));
|
|
1501
1594
|
}
|
|
1502
1595
|
|
|
1503
|
-
function
|
|
1504
|
-
if (arguments.length === 1) return _newProps =>
|
|
1596
|
+
function mergeRight(target, newProps) {
|
|
1597
|
+
if (arguments.length === 1) return _newProps => mergeRight(target, _newProps);
|
|
1505
1598
|
return Object.assign({}, target || {}, newProps || {});
|
|
1506
1599
|
}
|
|
1507
1600
|
|
|
1508
1601
|
function mergeAll(arr) {
|
|
1509
1602
|
let willReturn = {};
|
|
1510
1603
|
map(val => {
|
|
1511
|
-
willReturn =
|
|
1604
|
+
willReturn = mergeRight(willReturn, val);
|
|
1512
1605
|
}, arr);
|
|
1513
1606
|
return willReturn;
|
|
1514
1607
|
}
|
|
@@ -1535,9 +1628,32 @@ function mergeDeepRight(target, source) {
|
|
|
1535
1628
|
|
|
1536
1629
|
function mergeLeft(x, y) {
|
|
1537
1630
|
if (arguments.length === 1) return _y => mergeLeft(x, _y);
|
|
1538
|
-
return
|
|
1631
|
+
return mergeRight(y, x);
|
|
1539
1632
|
}
|
|
1540
1633
|
|
|
1634
|
+
function mergeWithFn(mergeFn, a, b) {
|
|
1635
|
+
const willReturn = {};
|
|
1636
|
+
Object.keys(a).forEach(key => {
|
|
1637
|
+
if (b[key] === undefined) {
|
|
1638
|
+
willReturn[key] = a[key];
|
|
1639
|
+
} else {
|
|
1640
|
+
willReturn[key] = mergeFn(a[key], b[key]);
|
|
1641
|
+
}
|
|
1642
|
+
});
|
|
1643
|
+
Object.keys(b).forEach(key => {
|
|
1644
|
+
if (willReturn[key] !== undefined) return;
|
|
1645
|
+
|
|
1646
|
+
if (a[key] === undefined) {
|
|
1647
|
+
willReturn[key] = b[key];
|
|
1648
|
+
} else {
|
|
1649
|
+
willReturn[key] = mergeFn(a[key], b[key]);
|
|
1650
|
+
}
|
|
1651
|
+
});
|
|
1652
|
+
return willReturn;
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
const mergeWith = curry(mergeWithFn);
|
|
1656
|
+
|
|
1541
1657
|
function min(x, y) {
|
|
1542
1658
|
if (arguments.length === 1) return _y => min(x, _y);
|
|
1543
1659
|
return y < x ? y : x;
|
|
@@ -1580,10 +1696,10 @@ function none(predicate, list) {
|
|
|
1580
1696
|
if (arguments.length === 1) return _list => none(predicate, _list);
|
|
1581
1697
|
|
|
1582
1698
|
for (let i = 0; i < list.length; i++) {
|
|
1583
|
-
if (
|
|
1699
|
+
if (predicate(list[i])) return false;
|
|
1584
1700
|
}
|
|
1585
1701
|
|
|
1586
|
-
return
|
|
1702
|
+
return true;
|
|
1587
1703
|
}
|
|
1588
1704
|
|
|
1589
1705
|
function not(input) {
|
|
@@ -1611,7 +1727,7 @@ function omit(propsToOmit, obj) {
|
|
|
1611
1727
|
return undefined;
|
|
1612
1728
|
}
|
|
1613
1729
|
|
|
1614
|
-
const propsToOmitValue =
|
|
1730
|
+
const propsToOmitValue = createPath(propsToOmit, ',');
|
|
1615
1731
|
const willReturn = {};
|
|
1616
1732
|
|
|
1617
1733
|
for (const key in obj) {
|
|
@@ -1623,6 +1739,18 @@ function omit(propsToOmit, obj) {
|
|
|
1623
1739
|
return willReturn;
|
|
1624
1740
|
}
|
|
1625
1741
|
|
|
1742
|
+
function on(binaryFn, unaryFn, a, b) {
|
|
1743
|
+
if (arguments.length === 3) {
|
|
1744
|
+
return _b => on(binaryFn, unaryFn, a, _b);
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
if (arguments.length === 2) {
|
|
1748
|
+
return (_a, _b) => on(binaryFn, unaryFn, _a, _b);
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
return binaryFn(unaryFn(a), unaryFn(b));
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1626
1754
|
function onceFn(fn, context) {
|
|
1627
1755
|
let result;
|
|
1628
1756
|
return function () {
|
|
@@ -1671,6 +1799,18 @@ function partial(fn, ...args) {
|
|
|
1671
1799
|
};
|
|
1672
1800
|
}
|
|
1673
1801
|
|
|
1802
|
+
function partialObject(fn, input) {
|
|
1803
|
+
return rest => {
|
|
1804
|
+
if (type(fn) === 'Async') {
|
|
1805
|
+
return new Promise((resolve, reject) => {
|
|
1806
|
+
fn(mergeDeepRight(rest, input)).then(resolve).catch(reject);
|
|
1807
|
+
});
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1810
|
+
return fn(mergeDeepRight(rest, input));
|
|
1811
|
+
};
|
|
1812
|
+
}
|
|
1813
|
+
|
|
1674
1814
|
function partitionObject(predicate, iterable) {
|
|
1675
1815
|
const yes = {};
|
|
1676
1816
|
const no = {};
|
|
@@ -1734,7 +1874,7 @@ function pick(propsToPick, input) {
|
|
|
1734
1874
|
return undefined;
|
|
1735
1875
|
}
|
|
1736
1876
|
|
|
1737
|
-
const keys =
|
|
1877
|
+
const keys = createPath(propsToPick, ',');
|
|
1738
1878
|
const willReturn = {};
|
|
1739
1879
|
let counter = 0;
|
|
1740
1880
|
|
|
@@ -1756,7 +1896,7 @@ function pickAll(propsToPick, obj) {
|
|
|
1756
1896
|
return undefined;
|
|
1757
1897
|
}
|
|
1758
1898
|
|
|
1759
|
-
const keysValue =
|
|
1899
|
+
const keysValue = createPath(propsToPick, ',');
|
|
1760
1900
|
const willReturn = {};
|
|
1761
1901
|
let counter = 0;
|
|
1762
1902
|
|
|
@@ -1773,24 +1913,6 @@ function pickAll(propsToPick, obj) {
|
|
|
1773
1913
|
return willReturn;
|
|
1774
1914
|
}
|
|
1775
1915
|
|
|
1776
|
-
function pipe(...fns) {
|
|
1777
|
-
if (fns.length === 0) throw new Error('pipe requires at least one argument');
|
|
1778
|
-
return (...args) => {
|
|
1779
|
-
const list = fns.slice();
|
|
1780
|
-
|
|
1781
|
-
if (list.length > 0) {
|
|
1782
|
-
const fn = list.shift();
|
|
1783
|
-
let result = fn(...args);
|
|
1784
|
-
|
|
1785
|
-
while (list.length > 0) {
|
|
1786
|
-
result = list.shift()(result);
|
|
1787
|
-
}
|
|
1788
|
-
|
|
1789
|
-
return result;
|
|
1790
|
-
}
|
|
1791
|
-
};
|
|
1792
|
-
}
|
|
1793
|
-
|
|
1794
1916
|
function pluck(property, list) {
|
|
1795
1917
|
if (arguments.length === 1) return _list => pluck(property, _list);
|
|
1796
1918
|
const willReturn = [];
|
|
@@ -1830,6 +1952,12 @@ function propOrFn(defaultValue, property, obj) {
|
|
|
1830
1952
|
|
|
1831
1953
|
const propOr = curry(propOrFn);
|
|
1832
1954
|
|
|
1955
|
+
function propSatisfiesFn(predicate, property, obj) {
|
|
1956
|
+
return predicate(prop(property, obj));
|
|
1957
|
+
}
|
|
1958
|
+
|
|
1959
|
+
const propSatisfies = curry(propSatisfiesFn);
|
|
1960
|
+
|
|
1833
1961
|
function props(propsToPick, obj) {
|
|
1834
1962
|
if (arguments.length === 1) {
|
|
1835
1963
|
return _obj => props(propsToPick, _obj);
|
|
@@ -2135,9 +2263,7 @@ function trim(str) {
|
|
|
2135
2263
|
return str.trim();
|
|
2136
2264
|
}
|
|
2137
2265
|
|
|
2138
|
-
|
|
2139
|
-
return ['Async', 'Function'].includes(type(fn));
|
|
2140
|
-
}
|
|
2266
|
+
const isFunction = x => ['Promise', 'Function'].includes(type(x));
|
|
2141
2267
|
|
|
2142
2268
|
function tryCatch(fn, fallback) {
|
|
2143
2269
|
if (!isFunction(fn)) {
|
|
@@ -2208,6 +2334,58 @@ function unless(predicate, whenFalse) {
|
|
|
2208
2334
|
return input => predicate(input) ? input : whenFalse(input);
|
|
2209
2335
|
}
|
|
2210
2336
|
|
|
2337
|
+
function ownKeys(object, enumerableOnly) {
|
|
2338
|
+
var keys = Object.keys(object);
|
|
2339
|
+
|
|
2340
|
+
if (Object.getOwnPropertySymbols) {
|
|
2341
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
2342
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
2343
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
2344
|
+
})), keys.push.apply(keys, symbols);
|
|
2345
|
+
}
|
|
2346
|
+
|
|
2347
|
+
return keys;
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2350
|
+
function _objectSpread2(target) {
|
|
2351
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
2352
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
2353
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
2354
|
+
_defineProperty(target, key, source[key]);
|
|
2355
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
2356
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
2357
|
+
});
|
|
2358
|
+
}
|
|
2359
|
+
|
|
2360
|
+
return target;
|
|
2361
|
+
}
|
|
2362
|
+
|
|
2363
|
+
function _defineProperty(obj, key, value) {
|
|
2364
|
+
if (key in obj) {
|
|
2365
|
+
Object.defineProperty(obj, key, {
|
|
2366
|
+
value: value,
|
|
2367
|
+
enumerable: true,
|
|
2368
|
+
configurable: true,
|
|
2369
|
+
writable: true
|
|
2370
|
+
});
|
|
2371
|
+
} else {
|
|
2372
|
+
obj[key] = value;
|
|
2373
|
+
}
|
|
2374
|
+
|
|
2375
|
+
return obj;
|
|
2376
|
+
}
|
|
2377
|
+
|
|
2378
|
+
function unwind(property, obj) {
|
|
2379
|
+
if (arguments.length === 1) {
|
|
2380
|
+
return _obj => unwind(property, _obj);
|
|
2381
|
+
}
|
|
2382
|
+
|
|
2383
|
+
if (!_isArray(obj[property])) return [obj];
|
|
2384
|
+
return mapArray(x => _objectSpread2(_objectSpread2({}, obj), {}, {
|
|
2385
|
+
[property]: x
|
|
2386
|
+
}), obj[property]);
|
|
2387
|
+
}
|
|
2388
|
+
|
|
2211
2389
|
function values(obj) {
|
|
2212
2390
|
if (type(obj) !== 'Object') return [];
|
|
2213
2391
|
return Object.values(obj);
|
|
@@ -2248,6 +2426,20 @@ function where(conditions, input) {
|
|
|
2248
2426
|
return flag;
|
|
2249
2427
|
}
|
|
2250
2428
|
|
|
2429
|
+
function whereAny(conditions, input) {
|
|
2430
|
+
if (input === undefined) {
|
|
2431
|
+
return _input => whereAny(conditions, _input);
|
|
2432
|
+
}
|
|
2433
|
+
|
|
2434
|
+
for (const prop in conditions) {
|
|
2435
|
+
if (conditions[prop](input[prop])) {
|
|
2436
|
+
return true;
|
|
2437
|
+
}
|
|
2438
|
+
}
|
|
2439
|
+
|
|
2440
|
+
return false;
|
|
2441
|
+
}
|
|
2442
|
+
|
|
2251
2443
|
function whereEq(condition, input) {
|
|
2252
2444
|
if (arguments.length === 1) {
|
|
2253
2445
|
return _input => whereEq(condition, _input);
|
|
@@ -2298,8 +2490,11 @@ const zipWith = curry(zipWithFn);
|
|
|
2298
2490
|
|
|
2299
2491
|
exports.F = F;
|
|
2300
2492
|
exports.T = T;
|
|
2493
|
+
exports.__findHighestArity = __findHighestArity;
|
|
2494
|
+
exports._arity = _arity;
|
|
2301
2495
|
exports._indexOf = _indexOf;
|
|
2302
2496
|
exports._lastIndexOf = _lastIndexOf;
|
|
2497
|
+
exports._pipe = _pipe;
|
|
2303
2498
|
exports.add = add;
|
|
2304
2499
|
exports.adjust = adjust;
|
|
2305
2500
|
exports.all = all;
|
|
@@ -2323,6 +2518,8 @@ exports.compose = compose;
|
|
|
2323
2518
|
exports.concat = concat;
|
|
2324
2519
|
exports.cond = cond;
|
|
2325
2520
|
exports.converge = converge;
|
|
2521
|
+
exports.count = count;
|
|
2522
|
+
exports.countBy = countBy;
|
|
2326
2523
|
exports.curry = curry;
|
|
2327
2524
|
exports.curryN = curryN;
|
|
2328
2525
|
exports.dec = dec;
|
|
@@ -2373,6 +2570,7 @@ exports.is = is;
|
|
|
2373
2570
|
exports.isEmpty = isEmpty;
|
|
2374
2571
|
exports.isNil = isNil;
|
|
2375
2572
|
exports.join = join;
|
|
2573
|
+
exports.juxt = juxt;
|
|
2376
2574
|
exports.keys = keys;
|
|
2377
2575
|
exports.last = last;
|
|
2378
2576
|
exports.lastIndexOf = lastIndexOf;
|
|
@@ -2392,10 +2590,12 @@ exports.maxBy = maxBy;
|
|
|
2392
2590
|
exports.maxByFn = maxByFn;
|
|
2393
2591
|
exports.mean = mean;
|
|
2394
2592
|
exports.median = median;
|
|
2395
|
-
exports.merge =
|
|
2593
|
+
exports.merge = mergeRight;
|
|
2396
2594
|
exports.mergeAll = mergeAll;
|
|
2397
2595
|
exports.mergeDeepRight = mergeDeepRight;
|
|
2398
2596
|
exports.mergeLeft = mergeLeft;
|
|
2597
|
+
exports.mergeRight = mergeRight;
|
|
2598
|
+
exports.mergeWith = mergeWith;
|
|
2399
2599
|
exports.min = min;
|
|
2400
2600
|
exports.minBy = minBy;
|
|
2401
2601
|
exports.minByFn = minByFn;
|
|
@@ -2409,10 +2609,12 @@ exports.nth = nth;
|
|
|
2409
2609
|
exports.objOf = objOf;
|
|
2410
2610
|
exports.of = of;
|
|
2411
2611
|
exports.omit = omit;
|
|
2612
|
+
exports.on = on;
|
|
2412
2613
|
exports.once = once;
|
|
2413
2614
|
exports.or = or;
|
|
2414
2615
|
exports.over = over;
|
|
2415
2616
|
exports.partial = partial;
|
|
2617
|
+
exports.partialObject = partialObject;
|
|
2416
2618
|
exports.partition = partition;
|
|
2417
2619
|
exports.partitionArray = partitionArray;
|
|
2418
2620
|
exports.partitionObject = partitionObject;
|
|
@@ -2430,9 +2632,11 @@ exports.prop = prop;
|
|
|
2430
2632
|
exports.propEq = propEq;
|
|
2431
2633
|
exports.propIs = propIs;
|
|
2432
2634
|
exports.propOr = propOr;
|
|
2635
|
+
exports.propSatisfies = propSatisfies;
|
|
2433
2636
|
exports.props = props;
|
|
2434
2637
|
exports.range = range;
|
|
2435
2638
|
exports.reduce = reduce;
|
|
2639
|
+
exports.reduceFn = reduceFn;
|
|
2436
2640
|
exports.reject = reject;
|
|
2437
2641
|
exports.repeat = repeat;
|
|
2438
2642
|
exports.replace = replace;
|
|
@@ -2470,11 +2674,13 @@ exports.union = union;
|
|
|
2470
2674
|
exports.uniq = uniq;
|
|
2471
2675
|
exports.uniqWith = uniqWith;
|
|
2472
2676
|
exports.unless = unless;
|
|
2677
|
+
exports.unwind = unwind;
|
|
2473
2678
|
exports.update = update;
|
|
2474
2679
|
exports.values = values;
|
|
2475
2680
|
exports.view = view;
|
|
2476
2681
|
exports.when = when;
|
|
2477
2682
|
exports.where = where;
|
|
2683
|
+
exports.whereAny = whereAny;
|
|
2478
2684
|
exports.whereEq = whereEq;
|
|
2479
2685
|
exports.without = without;
|
|
2480
2686
|
exports.xor = xor;
|