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.mjs
CHANGED
|
@@ -11,14 +11,12 @@ function add(a, b) {
|
|
|
11
11
|
return Number(a) + Number(b);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
const cloneList = list => Array.prototype.slice.call(list);
|
|
15
|
+
|
|
14
16
|
function curry(fn, args = []) {
|
|
15
17
|
return (..._args) => (rest => rest.length >= fn.length ? fn(...rest) : curry(fn, rest))([...args, ..._args]);
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
const cloneList = list => {
|
|
19
|
-
return Array.prototype.slice.call(list);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
20
|
function adjustFn(index, replaceFn, list) {
|
|
23
21
|
const actualIndex = index < 0 ? list.length + index : index;
|
|
24
22
|
if (index >= list.length || actualIndex < 0) return list;
|
|
@@ -56,7 +54,7 @@ function allPass(predicates) {
|
|
|
56
54
|
}
|
|
57
55
|
|
|
58
56
|
function always(x) {
|
|
59
|
-
return
|
|
57
|
+
return _ => x;
|
|
60
58
|
}
|
|
61
59
|
|
|
62
60
|
function and(a, b) {
|
|
@@ -257,11 +255,11 @@ function _curryN(n, cache, fn) {
|
|
|
257
255
|
}
|
|
258
256
|
|
|
259
257
|
const remaining = n - args.length;
|
|
260
|
-
return args.length >= n ? fn.apply(this, args) : _arity(remaining, _curryN(n, args, fn));
|
|
258
|
+
return args.length >= n ? fn.apply(this, args) : _arity$1(remaining, _curryN(n, args, fn));
|
|
261
259
|
};
|
|
262
260
|
}
|
|
263
261
|
|
|
264
|
-
function _arity(n, fn) {
|
|
262
|
+
function _arity$1(n, fn) {
|
|
265
263
|
switch (n) {
|
|
266
264
|
case 0:
|
|
267
265
|
return function () {
|
|
@@ -327,7 +325,7 @@ function curryN(n, fn) {
|
|
|
327
325
|
throw new Error('First argument to _arity must be a non-negative integer no greater than ten');
|
|
328
326
|
}
|
|
329
327
|
|
|
330
|
-
return _arity(n, _curryN(n, [], fn));
|
|
328
|
+
return _arity$1(n, _curryN(n, [], fn));
|
|
331
329
|
}
|
|
332
330
|
|
|
333
331
|
function bind(fn, thisObj) {
|
|
@@ -379,26 +377,106 @@ function complement(fn) {
|
|
|
379
377
|
return (...input) => !fn(...input);
|
|
380
378
|
}
|
|
381
379
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
380
|
+
const _keys = Object.keys;
|
|
381
|
+
|
|
382
|
+
function reduceFn(reducer, acc, list) {
|
|
383
|
+
if (!_isArray(list)) {
|
|
384
|
+
throw new TypeError('reduce: list must be array or iterable');
|
|
385
385
|
}
|
|
386
386
|
|
|
387
|
-
|
|
388
|
-
|
|
387
|
+
let index = 0;
|
|
388
|
+
const len = list.length;
|
|
389
389
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
390
|
+
while (index < len) {
|
|
391
|
+
acc = reducer(acc, list[index], index, list);
|
|
392
|
+
index++;
|
|
393
|
+
}
|
|
393
394
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
395
|
+
return acc;
|
|
396
|
+
}
|
|
397
|
+
const reduce = curry(reduceFn);
|
|
397
398
|
|
|
398
|
-
|
|
399
|
-
|
|
399
|
+
function _arity(n, fn) {
|
|
400
|
+
switch (n) {
|
|
401
|
+
case 0:
|
|
402
|
+
return function () {
|
|
403
|
+
return fn.apply(this, arguments);
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
case 1:
|
|
407
|
+
return function (a0) {
|
|
408
|
+
return fn.apply(this, arguments);
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
case 2:
|
|
412
|
+
return function (a0, a1) {
|
|
413
|
+
return fn.apply(this, arguments);
|
|
414
|
+
};
|
|
415
|
+
|
|
416
|
+
case 3:
|
|
417
|
+
return function (a0, a1, a2) {
|
|
418
|
+
return fn.apply(this, arguments);
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
case 4:
|
|
422
|
+
return function (a0, a1, a2, a3) {
|
|
423
|
+
return fn.apply(this, arguments);
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
case 5:
|
|
427
|
+
return function (a0, a1, a2, a3, a4) {
|
|
428
|
+
return fn.apply(this, arguments);
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
case 6:
|
|
432
|
+
return function (a0, a1, a2, a3, a4, a5) {
|
|
433
|
+
return fn.apply(this, arguments);
|
|
434
|
+
};
|
|
435
|
+
|
|
436
|
+
case 7:
|
|
437
|
+
return function (a0, a1, a2, a3, a4, a5, a6) {
|
|
438
|
+
return fn.apply(this, arguments);
|
|
439
|
+
};
|
|
440
|
+
|
|
441
|
+
case 8:
|
|
442
|
+
return function (a0, a1, a2, a3, a4, a5, a6, a7) {
|
|
443
|
+
return fn.apply(this, arguments);
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
case 9:
|
|
447
|
+
return function (a0, a1, a2, a3, a4, a5, a6, a7, a8) {
|
|
448
|
+
return fn.apply(this, arguments);
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
case 10:
|
|
452
|
+
return function (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {
|
|
453
|
+
return fn.apply(this, arguments);
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
default:
|
|
457
|
+
throw new Error('First argument to _arity must be a non-negative integer no greater than ten');
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
function _pipe(f, g) {
|
|
461
|
+
return function () {
|
|
462
|
+
return g.call(this, f.apply(this, arguments));
|
|
400
463
|
};
|
|
401
464
|
}
|
|
465
|
+
function pipe() {
|
|
466
|
+
if (arguments.length === 0) {
|
|
467
|
+
throw new Error('pipe requires at least one argument');
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
return _arity(arguments[0].length, reduceFn(_pipe, arguments[0], Array.prototype.slice.call(arguments, 1, Infinity)));
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
function compose() {
|
|
474
|
+
if (arguments.length === 0) {
|
|
475
|
+
throw new Error('compose requires at least one argument');
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
return pipe.apply(this, Array.prototype.slice.call(arguments, 0).reverse());
|
|
479
|
+
}
|
|
402
480
|
|
|
403
481
|
function concat(x, y) {
|
|
404
482
|
if (arguments.length === 1) return _y => concat(x, _y);
|
|
@@ -419,8 +497,6 @@ function cond(conditions) {
|
|
|
419
497
|
};
|
|
420
498
|
}
|
|
421
499
|
|
|
422
|
-
const _keys = Object.keys;
|
|
423
|
-
|
|
424
500
|
function mapArray(fn, list, isIndexed = false) {
|
|
425
501
|
let index = 0;
|
|
426
502
|
const willReturn = Array(list.length);
|
|
@@ -465,30 +541,39 @@ function max(x, y) {
|
|
|
465
541
|
return y > x ? y : x;
|
|
466
542
|
}
|
|
467
543
|
|
|
468
|
-
function
|
|
469
|
-
if (
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
544
|
+
function converge(fn, transformers) {
|
|
545
|
+
if (arguments.length === 1) return _transformers => converge(fn, _transformers);
|
|
546
|
+
const highestArity = reduce((a, b) => max(a, b.length), 0, transformers);
|
|
547
|
+
return curryN(highestArity, function () {
|
|
548
|
+
return fn.apply(this, map(g => g.apply(this, arguments), transformers));
|
|
549
|
+
});
|
|
550
|
+
}
|
|
475
551
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
552
|
+
function count(predicate, list) {
|
|
553
|
+
if (arguments.length === 1) {
|
|
554
|
+
return _list => count(predicate, _list);
|
|
479
555
|
}
|
|
480
556
|
|
|
481
|
-
return
|
|
557
|
+
if (!_isArray(list)) return 0;
|
|
558
|
+
return list.filter(x => predicate(x)).length;
|
|
482
559
|
}
|
|
483
560
|
|
|
484
|
-
|
|
561
|
+
function countBy(fn, list) {
|
|
562
|
+
if (arguments.length === 1) {
|
|
563
|
+
return _list => countBy(fn, _list);
|
|
564
|
+
}
|
|
485
565
|
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
566
|
+
const willReturn = {};
|
|
567
|
+
list.forEach(item => {
|
|
568
|
+
const key = fn(item);
|
|
569
|
+
|
|
570
|
+
if (!willReturn[key]) {
|
|
571
|
+
willReturn[key] = 1;
|
|
572
|
+
} else {
|
|
573
|
+
willReturn[key]++;
|
|
574
|
+
}
|
|
491
575
|
});
|
|
576
|
+
return willReturn;
|
|
492
577
|
}
|
|
493
578
|
|
|
494
579
|
const dec = x => x - 1;
|
|
@@ -515,7 +600,7 @@ function type(input) {
|
|
|
515
600
|
}
|
|
516
601
|
|
|
517
602
|
const typeResult = Object.prototype.toString.call(input).slice(8, -1);
|
|
518
|
-
return typeResult === 'AsyncFunction' ? '
|
|
603
|
+
return typeResult === 'AsyncFunction' ? 'Promise' : typeResult;
|
|
519
604
|
}
|
|
520
605
|
|
|
521
606
|
function _lastIndexOf(valueToFind, list) {
|
|
@@ -1109,7 +1194,7 @@ function flipFn(fn) {
|
|
|
1109
1194
|
return fn(input[1], input[0], input[2], input[3]);
|
|
1110
1195
|
}
|
|
1111
1196
|
|
|
1112
|
-
throw new Error(
|
|
1197
|
+
throw new Error('R.flip doesn\'t work with arity > 4');
|
|
1113
1198
|
};
|
|
1114
1199
|
}
|
|
1115
1200
|
|
|
@@ -1212,6 +1297,10 @@ function has(prop, obj) {
|
|
|
1212
1297
|
return obj.hasOwnProperty(prop);
|
|
1213
1298
|
}
|
|
1214
1299
|
|
|
1300
|
+
function createPath(path, delimiter = '.') {
|
|
1301
|
+
return typeof path === 'string' ? path.split(delimiter) : path;
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1215
1304
|
function path(pathInput, obj) {
|
|
1216
1305
|
if (arguments.length === 1) return _obj => path(pathInput, _obj);
|
|
1217
1306
|
|
|
@@ -1221,7 +1310,7 @@ function path(pathInput, obj) {
|
|
|
1221
1310
|
|
|
1222
1311
|
let willReturn = obj;
|
|
1223
1312
|
let counter = 0;
|
|
1224
|
-
const pathArrValue =
|
|
1313
|
+
const pathArrValue = createPath(pathInput);
|
|
1225
1314
|
|
|
1226
1315
|
while (counter < pathArrValue.length) {
|
|
1227
1316
|
if (willReturn === null || willReturn === undefined) {
|
|
@@ -1400,6 +1489,10 @@ function join(glue, list) {
|
|
|
1400
1489
|
return list.join(glue);
|
|
1401
1490
|
}
|
|
1402
1491
|
|
|
1492
|
+
function juxt(listOfFunctions) {
|
|
1493
|
+
return (...args) => listOfFunctions.map(fn => fn(...args));
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1403
1496
|
function keys(x) {
|
|
1404
1497
|
return Object.keys(x);
|
|
1405
1498
|
}
|
|
@@ -1434,10 +1527,10 @@ function lens(getter, setter) {
|
|
|
1434
1527
|
};
|
|
1435
1528
|
}
|
|
1436
1529
|
|
|
1437
|
-
function nth(index,
|
|
1438
|
-
if (arguments.length === 1) return
|
|
1439
|
-
const idx = index < 0 ?
|
|
1440
|
-
return Object.prototype.toString.call(
|
|
1530
|
+
function nth(index, input) {
|
|
1531
|
+
if (arguments.length === 1) return _input => nth(index, _input);
|
|
1532
|
+
const idx = index < 0 ? input.length + index : index;
|
|
1533
|
+
return Object.prototype.toString.call(input) === '[object String]' ? input.charAt(idx) : input[idx];
|
|
1441
1534
|
}
|
|
1442
1535
|
|
|
1443
1536
|
function updateFn(index, newValue, list) {
|
|
@@ -1496,15 +1589,15 @@ function median(list) {
|
|
|
1496
1589
|
}).slice(idx, idx + width));
|
|
1497
1590
|
}
|
|
1498
1591
|
|
|
1499
|
-
function
|
|
1500
|
-
if (arguments.length === 1) return _newProps =>
|
|
1592
|
+
function mergeRight(target, newProps) {
|
|
1593
|
+
if (arguments.length === 1) return _newProps => mergeRight(target, _newProps);
|
|
1501
1594
|
return Object.assign({}, target || {}, newProps || {});
|
|
1502
1595
|
}
|
|
1503
1596
|
|
|
1504
1597
|
function mergeAll(arr) {
|
|
1505
1598
|
let willReturn = {};
|
|
1506
1599
|
map(val => {
|
|
1507
|
-
willReturn =
|
|
1600
|
+
willReturn = mergeRight(willReturn, val);
|
|
1508
1601
|
}, arr);
|
|
1509
1602
|
return willReturn;
|
|
1510
1603
|
}
|
|
@@ -1531,9 +1624,32 @@ function mergeDeepRight(target, source) {
|
|
|
1531
1624
|
|
|
1532
1625
|
function mergeLeft(x, y) {
|
|
1533
1626
|
if (arguments.length === 1) return _y => mergeLeft(x, _y);
|
|
1534
|
-
return
|
|
1627
|
+
return mergeRight(y, x);
|
|
1535
1628
|
}
|
|
1536
1629
|
|
|
1630
|
+
function mergeWithFn(mergeFn, a, b) {
|
|
1631
|
+
const willReturn = {};
|
|
1632
|
+
Object.keys(a).forEach(key => {
|
|
1633
|
+
if (b[key] === undefined) {
|
|
1634
|
+
willReturn[key] = a[key];
|
|
1635
|
+
} else {
|
|
1636
|
+
willReturn[key] = mergeFn(a[key], b[key]);
|
|
1637
|
+
}
|
|
1638
|
+
});
|
|
1639
|
+
Object.keys(b).forEach(key => {
|
|
1640
|
+
if (willReturn[key] !== undefined) return;
|
|
1641
|
+
|
|
1642
|
+
if (a[key] === undefined) {
|
|
1643
|
+
willReturn[key] = b[key];
|
|
1644
|
+
} else {
|
|
1645
|
+
willReturn[key] = mergeFn(a[key], b[key]);
|
|
1646
|
+
}
|
|
1647
|
+
});
|
|
1648
|
+
return willReturn;
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
const mergeWith = curry(mergeWithFn);
|
|
1652
|
+
|
|
1537
1653
|
function min(x, y) {
|
|
1538
1654
|
if (arguments.length === 1) return _y => min(x, _y);
|
|
1539
1655
|
return y < x ? y : x;
|
|
@@ -1576,10 +1692,10 @@ function none(predicate, list) {
|
|
|
1576
1692
|
if (arguments.length === 1) return _list => none(predicate, _list);
|
|
1577
1693
|
|
|
1578
1694
|
for (let i = 0; i < list.length; i++) {
|
|
1579
|
-
if (
|
|
1695
|
+
if (predicate(list[i])) return false;
|
|
1580
1696
|
}
|
|
1581
1697
|
|
|
1582
|
-
return
|
|
1698
|
+
return true;
|
|
1583
1699
|
}
|
|
1584
1700
|
|
|
1585
1701
|
function not(input) {
|
|
@@ -1607,7 +1723,7 @@ function omit(propsToOmit, obj) {
|
|
|
1607
1723
|
return undefined;
|
|
1608
1724
|
}
|
|
1609
1725
|
|
|
1610
|
-
const propsToOmitValue =
|
|
1726
|
+
const propsToOmitValue = createPath(propsToOmit, ',');
|
|
1611
1727
|
const willReturn = {};
|
|
1612
1728
|
|
|
1613
1729
|
for (const key in obj) {
|
|
@@ -1619,6 +1735,18 @@ function omit(propsToOmit, obj) {
|
|
|
1619
1735
|
return willReturn;
|
|
1620
1736
|
}
|
|
1621
1737
|
|
|
1738
|
+
function on(binaryFn, unaryFn, a, b) {
|
|
1739
|
+
if (arguments.length === 3) {
|
|
1740
|
+
return _b => on(binaryFn, unaryFn, a, _b);
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
if (arguments.length === 2) {
|
|
1744
|
+
return (_a, _b) => on(binaryFn, unaryFn, _a, _b);
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
return binaryFn(unaryFn(a), unaryFn(b));
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1622
1750
|
function onceFn(fn, context) {
|
|
1623
1751
|
let result;
|
|
1624
1752
|
return function () {
|
|
@@ -1667,6 +1795,18 @@ function partial(fn, ...args) {
|
|
|
1667
1795
|
};
|
|
1668
1796
|
}
|
|
1669
1797
|
|
|
1798
|
+
function partialObject(fn, input) {
|
|
1799
|
+
return rest => {
|
|
1800
|
+
if (type(fn) === 'Async') {
|
|
1801
|
+
return new Promise((resolve, reject) => {
|
|
1802
|
+
fn(mergeDeepRight(rest, input)).then(resolve).catch(reject);
|
|
1803
|
+
});
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
return fn(mergeDeepRight(rest, input));
|
|
1807
|
+
};
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1670
1810
|
function partitionObject(predicate, iterable) {
|
|
1671
1811
|
const yes = {};
|
|
1672
1812
|
const no = {};
|
|
@@ -1730,7 +1870,7 @@ function pick(propsToPick, input) {
|
|
|
1730
1870
|
return undefined;
|
|
1731
1871
|
}
|
|
1732
1872
|
|
|
1733
|
-
const keys =
|
|
1873
|
+
const keys = createPath(propsToPick, ',');
|
|
1734
1874
|
const willReturn = {};
|
|
1735
1875
|
let counter = 0;
|
|
1736
1876
|
|
|
@@ -1752,7 +1892,7 @@ function pickAll(propsToPick, obj) {
|
|
|
1752
1892
|
return undefined;
|
|
1753
1893
|
}
|
|
1754
1894
|
|
|
1755
|
-
const keysValue =
|
|
1895
|
+
const keysValue = createPath(propsToPick, ',');
|
|
1756
1896
|
const willReturn = {};
|
|
1757
1897
|
let counter = 0;
|
|
1758
1898
|
|
|
@@ -1769,24 +1909,6 @@ function pickAll(propsToPick, obj) {
|
|
|
1769
1909
|
return willReturn;
|
|
1770
1910
|
}
|
|
1771
1911
|
|
|
1772
|
-
function pipe(...fns) {
|
|
1773
|
-
if (fns.length === 0) throw new Error('pipe requires at least one argument');
|
|
1774
|
-
return (...args) => {
|
|
1775
|
-
const list = fns.slice();
|
|
1776
|
-
|
|
1777
|
-
if (list.length > 0) {
|
|
1778
|
-
const fn = list.shift();
|
|
1779
|
-
let result = fn(...args);
|
|
1780
|
-
|
|
1781
|
-
while (list.length > 0) {
|
|
1782
|
-
result = list.shift()(result);
|
|
1783
|
-
}
|
|
1784
|
-
|
|
1785
|
-
return result;
|
|
1786
|
-
}
|
|
1787
|
-
};
|
|
1788
|
-
}
|
|
1789
|
-
|
|
1790
1912
|
function pluck(property, list) {
|
|
1791
1913
|
if (arguments.length === 1) return _list => pluck(property, _list);
|
|
1792
1914
|
const willReturn = [];
|
|
@@ -1826,6 +1948,12 @@ function propOrFn(defaultValue, property, obj) {
|
|
|
1826
1948
|
|
|
1827
1949
|
const propOr = curry(propOrFn);
|
|
1828
1950
|
|
|
1951
|
+
function propSatisfiesFn(predicate, property, obj) {
|
|
1952
|
+
return predicate(prop(property, obj));
|
|
1953
|
+
}
|
|
1954
|
+
|
|
1955
|
+
const propSatisfies = curry(propSatisfiesFn);
|
|
1956
|
+
|
|
1829
1957
|
function props(propsToPick, obj) {
|
|
1830
1958
|
if (arguments.length === 1) {
|
|
1831
1959
|
return _obj => props(propsToPick, _obj);
|
|
@@ -2131,9 +2259,7 @@ function trim(str) {
|
|
|
2131
2259
|
return str.trim();
|
|
2132
2260
|
}
|
|
2133
2261
|
|
|
2134
|
-
|
|
2135
|
-
return ['Async', 'Function'].includes(type(fn));
|
|
2136
|
-
}
|
|
2262
|
+
const isFunction = x => ['Promise', 'Function'].includes(type(x));
|
|
2137
2263
|
|
|
2138
2264
|
function tryCatch(fn, fallback) {
|
|
2139
2265
|
if (!isFunction(fn)) {
|
|
@@ -2204,6 +2330,58 @@ function unless(predicate, whenFalse) {
|
|
|
2204
2330
|
return input => predicate(input) ? input : whenFalse(input);
|
|
2205
2331
|
}
|
|
2206
2332
|
|
|
2333
|
+
function ownKeys(object, enumerableOnly) {
|
|
2334
|
+
var keys = Object.keys(object);
|
|
2335
|
+
|
|
2336
|
+
if (Object.getOwnPropertySymbols) {
|
|
2337
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
2338
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
2339
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
2340
|
+
})), keys.push.apply(keys, symbols);
|
|
2341
|
+
}
|
|
2342
|
+
|
|
2343
|
+
return keys;
|
|
2344
|
+
}
|
|
2345
|
+
|
|
2346
|
+
function _objectSpread2(target) {
|
|
2347
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
2348
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
2349
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
2350
|
+
_defineProperty(target, key, source[key]);
|
|
2351
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
2352
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
2353
|
+
});
|
|
2354
|
+
}
|
|
2355
|
+
|
|
2356
|
+
return target;
|
|
2357
|
+
}
|
|
2358
|
+
|
|
2359
|
+
function _defineProperty(obj, key, value) {
|
|
2360
|
+
if (key in obj) {
|
|
2361
|
+
Object.defineProperty(obj, key, {
|
|
2362
|
+
value: value,
|
|
2363
|
+
enumerable: true,
|
|
2364
|
+
configurable: true,
|
|
2365
|
+
writable: true
|
|
2366
|
+
});
|
|
2367
|
+
} else {
|
|
2368
|
+
obj[key] = value;
|
|
2369
|
+
}
|
|
2370
|
+
|
|
2371
|
+
return obj;
|
|
2372
|
+
}
|
|
2373
|
+
|
|
2374
|
+
function unwind(property, obj) {
|
|
2375
|
+
if (arguments.length === 1) {
|
|
2376
|
+
return _obj => unwind(property, _obj);
|
|
2377
|
+
}
|
|
2378
|
+
|
|
2379
|
+
if (!_isArray(obj[property])) return [obj];
|
|
2380
|
+
return mapArray(x => _objectSpread2(_objectSpread2({}, obj), {}, {
|
|
2381
|
+
[property]: x
|
|
2382
|
+
}), obj[property]);
|
|
2383
|
+
}
|
|
2384
|
+
|
|
2207
2385
|
function values(obj) {
|
|
2208
2386
|
if (type(obj) !== 'Object') return [];
|
|
2209
2387
|
return Object.values(obj);
|
|
@@ -2244,6 +2422,20 @@ function where(conditions, input) {
|
|
|
2244
2422
|
return flag;
|
|
2245
2423
|
}
|
|
2246
2424
|
|
|
2425
|
+
function whereAny(conditions, input) {
|
|
2426
|
+
if (input === undefined) {
|
|
2427
|
+
return _input => whereAny(conditions, _input);
|
|
2428
|
+
}
|
|
2429
|
+
|
|
2430
|
+
for (const prop in conditions) {
|
|
2431
|
+
if (conditions[prop](input[prop])) {
|
|
2432
|
+
return true;
|
|
2433
|
+
}
|
|
2434
|
+
}
|
|
2435
|
+
|
|
2436
|
+
return false;
|
|
2437
|
+
}
|
|
2438
|
+
|
|
2247
2439
|
function whereEq(condition, input) {
|
|
2248
2440
|
if (arguments.length === 1) {
|
|
2249
2441
|
return _input => whereEq(condition, _input);
|
|
@@ -2292,4 +2484,4 @@ function zipWithFn(fn, x, y) {
|
|
|
2292
2484
|
|
|
2293
2485
|
const zipWith = curry(zipWithFn);
|
|
2294
2486
|
|
|
2295
|
-
export { F, T, _indexOf, _lastIndexOf, add, adjust, all, allPass, always, and, any, anyPass, append, apply, applySpec, assoc, assocPath, bind, both, chain, clamp, clone, complement, compose, concat, cond, converge, 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, keys, last, lastIndexOf, length, lens, lensIndex, lensPath, lensProp, map, mapArray, mapObjIndexed, mapObject, match, mathMod, max, maxBy, maxByFn, mean, median, merge, mergeAll, mergeDeepRight, mergeLeft, min, minBy, minByFn, modulo, move, multiply, negate, none, not, nth, objOf, of, omit, once, or, over, partial, partition, partitionArray, partitionObject, path, pathEq, pathOr, paths, pick, pickAll, pipe, pluck, prepend, product, prop, propEq, propIs, propOr, props, range, reduce, 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, uniqWith, unless, update, values, view, when, where, whereEq, without, xor, zip, zipObj, zipWith };
|
|
2487
|
+
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, 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, 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, uniqWith, unless, unwind, update, values, view, when, where, whereAny, whereEq, without, xor, zip, zipObj, zipWith };
|