rambda 8.3.0 → 8.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 +24 -0
- package/README.md +488 -317
- package/dist/rambda.js +181 -179
- package/dist/rambda.umd.js +1 -1
- package/immutable.d.ts +57 -20
- package/index.d.ts +57 -20
- package/package.json +106 -106
- package/rambda.js +2 -0
- package/src/_internals/compare.js +3 -0
- package/src/_internals/createPath.js +5 -1
- package/src/_internals/createPathInput.js +7 -0
- package/src/_internals/includes.js +12 -0
- package/src/_internals/isInteger.js +5 -0
- package/src/assoc.js +1 -1
- package/src/assocPath.js +9 -13
- package/src/dissocPath.js +47 -0
- package/src/equals.js +40 -52
- package/src/omit.js +4 -6
- package/src/partial.js +9 -3
- package/src/removeIndex.js +7 -0
package/dist/rambda.js
CHANGED
|
@@ -336,24 +336,27 @@ function _isInteger(n) {
|
|
|
336
336
|
return n << 0 === n;
|
|
337
337
|
}
|
|
338
338
|
const isInteger = Number.isInteger || _isInteger;
|
|
339
|
+
const isIndexInteger = index => Number.isInteger(Number(index));
|
|
340
|
+
|
|
341
|
+
function createPath(path, delimiter = '.') {
|
|
342
|
+
return typeof path === 'string' ? path.split(delimiter).map(x => isInteger(x) ? Number(x) : x) : path;
|
|
343
|
+
}
|
|
339
344
|
|
|
340
345
|
function assocPathFn(path, newValue, input) {
|
|
341
|
-
const pathArrValue =
|
|
342
|
-
if (pathArrValue.length === 0)
|
|
343
|
-
return newValue;
|
|
344
|
-
}
|
|
346
|
+
const pathArrValue = createPath(path);
|
|
347
|
+
if (pathArrValue.length === 0) return newValue;
|
|
345
348
|
const index = pathArrValue[0];
|
|
346
349
|
if (pathArrValue.length > 1) {
|
|
347
350
|
const condition = typeof input !== 'object' || input === null || !input.hasOwnProperty(index);
|
|
348
|
-
const nextInput = condition ?
|
|
351
|
+
const nextInput = condition ? isIndexInteger(pathArrValue[1]) ? [] : {} : input[index];
|
|
349
352
|
newValue = assocPathFn(Array.prototype.slice.call(pathArrValue, 1), newValue, nextInput);
|
|
350
353
|
}
|
|
351
|
-
if (
|
|
354
|
+
if (isIndexInteger(index) && isArray(input)) {
|
|
352
355
|
const arr = cloneList(input);
|
|
353
356
|
arr[index] = newValue;
|
|
354
357
|
return arr;
|
|
355
358
|
}
|
|
356
|
-
return
|
|
359
|
+
return assocFn(index, newValue, input);
|
|
357
360
|
}
|
|
358
361
|
const assocPath = curry(assocPathFn);
|
|
359
362
|
|
|
@@ -650,62 +653,46 @@ function type(input) {
|
|
|
650
653
|
}
|
|
651
654
|
|
|
652
655
|
function _lastIndexOf(valueToFind, list) {
|
|
653
|
-
if (!isArray(list)) {
|
|
654
|
-
throw new Error(`Cannot read property 'indexOf' of ${list}`);
|
|
655
|
-
}
|
|
656
|
+
if (!isArray(list)) throw new Error(`Cannot read property 'indexOf' of ${list}`);
|
|
656
657
|
const typeOfValue = type(valueToFind);
|
|
657
|
-
if (!['
|
|
658
|
+
if (!['Array', 'NaN', 'Object', 'RegExp'].includes(typeOfValue)) return list.lastIndexOf(valueToFind);
|
|
658
659
|
const {
|
|
659
660
|
length
|
|
660
661
|
} = list;
|
|
661
662
|
let index = length;
|
|
662
663
|
let foundIndex = -1;
|
|
663
|
-
while (--index > -1 && foundIndex === -1)
|
|
664
|
-
if (equals(list[index], valueToFind)) {
|
|
665
|
-
foundIndex = index;
|
|
666
|
-
}
|
|
667
|
-
}
|
|
664
|
+
while (--index > -1 && foundIndex === -1) if (equals(list[index], valueToFind)) foundIndex = index;
|
|
668
665
|
return foundIndex;
|
|
669
666
|
}
|
|
670
667
|
function _indexOf(valueToFind, list) {
|
|
671
|
-
if (!isArray(list)) {
|
|
672
|
-
throw new Error(`Cannot read property 'indexOf' of ${list}`);
|
|
673
|
-
}
|
|
668
|
+
if (!isArray(list)) throw new Error(`Cannot read property 'indexOf' of ${list}`);
|
|
674
669
|
const typeOfValue = type(valueToFind);
|
|
675
|
-
if (!['
|
|
670
|
+
if (!['Array', 'NaN', 'Object', 'RegExp'].includes(typeOfValue)) return list.indexOf(valueToFind);
|
|
676
671
|
let index = -1;
|
|
677
672
|
let foundIndex = -1;
|
|
678
673
|
const {
|
|
679
674
|
length
|
|
680
675
|
} = list;
|
|
681
|
-
while (++index < length && foundIndex === -1)
|
|
682
|
-
if (equals(list[index], valueToFind)) {
|
|
683
|
-
foundIndex = index;
|
|
684
|
-
}
|
|
685
|
-
}
|
|
676
|
+
while (++index < length && foundIndex === -1) if (equals(list[index], valueToFind)) foundIndex = index;
|
|
686
677
|
return foundIndex;
|
|
687
678
|
}
|
|
688
679
|
function _arrayFromIterator(iter) {
|
|
689
680
|
const list = [];
|
|
690
681
|
let next;
|
|
691
|
-
while (!(next = iter.next()).done)
|
|
692
|
-
list.push(next.value);
|
|
693
|
-
}
|
|
682
|
+
while (!(next = iter.next()).done) list.push(next.value);
|
|
694
683
|
return list;
|
|
695
684
|
}
|
|
696
|
-
function
|
|
697
|
-
if (a.size !== b.size)
|
|
698
|
-
return false;
|
|
699
|
-
}
|
|
685
|
+
function _compareSets(a, b) {
|
|
686
|
+
if (a.size !== b.size) return false;
|
|
700
687
|
const aList = _arrayFromIterator(a.values());
|
|
701
688
|
const bList = _arrayFromIterator(b.values());
|
|
702
689
|
const filtered = aList.filter(aInstance => _indexOf(aInstance, bList) === -1);
|
|
703
690
|
return filtered.length === 0;
|
|
704
691
|
}
|
|
705
|
-
function
|
|
706
|
-
|
|
707
|
-
if (
|
|
708
|
-
return
|
|
692
|
+
function compareErrors(a, b) {
|
|
693
|
+
if (a.message !== b.message) return false;
|
|
694
|
+
if (a.toString !== b.toString) return false;
|
|
695
|
+
return a.toString() === b.toString();
|
|
709
696
|
}
|
|
710
697
|
function parseDate(maybeDate) {
|
|
711
698
|
if (!maybeDate.toDateString) return [false];
|
|
@@ -719,64 +706,43 @@ function equals(a, b) {
|
|
|
719
706
|
if (arguments.length === 1) return _b => equals(a, _b);
|
|
720
707
|
const aType = type(a);
|
|
721
708
|
if (aType !== type(b)) return false;
|
|
722
|
-
if (aType === 'Function')
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
if (['NaN', 'Undefined', 'Null'].includes(aType)) return true;
|
|
726
|
-
if (aType === 'Number') {
|
|
709
|
+
if (aType === 'Function') return a.name === undefined ? false : a.name === b.name;
|
|
710
|
+
if (['NaN', 'Null', 'Undefined'].includes(aType)) return true;
|
|
711
|
+
if (['BigInt', 'Number'].includes(aType)) {
|
|
727
712
|
if (Object.is(-0, a) !== Object.is(-0, b)) return false;
|
|
728
713
|
return a.toString() === b.toString();
|
|
729
714
|
}
|
|
730
|
-
if (['
|
|
731
|
-
return a.toString() === b.toString();
|
|
732
|
-
}
|
|
715
|
+
if (['Boolean', 'String'].includes(aType)) return a.toString() === b.toString();
|
|
733
716
|
if (aType === 'Array') {
|
|
734
717
|
const aClone = Array.from(a);
|
|
735
718
|
const bClone = Array.from(b);
|
|
736
|
-
if (aClone.toString() !== bClone.toString())
|
|
737
|
-
return false;
|
|
738
|
-
}
|
|
719
|
+
if (aClone.toString() !== bClone.toString()) return false;
|
|
739
720
|
let loopArrayFlag = true;
|
|
740
721
|
aClone.forEach((aCloneInstance, aCloneIndex) => {
|
|
741
|
-
if (loopArrayFlag)
|
|
742
|
-
if (aCloneInstance !== bClone[aCloneIndex] && !equals(aCloneInstance, bClone[aCloneIndex])) {
|
|
743
|
-
loopArrayFlag = false;
|
|
744
|
-
}
|
|
745
|
-
}
|
|
722
|
+
if (loopArrayFlag) if (aCloneInstance !== bClone[aCloneIndex] && !equals(aCloneInstance, bClone[aCloneIndex])) loopArrayFlag = false;
|
|
746
723
|
});
|
|
747
724
|
return loopArrayFlag;
|
|
748
725
|
}
|
|
749
726
|
const aRegex = parseRegex(a);
|
|
750
727
|
const bRegex = parseRegex(b);
|
|
751
|
-
if (aRegex[0])
|
|
752
|
-
return bRegex[0] ? aRegex[1] === bRegex[1] : false;
|
|
753
|
-
} else if (bRegex[0]) return false;
|
|
728
|
+
if (aRegex[0]) return bRegex[0] ? aRegex[1] === bRegex[1] : false;else if (bRegex[0]) return false;
|
|
754
729
|
const aDate = parseDate(a);
|
|
755
730
|
const bDate = parseDate(b);
|
|
756
|
-
if (aDate[0])
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
const bError = parseError(b);
|
|
761
|
-
if (aError[0]) {
|
|
762
|
-
return bError[0] ? aError[0] === bError[0] && aError[1] === bError[1] : false;
|
|
763
|
-
}
|
|
764
|
-
if (aType === 'Set') {
|
|
765
|
-
return _equalsSets(a, b);
|
|
731
|
+
if (aDate[0]) return bDate[0] ? aDate[1] === bDate[1] : false;else if (bDate[0]) return false;
|
|
732
|
+
if (a instanceof Error) {
|
|
733
|
+
if (!(b instanceof Error)) return false;
|
|
734
|
+
return compareErrors(a, b);
|
|
766
735
|
}
|
|
736
|
+
if (aType === 'Set') return _compareSets(a, b);
|
|
767
737
|
if (aType === 'Object') {
|
|
768
738
|
const aKeys = Object.keys(a);
|
|
769
|
-
if (aKeys.length !== Object.keys(b).length)
|
|
770
|
-
return false;
|
|
771
|
-
}
|
|
739
|
+
if (aKeys.length !== Object.keys(b).length) return false;
|
|
772
740
|
let loopObjectFlag = true;
|
|
773
741
|
aKeys.forEach(aKeyInstance => {
|
|
774
742
|
if (loopObjectFlag) {
|
|
775
743
|
const aValue = a[aKeyInstance];
|
|
776
744
|
const bValue = b[aKeyInstance];
|
|
777
|
-
if (aValue !== bValue && !equals(aValue, bValue))
|
|
778
|
-
loopObjectFlag = false;
|
|
779
|
-
}
|
|
745
|
+
if (aValue !== bValue && !equals(aValue, bValue)) loopObjectFlag = false;
|
|
780
746
|
}
|
|
781
747
|
});
|
|
782
748
|
return loopObjectFlag;
|
|
@@ -784,8 +750,8 @@ function equals(a, b) {
|
|
|
784
750
|
return false;
|
|
785
751
|
}
|
|
786
752
|
|
|
787
|
-
function includes(valueToFind, iterable) {
|
|
788
|
-
if (arguments.length === 1) return _iterable => includes(valueToFind, _iterable);
|
|
753
|
+
function includes$1(valueToFind, iterable) {
|
|
754
|
+
if (arguments.length === 1) return _iterable => includes$1(valueToFind, _iterable);
|
|
789
755
|
if (typeof iterable === 'string') {
|
|
790
756
|
return iterable.includes(valueToFind);
|
|
791
757
|
}
|
|
@@ -840,7 +806,7 @@ function uniq(list) {
|
|
|
840
806
|
|
|
841
807
|
function difference(a, b) {
|
|
842
808
|
if (arguments.length === 1) return _b => difference(a, _b);
|
|
843
|
-
return uniq(a).filter(aInstance => !includes(aInstance, b));
|
|
809
|
+
return uniq(a).filter(aInstance => !includes$1(aInstance, b));
|
|
844
810
|
}
|
|
845
811
|
|
|
846
812
|
function differenceWithFn(fn, a, b) {
|
|
@@ -867,6 +833,135 @@ function dissoc(prop, obj) {
|
|
|
867
833
|
return willReturn;
|
|
868
834
|
}
|
|
869
835
|
|
|
836
|
+
function ownKeys(object, enumerableOnly) {
|
|
837
|
+
var keys = Object.keys(object);
|
|
838
|
+
if (Object.getOwnPropertySymbols) {
|
|
839
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
840
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
841
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
842
|
+
})), keys.push.apply(keys, symbols);
|
|
843
|
+
}
|
|
844
|
+
return keys;
|
|
845
|
+
}
|
|
846
|
+
function _objectSpread2(target) {
|
|
847
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
848
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
849
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
850
|
+
_defineProperty(target, key, source[key]);
|
|
851
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
852
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
853
|
+
});
|
|
854
|
+
}
|
|
855
|
+
return target;
|
|
856
|
+
}
|
|
857
|
+
function _defineProperty(obj, key, value) {
|
|
858
|
+
key = _toPropertyKey(key);
|
|
859
|
+
if (key in obj) {
|
|
860
|
+
Object.defineProperty(obj, key, {
|
|
861
|
+
value: value,
|
|
862
|
+
enumerable: true,
|
|
863
|
+
configurable: true,
|
|
864
|
+
writable: true
|
|
865
|
+
});
|
|
866
|
+
} else {
|
|
867
|
+
obj[key] = value;
|
|
868
|
+
}
|
|
869
|
+
return obj;
|
|
870
|
+
}
|
|
871
|
+
function _toPrimitive(input, hint) {
|
|
872
|
+
if (typeof input !== "object" || input === null) return input;
|
|
873
|
+
var prim = input[Symbol.toPrimitive];
|
|
874
|
+
if (prim !== undefined) {
|
|
875
|
+
var res = prim.call(input, hint || "default");
|
|
876
|
+
if (typeof res !== "object") return res;
|
|
877
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
878
|
+
}
|
|
879
|
+
return (hint === "string" ? String : Number)(input);
|
|
880
|
+
}
|
|
881
|
+
function _toPropertyKey(arg) {
|
|
882
|
+
var key = _toPrimitive(arg, "string");
|
|
883
|
+
return typeof key === "symbol" ? key : String(key);
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
function compare(a, b) {
|
|
887
|
+
return String(a) === String(b);
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
function includes(a, list) {
|
|
891
|
+
let index = -1;
|
|
892
|
+
const {
|
|
893
|
+
length
|
|
894
|
+
} = list;
|
|
895
|
+
while (++index < length) if (compare(list[index], a)) return true;
|
|
896
|
+
return false;
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
function omit(propsToOmit, obj) {
|
|
900
|
+
if (arguments.length === 1) return _obj => omit(propsToOmit, _obj);
|
|
901
|
+
if (obj === null || obj === undefined) return undefined;
|
|
902
|
+
const propsToOmitValue = createPath(propsToOmit, ',');
|
|
903
|
+
const willReturn = {};
|
|
904
|
+
for (const key in obj) if (!includes(key, propsToOmitValue)) willReturn[key] = obj[key];
|
|
905
|
+
return willReturn;
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
function pathFn(pathInput, obj) {
|
|
909
|
+
let willReturn = obj;
|
|
910
|
+
let counter = 0;
|
|
911
|
+
const pathArrValue = createPath(pathInput);
|
|
912
|
+
while (counter < pathArrValue.length) {
|
|
913
|
+
if (willReturn === null || willReturn === undefined) {
|
|
914
|
+
return undefined;
|
|
915
|
+
}
|
|
916
|
+
if (willReturn[pathArrValue[counter]] === null) return undefined;
|
|
917
|
+
willReturn = willReturn[pathArrValue[counter]];
|
|
918
|
+
counter++;
|
|
919
|
+
}
|
|
920
|
+
return willReturn;
|
|
921
|
+
}
|
|
922
|
+
function path(pathInput, obj) {
|
|
923
|
+
if (arguments.length === 1) return _obj => path(pathInput, _obj);
|
|
924
|
+
if (obj === null || obj === undefined) {
|
|
925
|
+
return undefined;
|
|
926
|
+
}
|
|
927
|
+
return pathFn(pathInput, obj);
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
function removeIndex(index, list) {
|
|
931
|
+
if (arguments.length === 1) return _list => removeIndex(index, _list);
|
|
932
|
+
if (index <= 0) return list.slice(1);
|
|
933
|
+
if (index >= list.length - 1) return list.slice(0, list.length - 1);
|
|
934
|
+
return [...list.slice(0, index), ...list.slice(index + 1)];
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
function updateFn(index, newValue, list) {
|
|
938
|
+
const clone = cloneList(list);
|
|
939
|
+
if (index === -1) return clone.fill(newValue, index);
|
|
940
|
+
return clone.fill(newValue, index, index + 1);
|
|
941
|
+
}
|
|
942
|
+
const update = curry(updateFn);
|
|
943
|
+
|
|
944
|
+
function dissocPath(pathInput, input) {
|
|
945
|
+
if (arguments.length === 1) return _obj => dissocPath(pathInput, _obj);
|
|
946
|
+
const pathArrValue = createPath(pathInput);
|
|
947
|
+
if (pathArrValue.length === 0) return input;
|
|
948
|
+
const pathResult = path(pathArrValue, input);
|
|
949
|
+
if (pathResult === undefined) return input;
|
|
950
|
+
const index = pathArrValue[0];
|
|
951
|
+
const condition = typeof input !== 'object' || input === null || !input.hasOwnProperty(index);
|
|
952
|
+
if (pathArrValue.length > 1) {
|
|
953
|
+
const nextInput = condition ? isIndexInteger(pathArrValue[1]) ? [] : {} : input[index];
|
|
954
|
+
const nextPathInput = Array.prototype.slice.call(pathArrValue, 1);
|
|
955
|
+
const intermediateResult = dissocPath(nextPathInput, nextInput, input);
|
|
956
|
+
if (isArray(input)) return update(index, intermediateResult, input);
|
|
957
|
+
return _objectSpread2(_objectSpread2({}, input), {}, {
|
|
958
|
+
[index]: intermediateResult
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
if (isArray(input)) return removeIndex(index, input);
|
|
962
|
+
return omit([index], input);
|
|
963
|
+
}
|
|
964
|
+
|
|
870
965
|
function divide(a, b) {
|
|
871
966
|
if (arguments.length === 1) return _b => divide(a, _b);
|
|
872
967
|
return a / b;
|
|
@@ -1232,32 +1327,6 @@ function has(prop, obj) {
|
|
|
1232
1327
|
return obj.hasOwnProperty(prop);
|
|
1233
1328
|
}
|
|
1234
1329
|
|
|
1235
|
-
function createPath(path, delimiter = '.') {
|
|
1236
|
-
return typeof path === 'string' ? path.split(delimiter) : path;
|
|
1237
|
-
}
|
|
1238
|
-
|
|
1239
|
-
function pathFn(pathInput, obj) {
|
|
1240
|
-
let willReturn = obj;
|
|
1241
|
-
let counter = 0;
|
|
1242
|
-
const pathArrValue = createPath(pathInput);
|
|
1243
|
-
while (counter < pathArrValue.length) {
|
|
1244
|
-
if (willReturn === null || willReturn === undefined) {
|
|
1245
|
-
return undefined;
|
|
1246
|
-
}
|
|
1247
|
-
if (willReturn[pathArrValue[counter]] === null) return undefined;
|
|
1248
|
-
willReturn = willReturn[pathArrValue[counter]];
|
|
1249
|
-
counter++;
|
|
1250
|
-
}
|
|
1251
|
-
return willReturn;
|
|
1252
|
-
}
|
|
1253
|
-
function path(pathInput, obj) {
|
|
1254
|
-
if (arguments.length === 1) return _obj => path(pathInput, _obj);
|
|
1255
|
-
if (obj === null || obj === undefined) {
|
|
1256
|
-
return undefined;
|
|
1257
|
-
}
|
|
1258
|
-
return pathFn(pathInput, obj);
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1261
1330
|
function hasPath(pathInput, obj) {
|
|
1262
1331
|
if (arguments.length === 1) {
|
|
1263
1332
|
return objHolder => hasPath(pathInput, objHolder);
|
|
@@ -1346,7 +1415,7 @@ function init(listOrString) {
|
|
|
1346
1415
|
|
|
1347
1416
|
function intersection(listA, listB) {
|
|
1348
1417
|
if (arguments.length === 1) return _list => intersection(listA, _list);
|
|
1349
|
-
return filter(x => includes(x, listA), listB);
|
|
1418
|
+
return filter(x => includes$1(x, listA), listB);
|
|
1350
1419
|
}
|
|
1351
1420
|
|
|
1352
1421
|
function intersperse(separator, list) {
|
|
@@ -1433,13 +1502,6 @@ function nth(index, input) {
|
|
|
1433
1502
|
return Object.prototype.toString.call(input) === '[object String]' ? input.charAt(idx) : input[idx];
|
|
1434
1503
|
}
|
|
1435
1504
|
|
|
1436
|
-
function updateFn(index, newValue, list) {
|
|
1437
|
-
const clone = cloneList(list);
|
|
1438
|
-
if (index === -1) return clone.fill(newValue, index);
|
|
1439
|
-
return clone.fill(newValue, index, index + 1);
|
|
1440
|
-
}
|
|
1441
|
-
const update = curry(updateFn);
|
|
1442
|
-
|
|
1443
1505
|
function lensIndex(index) {
|
|
1444
1506
|
return lens(nth(index), update(index));
|
|
1445
1507
|
}
|
|
@@ -1558,56 +1620,6 @@ function minByFn(compareFn, x, y) {
|
|
|
1558
1620
|
}
|
|
1559
1621
|
const minBy = curry(minByFn);
|
|
1560
1622
|
|
|
1561
|
-
function ownKeys(object, enumerableOnly) {
|
|
1562
|
-
var keys = Object.keys(object);
|
|
1563
|
-
if (Object.getOwnPropertySymbols) {
|
|
1564
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
1565
|
-
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
1566
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
1567
|
-
})), keys.push.apply(keys, symbols);
|
|
1568
|
-
}
|
|
1569
|
-
return keys;
|
|
1570
|
-
}
|
|
1571
|
-
function _objectSpread2(target) {
|
|
1572
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
1573
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
1574
|
-
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
1575
|
-
_defineProperty(target, key, source[key]);
|
|
1576
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
1577
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1578
|
-
});
|
|
1579
|
-
}
|
|
1580
|
-
return target;
|
|
1581
|
-
}
|
|
1582
|
-
function _defineProperty(obj, key, value) {
|
|
1583
|
-
key = _toPropertyKey(key);
|
|
1584
|
-
if (key in obj) {
|
|
1585
|
-
Object.defineProperty(obj, key, {
|
|
1586
|
-
value: value,
|
|
1587
|
-
enumerable: true,
|
|
1588
|
-
configurable: true,
|
|
1589
|
-
writable: true
|
|
1590
|
-
});
|
|
1591
|
-
} else {
|
|
1592
|
-
obj[key] = value;
|
|
1593
|
-
}
|
|
1594
|
-
return obj;
|
|
1595
|
-
}
|
|
1596
|
-
function _toPrimitive(input, hint) {
|
|
1597
|
-
if (typeof input !== "object" || input === null) return input;
|
|
1598
|
-
var prim = input[Symbol.toPrimitive];
|
|
1599
|
-
if (prim !== undefined) {
|
|
1600
|
-
var res = prim.call(input, hint || "default");
|
|
1601
|
-
if (typeof res !== "object") return res;
|
|
1602
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1603
|
-
}
|
|
1604
|
-
return (hint === "string" ? String : Number)(input);
|
|
1605
|
-
}
|
|
1606
|
-
function _toPropertyKey(arg) {
|
|
1607
|
-
var key = _toPrimitive(arg, "string");
|
|
1608
|
-
return typeof key === "symbol" ? key : String(key);
|
|
1609
|
-
}
|
|
1610
|
-
|
|
1611
1623
|
function isIterable(input) {
|
|
1612
1624
|
return Array.isArray(input) || type(input) === 'Object';
|
|
1613
1625
|
}
|
|
@@ -1691,21 +1703,6 @@ function of(value) {
|
|
|
1691
1703
|
return [value];
|
|
1692
1704
|
}
|
|
1693
1705
|
|
|
1694
|
-
function omit(propsToOmit, obj) {
|
|
1695
|
-
if (arguments.length === 1) return _obj => omit(propsToOmit, _obj);
|
|
1696
|
-
if (obj === null || obj === undefined) {
|
|
1697
|
-
return undefined;
|
|
1698
|
-
}
|
|
1699
|
-
const propsToOmitValue = createPath(propsToOmit, ',');
|
|
1700
|
-
const willReturn = {};
|
|
1701
|
-
for (const key in obj) {
|
|
1702
|
-
if (!propsToOmitValue.includes(key)) {
|
|
1703
|
-
willReturn[key] = obj[key];
|
|
1704
|
-
}
|
|
1705
|
-
}
|
|
1706
|
-
return willReturn;
|
|
1707
|
-
}
|
|
1708
|
-
|
|
1709
1706
|
function on(binaryFn, unaryFn, a, b) {
|
|
1710
1707
|
if (arguments.length === 3) {
|
|
1711
1708
|
return _b => on(binaryFn, unaryFn, a, _b);
|
|
@@ -1750,11 +1747,12 @@ const over = curry(overFn);
|
|
|
1750
1747
|
|
|
1751
1748
|
function partial(fn, ...args) {
|
|
1752
1749
|
const len = fn.length;
|
|
1750
|
+
const argList = args.length === 1 && isArray(args[0]) ? args[0] : args;
|
|
1753
1751
|
return (...rest) => {
|
|
1754
|
-
if (
|
|
1755
|
-
return fn(...
|
|
1752
|
+
if (argList.length + rest.length >= len) {
|
|
1753
|
+
return fn(...argList, ...rest);
|
|
1756
1754
|
}
|
|
1757
|
-
return partial(fn, ...[...
|
|
1755
|
+
return partial(fn, ...[...argList, ...rest]);
|
|
1758
1756
|
};
|
|
1759
1757
|
}
|
|
1760
1758
|
|
|
@@ -2046,7 +2044,7 @@ function symmetricDifference(x, y) {
|
|
|
2046
2044
|
if (arguments.length === 1) {
|
|
2047
2045
|
return _y => symmetricDifference(x, _y);
|
|
2048
2046
|
}
|
|
2049
|
-
return concat(filter(value => !includes(value, y), x), filter(value => !includes(value, x), y));
|
|
2047
|
+
return concat(filter(value => !includes$1(value, y), x), filter(value => !includes$1(value, x), y));
|
|
2050
2048
|
}
|
|
2051
2049
|
|
|
2052
2050
|
function takeLast(howMany, listOrString) {
|
|
@@ -2170,7 +2168,7 @@ function union(x, y) {
|
|
|
2170
2168
|
if (arguments.length === 1) return _y => union(x, _y);
|
|
2171
2169
|
const toReturn = cloneList(x);
|
|
2172
2170
|
y.forEach(yInstance => {
|
|
2173
|
-
if (!includes(yInstance, x)) toReturn.push(yInstance);
|
|
2171
|
+
if (!includes$1(yInstance, x)) toReturn.push(yInstance);
|
|
2174
2172
|
});
|
|
2175
2173
|
return toReturn;
|
|
2176
2174
|
}
|
|
@@ -2347,7 +2345,9 @@ exports.applySpec = applySpec;
|
|
|
2347
2345
|
exports.applyTo = applyTo;
|
|
2348
2346
|
exports.ascend = ascend;
|
|
2349
2347
|
exports.assoc = assoc;
|
|
2348
|
+
exports.assocFn = assocFn;
|
|
2350
2349
|
exports.assocPath = assocPath;
|
|
2350
|
+
exports.assocPathFn = assocPathFn;
|
|
2351
2351
|
exports.binary = binary;
|
|
2352
2352
|
exports.bind = bind;
|
|
2353
2353
|
exports.both = both;
|
|
@@ -2375,6 +2375,7 @@ exports.difference = difference;
|
|
|
2375
2375
|
exports.differenceWith = differenceWith;
|
|
2376
2376
|
exports.differenceWithFn = differenceWithFn;
|
|
2377
2377
|
exports.dissoc = dissoc;
|
|
2378
|
+
exports.dissocPath = dissocPath;
|
|
2378
2379
|
exports.divide = divide;
|
|
2379
2380
|
exports.drop = drop;
|
|
2380
2381
|
exports.dropLast = dropLast;
|
|
@@ -2409,7 +2410,7 @@ exports.identical = identical;
|
|
|
2409
2410
|
exports.identity = identity;
|
|
2410
2411
|
exports.ifElse = ifElse;
|
|
2411
2412
|
exports.inc = inc;
|
|
2412
|
-
exports.includes = includes;
|
|
2413
|
+
exports.includes = includes$1;
|
|
2413
2414
|
exports.indexBy = indexBy;
|
|
2414
2415
|
exports.indexOf = indexOf;
|
|
2415
2416
|
exports.init = init;
|
|
@@ -2493,6 +2494,7 @@ exports.reduce = reduce;
|
|
|
2493
2494
|
exports.reduceFn = reduceFn;
|
|
2494
2495
|
exports.reduceStopper = reduceStopper;
|
|
2495
2496
|
exports.reject = reject;
|
|
2497
|
+
exports.removeIndex = removeIndex;
|
|
2496
2498
|
exports.repeat = repeat;
|
|
2497
2499
|
exports.replace = replace;
|
|
2498
2500
|
exports.reverse = reverse;
|