rambda 9.4.2 → 10.0.0-beta.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 +177 -1
- package/README.md +6799 -11799
- package/dist/rambda.cjs +1795 -0
- package/dist/rambda.js +1162 -2234
- package/dist/rambda.umd.js +1801 -1
- package/immutable.d.ts +1154 -1403
- package/index.d.ts +1154 -1403
- package/package.json +102 -94
- package/rambda.js +24 -137
- package/src/_internals/baseSlice.js +5 -7
- package/src/_internals/createPath.js +4 -6
- package/src/_internals/includes.js +8 -4
- package/src/_internals/set.js +11 -11
- package/src/addProp.js +3 -0
- package/src/all.js +8 -6
- package/src/allPass.js +4 -4
- package/src/any.js +10 -10
- package/src/anyPass.js +4 -4
- package/src/append.js +6 -8
- package/src/ascend.js +8 -15
- package/src/checkObjectWithSpec.js +16 -0
- package/src/compact.js +12 -0
- package/src/complement.js +1 -1
- package/src/concat.js +2 -4
- package/src/count.js +7 -6
- package/src/countBy.js +13 -14
- package/src/createObjectFromKeys.js +10 -0
- package/src/defaultTo.js +4 -6
- package/src/descend.js +6 -13
- package/src/drop.js +4 -2
- package/src/dropLast.js +2 -8
- package/src/dropLastWhile.js +17 -26
- package/src/dropWhile.js +14 -22
- package/src/eqBy.js +3 -8
- package/src/eqProps.js +3 -9
- package/src/equals.js +99 -58
- package/src/evolve.js +3 -57
- package/src/excludes.js +5 -0
- package/src/filter.js +13 -43
- package/src/filterObject.js +13 -0
- package/src/find.js +10 -10
- package/src/findIndex.js +10 -10
- package/src/findLast.js +9 -9
- package/src/findLastIndex.js +9 -9
- package/src/findNth.js +16 -0
- package/src/flatMap.js +3 -0
- package/src/flatten.js +5 -5
- package/src/groupBy.js +14 -11
- package/src/head.js +5 -3
- package/src/includes.js +13 -11
- package/src/indexOf.js +2 -6
- package/src/init.js +6 -8
- package/src/innerJoin.js +11 -19
- package/src/interpolate.js +29 -0
- package/src/intersection.js +2 -4
- package/src/intersperse.js +13 -13
- package/src/join.js +2 -4
- package/src/last.js +4 -4
- package/src/lastIndexOf.js +2 -6
- package/src/map.js +9 -49
- package/src/mapAsync.js +11 -0
- package/src/mapKeys.js +11 -0
- package/src/mapObject.js +18 -0
- package/src/mapObjectAsync.js +10 -0
- package/src/mapParallelAsync.js +3 -0
- package/src/match.js +5 -5
- package/src/maxBy.js +2 -8
- package/src/merge.js +4 -1
- package/src/mergeTypes.js +3 -0
- package/src/minBy.js +2 -8
- package/src/modifyProp.js +20 -0
- package/src/none.js +8 -6
- package/src/objOf.js +2 -6
- package/src/objectIncludes.js +12 -0
- package/src/omit.js +26 -11
- package/src/partition.js +15 -42
- package/src/partitionObject.js +15 -0
- package/src/path.js +14 -15
- package/src/permutations.js +40 -0
- package/src/pick.js +15 -15
- package/src/pipe.js +70 -13
- package/src/pipeAsync.js +11 -0
- package/src/pluck.js +12 -14
- package/src/prepend.js +2 -6
- package/src/prop.js +2 -10
- package/src/propEq.js +8 -10
- package/src/propOr.js +7 -8
- package/src/propSatisfies.js +2 -9
- package/src/range.js +34 -11
- package/src/reduce.js +15 -30
- package/src/reject.js +2 -4
- package/src/rejectObject.js +13 -0
- package/src/replace.js +2 -8
- package/src/replaceItemAtIndex.js +15 -0
- package/src/shuffle.js +13 -0
- package/src/sort.js +2 -4
- package/src/sortBy.js +12 -10
- package/src/sortObject.js +15 -0
- package/src/sortWith.js +12 -16
- package/src/split.js +2 -4
- package/src/splitEvery.js +11 -13
- package/src/symmetricDifference.js +5 -8
- package/src/tail.js +2 -2
- package/src/take.js +11 -9
- package/src/takeLast.js +14 -14
- package/src/takeLastWhile.js +15 -16
- package/src/takeWhile.js +12 -21
- package/src/tap.js +5 -5
- package/src/test.js +2 -8
- package/src/tryCatch.js +5 -14
- package/src/type.js +6 -5
- package/src/union.js +10 -8
- package/src/uniq.js +2 -2
- package/src/uniqBy.js +5 -6
- package/src/uniqWith.js +15 -19
- package/src/unless.js +7 -9
- package/src/unwind.js +6 -14
- package/src/update.js +8 -11
- package/src/when.js +7 -9
- package/src/zip.js +8 -8
- package/src/zipWith.js +5 -7
- package/src/F.js +0 -3
- package/src/T.js +0 -3
- package/src/_internals/_arity.js +0 -64
- package/src/_internals/compare.js +0 -3
- package/src/_internals/constants.js +0 -1
- package/src/_internals/createPathInput.js +0 -7
- package/src/_internals/isFalsy.js +0 -13
- package/src/_internals/isInteger.js +0 -10
- package/src/_internals/isIterable.js +0 -5
- package/src/_internals/isObject.js +0 -5
- package/src/_internals/isTruthy.js +0 -13
- package/src/_internals/objectIs.js +0 -9
- package/src/_internals/utils.js +0 -21
- package/src/add.js +0 -5
- package/src/addIndex.js +0 -23
- package/src/addIndexRight.js +0 -9
- package/src/adjust.js +0 -16
- package/src/always.js +0 -3
- package/src/and.js +0 -5
- package/src/ap.js +0 -7
- package/src/aperture.js +0 -15
- package/src/apply.js +0 -7
- package/src/applySpec.js +0 -132
- package/src/applyTo.js +0 -7
- package/src/assoc.js +0 -11
- package/src/assocPath.js +0 -46
- package/src/binary.js +0 -5
- package/src/bind.js +0 -9
- package/src/both.js +0 -5
- package/src/call.js +0 -1
- package/src/chain.js +0 -7
- package/src/clamp.js +0 -15
- package/src/clone.js +0 -18
- package/src/collectBy.js +0 -27
- package/src/comparator.js +0 -5
- package/src/compose.js +0 -9
- package/src/composeWith.js +0 -33
- package/src/cond.js +0 -14
- package/src/converge.js +0 -18
- package/src/curry.js +0 -7
- package/src/curryN.js +0 -40
- package/src/dec.js +0 -1
- package/src/difference.js +0 -8
- package/src/differenceWith.js +0 -20
- package/src/dissoc.js +0 -13
- package/src/dissocPath.js +0 -47
- package/src/divide.js +0 -5
- package/src/dropRepeats.js +0 -20
- package/src/dropRepeatsBy.js +0 -21
- package/src/dropRepeatsWith.js +0 -28
- package/src/either.js +0 -8
- package/src/empty.js +0 -15
- package/src/endsWith.js +0 -23
- package/src/flip.js +0 -23
- package/src/forEach.js +0 -19
- package/src/forEachObjIndexed.js +0 -24
- package/src/fromPairs.js +0 -6
- package/src/groupWith.js +0 -46
- package/src/gt.js +0 -6
- package/src/gte.js +0 -6
- package/src/has.js +0 -7
- package/src/hasIn.js +0 -9
- package/src/hasPath.js +0 -9
- package/src/identical.js +0 -7
- package/src/identity.js +0 -3
- package/src/ifElse.js +0 -17
- package/src/inc.js +0 -1
- package/src/indexBy.js +0 -29
- package/src/insert.js +0 -11
- package/src/insertAll.js +0 -7
- package/src/is.js +0 -8
- package/src/isEmpty.js +0 -18
- package/src/isNil.js +0 -3
- package/src/isNotEmpty.js +0 -5
- package/src/isNotNil.js +0 -3
- package/src/isPromise.js +0 -5
- package/src/juxt.js +0 -3
- package/src/keys.js +0 -3
- package/src/length.js +0 -8
- package/src/lens.js +0 -7
- package/src/lensIndex.js +0 -7
- package/src/lensPath.js +0 -7
- package/src/lensProp.js +0 -7
- package/src/lt.js +0 -6
- package/src/lte.js +0 -6
- package/src/mathMod.js +0 -8
- package/src/max.js +0 -5
- package/src/maybe.js +0 -13
- package/src/mean.js +0 -5
- package/src/median.js +0 -17
- package/src/mergeAll.js +0 -11
- package/src/mergeDeepLeft.js +0 -5
- package/src/mergeDeepRight.js +0 -24
- package/src/mergeLeft.js +0 -7
- package/src/mergeRight.js +0 -8
- package/src/mergeWith.js +0 -25
- package/src/min.js +0 -5
- package/src/modify.js +0 -23
- package/src/modifyPath.js +0 -33
- package/src/modulo.js +0 -5
- package/src/move.js +0 -19
- package/src/multiply.js +0 -5
- package/src/negate.js +0 -3
- package/src/not.js +0 -3
- package/src/nth.js +0 -9
- package/src/of.js +0 -3
- package/src/on.js +0 -16
- package/src/once.js +0 -24
- package/src/or.js +0 -5
- package/src/over.js +0 -14
- package/src/partial.js +0 -17
- package/src/partialObject.js +0 -5
- package/src/pathEq.js +0 -11
- package/src/pathOr.js +0 -11
- package/src/pathSatisfies.js +0 -9
- package/src/paths.js +0 -9
- package/src/pickAll.js +0 -23
- package/src/pickBy.js +0 -11
- package/src/product.js +0 -4
- package/src/propIs.js +0 -10
- package/src/props.js +0 -13
- package/src/reduceBy.js +0 -29
- package/src/removeIndex.js +0 -7
- package/src/repeat.js +0 -7
- package/src/reverse.js +0 -9
- package/src/set.js +0 -9
- package/src/slice.js +0 -9
- package/src/splitAt.js +0 -21
- package/src/splitWhen.js +0 -25
- package/src/startsWith.js +0 -23
- package/src/subtract.js +0 -5
- package/src/sum.js +0 -3
- package/src/swap.js +0 -42
- package/src/times.js +0 -12
- package/src/toLower.js +0 -3
- package/src/toPairs.js +0 -3
- package/src/toString.js +0 -3
- package/src/toUpper.js +0 -3
- package/src/transpose.js +0 -10
- package/src/trim.js +0 -3
- package/src/unapply.js +0 -5
- package/src/unnest.js +0 -9
- package/src/values.js +0 -6
- package/src/view.js +0 -10
- package/src/where.js +0 -15
- package/src/whereAny.js +0 -12
- package/src/whereEq.js +0 -14
- package/src/without.js +0 -15
- package/src/xor.js +0 -5
- package/src/zipObj.js +0 -13
package/dist/rambda.js
CHANGED
|
@@ -1,2088 +1,1378 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function F() {
|
|
4
|
-
return false;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
function T() {
|
|
8
|
-
return true;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function add(a, b) {
|
|
12
|
-
if (arguments.length === 1) return _b => add(a, _b);
|
|
13
|
-
return Number(a) + Number(b);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function _concat(set1, set2) {
|
|
17
|
-
set1 = set1 || [];
|
|
18
|
-
set2 = set2 || [];
|
|
19
|
-
let idx;
|
|
20
|
-
const len1 = set1.length;
|
|
21
|
-
const len2 = set2.length;
|
|
22
|
-
const result = [];
|
|
23
|
-
idx = 0;
|
|
24
|
-
while (idx < len1) {
|
|
25
|
-
result[result.length] = set1[idx];
|
|
26
|
-
idx += 1;
|
|
27
|
-
}
|
|
28
|
-
idx = 0;
|
|
29
|
-
while (idx < len2) {
|
|
30
|
-
result[result.length] = set2[idx];
|
|
31
|
-
idx += 1;
|
|
32
|
-
}
|
|
33
|
-
return result;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function _arity(n, fn) {
|
|
37
|
-
switch (n) {
|
|
38
|
-
case 0:
|
|
39
|
-
return function () {
|
|
40
|
-
return fn.apply(this, arguments);
|
|
41
|
-
};
|
|
42
|
-
case 1:
|
|
43
|
-
return function (_1) {
|
|
44
|
-
return fn.apply(this, arguments);
|
|
45
|
-
};
|
|
46
|
-
case 2:
|
|
47
|
-
return function (_1, _2) {
|
|
48
|
-
return fn.apply(this, arguments);
|
|
49
|
-
};
|
|
50
|
-
case 3:
|
|
51
|
-
return function (_1, _2, _3) {
|
|
52
|
-
return fn.apply(this, arguments);
|
|
53
|
-
};
|
|
54
|
-
case 4:
|
|
55
|
-
return function (_1, _2, _3, _4) {
|
|
56
|
-
return fn.apply(this, arguments);
|
|
57
|
-
};
|
|
58
|
-
case 5:
|
|
59
|
-
return function (_1, _2, _3, _4, _5) {
|
|
60
|
-
return fn.apply(this, arguments);
|
|
61
|
-
};
|
|
62
|
-
case 6:
|
|
63
|
-
return function (_1, _2, _3, _4, _5, _6) {
|
|
64
|
-
return fn.apply(this, arguments);
|
|
65
|
-
};
|
|
66
|
-
case 7:
|
|
67
|
-
return function (_1, _2, _3, _4, _5, _6, _7) {
|
|
68
|
-
return fn.apply(this, arguments);
|
|
69
|
-
};
|
|
70
|
-
case 8:
|
|
71
|
-
return function (_1, _2, _3, _4, _5, _6, _7, _8) {
|
|
72
|
-
return fn.apply(this, arguments);
|
|
73
|
-
};
|
|
74
|
-
case 9:
|
|
75
|
-
return function (_1, _2, _3, _4, _5, _6, _7, _8, _9) {
|
|
76
|
-
return fn.apply(this, arguments);
|
|
77
|
-
};
|
|
78
|
-
default:
|
|
79
|
-
return function (_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) {
|
|
80
|
-
return fn.apply(this, arguments);
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function _curryN(n, cache, fn) {
|
|
86
|
-
return function () {
|
|
87
|
-
let ci = 0;
|
|
88
|
-
let ai = 0;
|
|
89
|
-
const cl = cache.length;
|
|
90
|
-
const al = arguments.length;
|
|
91
|
-
const args = new Array(cl + al);
|
|
92
|
-
while (ci < cl) {
|
|
93
|
-
args[ci] = cache[ci];
|
|
94
|
-
ci++;
|
|
95
|
-
}
|
|
96
|
-
while (ai < al) {
|
|
97
|
-
args[cl + ai] = arguments[ai];
|
|
98
|
-
ai++;
|
|
99
|
-
}
|
|
100
|
-
const remaining = n - args.length;
|
|
101
|
-
return args.length >= n ? fn.apply(this, args) : _arity(remaining, _curryN(n, args, fn));
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
function curryN(n, fn) {
|
|
105
|
-
if (arguments.length === 1) return _fn => curryN(n, _fn);
|
|
106
|
-
if (n > 10) {
|
|
107
|
-
throw new Error('First argument to _arity must be a non-negative integer no greater than ten');
|
|
108
|
-
}
|
|
109
|
-
return _arity(n, _curryN(n, [], fn));
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function addIndex(originalFunction, initialIndexFn = () => 0, loopIndexChange = x => x + 1) {
|
|
113
|
-
return curryN(originalFunction.length, function () {
|
|
114
|
-
const origFn = arguments[0];
|
|
115
|
-
const list = arguments[arguments.length - 1];
|
|
116
|
-
let idx = initialIndexFn(list.length);
|
|
117
|
-
const args = Array.prototype.slice.call(arguments, 0);
|
|
118
|
-
args[0] = function () {
|
|
119
|
-
const result = origFn.apply(this, _concat(arguments, [idx, list]));
|
|
120
|
-
idx = loopIndexChange(idx);
|
|
121
|
-
return result;
|
|
122
|
-
};
|
|
123
|
-
return originalFunction.apply(this, args);
|
|
124
|
-
});
|
|
1
|
+
function addProp(key, value) {
|
|
2
|
+
return obj => ({ ...obj, [key]: value })
|
|
125
3
|
}
|
|
126
4
|
|
|
127
|
-
function
|
|
128
|
-
return
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
return (..._args) => (rest => rest.length >= fn.length ? fn(...rest) : curry(fn, rest))([...args, ..._args]);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
function adjustFn(index, replaceFn, list) {
|
|
138
|
-
const actualIndex = index < 0 ? list.length + index : index;
|
|
139
|
-
if (index >= list.length || actualIndex < 0) return list;
|
|
140
|
-
const clone = cloneList(list);
|
|
141
|
-
clone[actualIndex] = replaceFn(clone[actualIndex]);
|
|
142
|
-
return clone;
|
|
143
|
-
}
|
|
144
|
-
const adjust = curry(adjustFn);
|
|
5
|
+
function all(predicate) {
|
|
6
|
+
return list => {
|
|
7
|
+
for (let i = 0; i < list.length; i++) {
|
|
8
|
+
if (!predicate(list[i])) {
|
|
9
|
+
return false
|
|
10
|
+
}
|
|
11
|
+
}
|
|
145
12
|
|
|
146
|
-
|
|
147
|
-
if (arguments.length === 1) return _list => all(predicate, _list);
|
|
148
|
-
for (let i = 0; i < list.length; i++) {
|
|
149
|
-
if (!predicate(list[i])) return false;
|
|
13
|
+
return true
|
|
150
14
|
}
|
|
151
|
-
return true;
|
|
152
15
|
}
|
|
153
16
|
|
|
154
17
|
function allPass(predicates) {
|
|
155
|
-
return
|
|
18
|
+
return input => {
|
|
156
19
|
let counter = 0;
|
|
157
20
|
while (counter < predicates.length) {
|
|
158
|
-
if (!predicates[counter](
|
|
159
|
-
return false
|
|
21
|
+
if (!predicates[counter](input)) {
|
|
22
|
+
return false
|
|
160
23
|
}
|
|
161
24
|
counter++;
|
|
162
25
|
}
|
|
163
|
-
return true;
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
function always(x) {
|
|
168
|
-
return _ => x;
|
|
169
|
-
}
|
|
170
26
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
return a && b;
|
|
27
|
+
return true
|
|
28
|
+
}
|
|
174
29
|
}
|
|
175
30
|
|
|
176
|
-
function any(predicate
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
31
|
+
function any(predicate) {
|
|
32
|
+
return list => {
|
|
33
|
+
let counter = 0;
|
|
34
|
+
while (counter < list.length) {
|
|
35
|
+
if (predicate(list[counter], counter)) {
|
|
36
|
+
return true
|
|
37
|
+
}
|
|
38
|
+
counter++;
|
|
182
39
|
}
|
|
183
|
-
|
|
40
|
+
|
|
41
|
+
return false
|
|
184
42
|
}
|
|
185
|
-
return false;
|
|
186
43
|
}
|
|
187
44
|
|
|
188
45
|
function anyPass(predicates) {
|
|
189
|
-
return
|
|
46
|
+
return input => {
|
|
190
47
|
let counter = 0;
|
|
191
48
|
while (counter < predicates.length) {
|
|
192
|
-
if (predicates[counter](
|
|
193
|
-
return true
|
|
49
|
+
if (predicates[counter](input)) {
|
|
50
|
+
return true
|
|
194
51
|
}
|
|
195
52
|
counter++;
|
|
196
53
|
}
|
|
197
|
-
return false;
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
54
|
|
|
201
|
-
|
|
202
|
-
if (arguments.length === 1) {
|
|
203
|
-
return _inputs => ap(functions, _inputs);
|
|
55
|
+
return false
|
|
204
56
|
}
|
|
205
|
-
return functions.reduce((acc, fn) => [...acc, ...input.map(fn)], []);
|
|
206
57
|
}
|
|
207
58
|
|
|
208
|
-
|
|
209
|
-
if (arguments.length === 1) {
|
|
210
|
-
return _list => aperture(step, _list);
|
|
211
|
-
}
|
|
212
|
-
if (step > list.length) return [];
|
|
213
|
-
let idx = 0;
|
|
214
|
-
const limit = list.length - (step - 1);
|
|
215
|
-
const acc = new Array(limit);
|
|
216
|
-
while (idx < limit) {
|
|
217
|
-
acc[idx] = list.slice(idx, idx + step);
|
|
218
|
-
idx += 1;
|
|
219
|
-
}
|
|
220
|
-
return acc;
|
|
221
|
-
}
|
|
59
|
+
const cloneList$1 = list => Array.prototype.slice.call(list);
|
|
222
60
|
|
|
223
|
-
function append(x
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
clone.push(x);
|
|
228
|
-
return clone;
|
|
229
|
-
}
|
|
61
|
+
function append(x) {
|
|
62
|
+
return list => {
|
|
63
|
+
const clone = cloneList$1(list);
|
|
64
|
+
clone.push(x);
|
|
230
65
|
|
|
231
|
-
|
|
232
|
-
if (arguments.length === 1) {
|
|
233
|
-
return _args => apply(fn, _args);
|
|
66
|
+
return clone
|
|
234
67
|
}
|
|
235
|
-
return fn.apply(this, args);
|
|
236
68
|
}
|
|
237
69
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
function __findHighestArity(spec, max = 0) {
|
|
243
|
-
for (const key in spec) {
|
|
244
|
-
if (spec.hasOwnProperty(key) === false || key === 'constructor') continue;
|
|
245
|
-
if (typeof spec[key] === 'object') {
|
|
246
|
-
max = Math.max(max, __findHighestArity(spec[key]));
|
|
247
|
-
}
|
|
248
|
-
if (typeof spec[key] === 'function') {
|
|
249
|
-
max = Math.max(max, spec[key].length);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
return max;
|
|
253
|
-
}
|
|
254
|
-
function __filterUndefined() {
|
|
255
|
-
const defined = [];
|
|
256
|
-
let i = 0;
|
|
257
|
-
const l = arguments.length;
|
|
258
|
-
while (i < l) {
|
|
259
|
-
if (typeof arguments[i] === 'undefined') break;
|
|
260
|
-
defined[i] = arguments[i];
|
|
261
|
-
i++;
|
|
262
|
-
}
|
|
263
|
-
return defined;
|
|
264
|
-
}
|
|
265
|
-
function __applySpecWithArity(spec, arity, cache) {
|
|
266
|
-
const remaining = arity - cache.length;
|
|
267
|
-
if (remaining === 1) return x => __applySpecWithArity(spec, arity, __filterUndefined(...cache, x));
|
|
268
|
-
if (remaining === 2) return (x, y) => __applySpecWithArity(spec, arity, __filterUndefined(...cache, x, y));
|
|
269
|
-
if (remaining === 3) return (x, y, z) => __applySpecWithArity(spec, arity, __filterUndefined(...cache, x, y, z));
|
|
270
|
-
if (remaining === 4) return (x, y, z, a) => __applySpecWithArity(spec, arity, __filterUndefined(...cache, x, y, z, a));
|
|
271
|
-
if (remaining > 4) return (...args) => __applySpecWithArity(spec, arity, __filterUndefined(...cache, ...args));
|
|
272
|
-
if (isArray(spec)) {
|
|
273
|
-
const ret = [];
|
|
274
|
-
let i = 0;
|
|
275
|
-
const l = spec.length;
|
|
276
|
-
for (; i < l; i++) {
|
|
277
|
-
if (typeof spec[i] === 'object' || isArray(spec[i])) {
|
|
278
|
-
ret[i] = __applySpecWithArity(spec[i], arity, cache);
|
|
279
|
-
}
|
|
280
|
-
if (typeof spec[i] === 'function') {
|
|
281
|
-
ret[i] = spec[i](...cache);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
return ret;
|
|
285
|
-
}
|
|
286
|
-
const ret = {};
|
|
287
|
-
for (const key in spec) {
|
|
288
|
-
if (spec.hasOwnProperty(key) === false || key === 'constructor') continue;
|
|
289
|
-
if (typeof spec[key] === 'object') {
|
|
290
|
-
ret[key] = __applySpecWithArity(spec[key], arity, cache);
|
|
291
|
-
continue;
|
|
292
|
-
}
|
|
293
|
-
if (typeof spec[key] === 'function') {
|
|
294
|
-
ret[key] = spec[key](...cache);
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
return ret;
|
|
298
|
-
}
|
|
299
|
-
function applySpec(spec, ...args) {
|
|
300
|
-
const arity = __findHighestArity(spec);
|
|
301
|
-
if (arity === 0) {
|
|
302
|
-
return () => ({});
|
|
70
|
+
function createCompareFunction(a, b, winner, loser) {
|
|
71
|
+
if (a === b) {
|
|
72
|
+
return 0
|
|
303
73
|
}
|
|
304
|
-
const toReturn = __applySpecWithArity(spec, arity, args);
|
|
305
|
-
return toReturn;
|
|
306
|
-
}
|
|
307
74
|
|
|
308
|
-
|
|
309
|
-
if (arguments.length === 1) {
|
|
310
|
-
return _fn => applyTo(input, _fn);
|
|
311
|
-
}
|
|
312
|
-
return fn(input);
|
|
75
|
+
return a < b ? winner : loser
|
|
313
76
|
}
|
|
314
77
|
|
|
315
|
-
function
|
|
316
|
-
|
|
317
|
-
return a < b ? winner : loser;
|
|
318
|
-
}
|
|
319
|
-
function ascend(getFunction, a, b) {
|
|
320
|
-
if (arguments.length === 1) {
|
|
321
|
-
return (_a, _b) => ascend(getFunction, _a, _b);
|
|
322
|
-
}
|
|
78
|
+
function ascend(getFunction) {
|
|
79
|
+
return (a, b) => {
|
|
323
80
|
const aValue = getFunction(a);
|
|
324
81
|
const bValue = getFunction(b);
|
|
325
|
-
return createCompareFunction(aValue, bValue, -1, 1);
|
|
326
|
-
}
|
|
327
82
|
|
|
328
|
-
|
|
329
|
-
return Object.assign({}, obj, {
|
|
330
|
-
[prop]: newValue
|
|
331
|
-
});
|
|
83
|
+
return createCompareFunction(aValue, bValue, -1, 1)
|
|
332
84
|
}
|
|
333
|
-
const assoc = curry(assocFn);
|
|
334
|
-
|
|
335
|
-
function _isInteger(n) {
|
|
336
|
-
return n << 0 === n;
|
|
337
85
|
}
|
|
338
|
-
const isInteger = Number.isInteger || _isInteger;
|
|
339
|
-
const isIndexInteger = index => Number.isInteger(Number(index));
|
|
340
86
|
|
|
341
|
-
function
|
|
342
|
-
return
|
|
343
|
-
|
|
87
|
+
function checkObjectWithSpec(conditions) {
|
|
88
|
+
return input => {
|
|
89
|
+
let shouldProceed = true;
|
|
90
|
+
for (const prop in conditions) {
|
|
91
|
+
if (!shouldProceed) {
|
|
92
|
+
continue
|
|
93
|
+
}
|
|
94
|
+
const result = conditions[prop](input[prop]);
|
|
95
|
+
if (shouldProceed && result === false) {
|
|
96
|
+
shouldProceed = false;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
344
99
|
|
|
345
|
-
|
|
346
|
-
const pathArrValue = createPath(path);
|
|
347
|
-
if (pathArrValue.length === 0) return newValue;
|
|
348
|
-
const index = pathArrValue[0];
|
|
349
|
-
if (pathArrValue.length > 1) {
|
|
350
|
-
const condition = typeof input !== 'object' || input === null || !input.hasOwnProperty(index);
|
|
351
|
-
const nextInput = condition ? isIndexInteger(pathArrValue[1]) ? [] : {} : input[index];
|
|
352
|
-
newValue = assocPathFn(Array.prototype.slice.call(pathArrValue, 1), newValue, nextInput);
|
|
100
|
+
return shouldProceed
|
|
353
101
|
}
|
|
354
|
-
if (isIndexInteger(index) && isArray(input)) {
|
|
355
|
-
const arr = cloneList(input);
|
|
356
|
-
arr[index] = newValue;
|
|
357
|
-
return arr;
|
|
358
|
-
}
|
|
359
|
-
return assocFn(index, newValue, input);
|
|
360
102
|
}
|
|
361
|
-
const assocPath = curry(assocPathFn);
|
|
362
103
|
|
|
363
|
-
|
|
364
|
-
if (fn.length <= 2) return fn;
|
|
365
|
-
return (a, b) => fn(a, b);
|
|
366
|
-
}
|
|
104
|
+
const { isArray } = Array;
|
|
367
105
|
|
|
368
|
-
function
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
106
|
+
function filter(predicate) {
|
|
107
|
+
return list => {
|
|
108
|
+
if (!list) {
|
|
109
|
+
throw new Error('Incorrect iterable input')
|
|
110
|
+
}
|
|
111
|
+
let index = 0;
|
|
112
|
+
const len = list.length;
|
|
113
|
+
const willReturn = [];
|
|
374
114
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
}
|
|
115
|
+
while (index < len) {
|
|
116
|
+
if (predicate(list[index], index)) {
|
|
117
|
+
willReturn.push(list[index]);
|
|
118
|
+
}
|
|
379
119
|
|
|
380
|
-
|
|
120
|
+
index++;
|
|
121
|
+
}
|
|
381
122
|
|
|
382
|
-
|
|
383
|
-
if (arguments.length === 1) {
|
|
384
|
-
return _list => chain(fn, _list);
|
|
123
|
+
return willReturn
|
|
385
124
|
}
|
|
386
|
-
return [].concat(...list.map(fn));
|
|
387
125
|
}
|
|
388
126
|
|
|
389
|
-
function
|
|
390
|
-
|
|
391
|
-
throw new Error('min must not be greater than max in clamp(min, max, value)');
|
|
392
|
-
}
|
|
393
|
-
if (input >= min && input <= max) return input;
|
|
394
|
-
if (input > max) return max;
|
|
395
|
-
if (input < min) return min;
|
|
127
|
+
function reject(predicate) {
|
|
128
|
+
return list => filter(x => !predicate(x))(list)
|
|
396
129
|
}
|
|
397
|
-
const clamp = curry(clampFn);
|
|
398
130
|
|
|
399
|
-
function
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
for (const key in input) {
|
|
403
|
-
const v = input[key];
|
|
404
|
-
out[key] = typeof v === 'object' && v !== null ? v.getTime ? new Date(v.getTime()) : clone(v) : v;
|
|
405
|
-
}
|
|
406
|
-
return out;
|
|
407
|
-
}
|
|
131
|
+
function rejectObject(predicate) {
|
|
132
|
+
return obj => {
|
|
133
|
+
const willReturn = {};
|
|
408
134
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
}
|
|
414
|
-
function reduceFn(reducer, acc, list) {
|
|
415
|
-
if (list == null) {
|
|
416
|
-
return acc;
|
|
417
|
-
}
|
|
418
|
-
if (!isArray(list)) {
|
|
419
|
-
throw new TypeError('reduce: list must be array or iterable');
|
|
420
|
-
}
|
|
421
|
-
let index = 0;
|
|
422
|
-
const len = list.length;
|
|
423
|
-
while (index < len) {
|
|
424
|
-
acc = reducer(acc, list[index], index, list);
|
|
425
|
-
if (acc instanceof ReduceStopper) {
|
|
426
|
-
return acc.value;
|
|
135
|
+
for (const prop in obj) {
|
|
136
|
+
if (!predicate(obj[prop], prop, obj)) {
|
|
137
|
+
willReturn[prop] = obj[prop];
|
|
138
|
+
}
|
|
427
139
|
}
|
|
428
|
-
index++;
|
|
429
|
-
}
|
|
430
|
-
return acc;
|
|
431
|
-
}
|
|
432
|
-
const reduce = curry(reduceFn);
|
|
433
|
-
const reduceStopper = value => new ReduceStopper(value);
|
|
434
140
|
|
|
435
|
-
|
|
436
|
-
if (arguments.length === 1) {
|
|
437
|
-
return _list => collectBy(fn, _list);
|
|
141
|
+
return willReturn
|
|
438
142
|
}
|
|
439
|
-
const group = reduce((o, x) => {
|
|
440
|
-
const tag = fn(x);
|
|
441
|
-
if (o[tag] === undefined) {
|
|
442
|
-
o[tag] = [];
|
|
443
|
-
}
|
|
444
|
-
o[tag].push(x);
|
|
445
|
-
return o;
|
|
446
|
-
}, {}, list);
|
|
447
|
-
const newList = [];
|
|
448
|
-
for (const tag in group) {
|
|
449
|
-
newList.push(group[tag]);
|
|
450
|
-
}
|
|
451
|
-
return newList;
|
|
452
143
|
}
|
|
453
144
|
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
145
|
+
const isNullOrUndefined = x => x === null || x === undefined;
|
|
146
|
+
|
|
147
|
+
function compact(input){
|
|
148
|
+
if(isArray(input)){
|
|
149
|
+
return reject(isNullOrUndefined)(input)
|
|
150
|
+
}
|
|
151
|
+
return rejectObject(isNullOrUndefined)(input)
|
|
458
152
|
}
|
|
459
153
|
|
|
460
154
|
function complement(fn) {
|
|
461
|
-
return (...input) => !fn(...input)
|
|
155
|
+
return (...input) => !fn(...input)
|
|
462
156
|
}
|
|
463
157
|
|
|
464
|
-
function
|
|
465
|
-
return
|
|
466
|
-
return g.call(this, f.apply(this, arguments));
|
|
467
|
-
};
|
|
468
|
-
}
|
|
469
|
-
function pipe() {
|
|
470
|
-
if (arguments.length === 0) {
|
|
471
|
-
throw new Error('pipe requires at least one argument');
|
|
472
|
-
}
|
|
473
|
-
return _arity(arguments[0].length, reduceFn(_pipe, arguments[0], Array.prototype.slice.call(arguments, 1, Infinity)));
|
|
158
|
+
function concat(x) {
|
|
159
|
+
return y => (typeof x === 'string' ? `${x}${y}` : [...x, ...y])
|
|
474
160
|
}
|
|
475
161
|
|
|
476
|
-
function
|
|
477
|
-
|
|
478
|
-
|
|
162
|
+
function count(predicate) {
|
|
163
|
+
return list => {
|
|
164
|
+
if (!isArray(list)) {
|
|
165
|
+
return 0
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return list.filter(x => predicate(x)).length
|
|
479
169
|
}
|
|
480
|
-
return pipe.apply(this, Array.prototype.slice.call(arguments, 0).reverse());
|
|
481
170
|
}
|
|
482
171
|
|
|
483
|
-
function
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
}
|
|
172
|
+
function countBy(fn) {
|
|
173
|
+
return list => {
|
|
174
|
+
const willReturn = {};
|
|
487
175
|
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
176
|
+
list.forEach(item => {
|
|
177
|
+
const key = fn(item);
|
|
178
|
+
if (!willReturn[key]) {
|
|
179
|
+
willReturn[key] = 1;
|
|
180
|
+
} else {
|
|
181
|
+
willReturn[key]++;
|
|
182
|
+
}
|
|
183
|
+
});
|
|
491
184
|
|
|
492
|
-
|
|
493
|
-
if (typeof listOrString === 'string') {
|
|
494
|
-
return listOrString.split('').reverse().join('');
|
|
185
|
+
return willReturn
|
|
495
186
|
}
|
|
496
|
-
const clone = listOrString.slice();
|
|
497
|
-
return clone.reverse();
|
|
498
187
|
}
|
|
499
188
|
|
|
500
|
-
function
|
|
501
|
-
|
|
502
|
-
|
|
189
|
+
function createObjectFromKeys(keys) {
|
|
190
|
+
return fn => {
|
|
191
|
+
const result = {};
|
|
192
|
+
keys.forEach((key, index) => {
|
|
193
|
+
result[key] = fn(key, index);
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
return result
|
|
197
|
+
}
|
|
503
198
|
}
|
|
504
199
|
|
|
505
|
-
function
|
|
506
|
-
return
|
|
200
|
+
function isFalsy(input) {
|
|
201
|
+
return input === undefined || input === null || Number.isNaN(input) === true
|
|
507
202
|
}
|
|
508
203
|
|
|
509
|
-
function
|
|
510
|
-
if (
|
|
511
|
-
return
|
|
204
|
+
function defaultTo(defaultArgument, input) {
|
|
205
|
+
if (arguments.length === 1) {
|
|
206
|
+
return _input => defaultTo(defaultArgument, _input)
|
|
512
207
|
}
|
|
513
|
-
const headList = head(list);
|
|
514
|
-
const tailList = tail(list);
|
|
515
|
-
return _arity(headList.length, function () {
|
|
516
|
-
return reduce(function (result, f) {
|
|
517
|
-
return xf.call(this, f, result);
|
|
518
|
-
}, headList.apply(this, arguments), tailList);
|
|
519
|
-
});
|
|
520
|
-
}
|
|
521
|
-
function composeWith(xf, list) {
|
|
522
|
-
if (arguments.length === 1) return _list => composeWith(xf, _list);
|
|
523
|
-
return pipeWith.apply(this, [xf, reverse(list)]);
|
|
524
|
-
}
|
|
525
208
|
|
|
526
|
-
|
|
527
|
-
if (arguments.length === 1) return _y => concat(x, _y);
|
|
528
|
-
return typeof x === 'string' ? `${x}${y}` : [...x, ...y];
|
|
209
|
+
return isFalsy(input) ? defaultArgument : input
|
|
529
210
|
}
|
|
530
211
|
|
|
531
|
-
function
|
|
532
|
-
return (
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
conditions.forEach(([predicate, getResult]) => {
|
|
536
|
-
if (!done && predicate(...input)) {
|
|
537
|
-
done = true;
|
|
538
|
-
toReturn = getResult(...input);
|
|
539
|
-
}
|
|
540
|
-
});
|
|
541
|
-
return toReturn;
|
|
542
|
-
};
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
const INCORRECT_ITERABLE_INPUT = 'Incorrect iterable input';
|
|
546
|
-
|
|
547
|
-
const {
|
|
548
|
-
keys: keys$1
|
|
549
|
-
} = Object;
|
|
212
|
+
function descend(getFunction) {
|
|
213
|
+
return (a, b) => {
|
|
214
|
+
const aValue = getFunction(a);
|
|
215
|
+
const bValue = getFunction(b);
|
|
550
216
|
|
|
551
|
-
|
|
552
|
-
let index = 0;
|
|
553
|
-
const willReturn = Array(list.length);
|
|
554
|
-
while (index < list.length) {
|
|
555
|
-
willReturn[index] = isIndexed ? fn(list[index], index) : fn(list[index]);
|
|
556
|
-
index++;
|
|
217
|
+
return createCompareFunction(aValue, bValue, 1, -1)
|
|
557
218
|
}
|
|
558
|
-
return willReturn;
|
|
559
219
|
}
|
|
560
|
-
|
|
220
|
+
|
|
221
|
+
function drop(howManyToDrop, listOrString) {
|
|
561
222
|
if (arguments.length === 1) {
|
|
562
|
-
return
|
|
563
|
-
}
|
|
564
|
-
let index = 0;
|
|
565
|
-
const objKeys = keys$1(obj);
|
|
566
|
-
const len = objKeys.length;
|
|
567
|
-
const willReturn = {};
|
|
568
|
-
while (index < len) {
|
|
569
|
-
const key = objKeys[index];
|
|
570
|
-
willReturn[key] = fn(obj[key], key, obj);
|
|
571
|
-
index++;
|
|
223
|
+
return _list => drop(howManyToDrop, _list)
|
|
572
224
|
}
|
|
573
|
-
return willReturn;
|
|
574
|
-
}
|
|
575
|
-
const mapObjIndexed = mapObject;
|
|
576
|
-
function map(fn, iterable) {
|
|
577
|
-
if (arguments.length === 1) return _iterable => map(fn, _iterable);
|
|
578
|
-
if (!iterable) {
|
|
579
|
-
throw new Error(INCORRECT_ITERABLE_INPUT);
|
|
580
|
-
}
|
|
581
|
-
if (isArray(iterable)) return mapArray(fn, iterable);
|
|
582
|
-
return mapObject(fn, iterable);
|
|
583
|
-
}
|
|
584
225
|
|
|
585
|
-
|
|
586
|
-
if (arguments.length === 1) return _y => max(x, _y);
|
|
587
|
-
return y > x ? y : x;
|
|
226
|
+
return listOrString.slice(howManyToDrop > 0 ? howManyToDrop : 0)
|
|
588
227
|
}
|
|
589
228
|
|
|
590
|
-
function
|
|
591
|
-
|
|
592
|
-
const highestArity = reduce((a, b) => max(a, b.length), 0, transformers);
|
|
593
|
-
return curryN(highestArity, function () {
|
|
594
|
-
return fn.apply(this, map(g => g.apply(this, arguments), transformers));
|
|
595
|
-
});
|
|
229
|
+
function dropLast(numberItems) {
|
|
230
|
+
return list => (numberItems > 0 ? list.slice(0, -numberItems) : list.slice())
|
|
596
231
|
}
|
|
597
232
|
|
|
598
|
-
function
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
return list.filter(x => predicate(x)).length;
|
|
604
|
-
}
|
|
233
|
+
function dropLastWhile(predicate) {
|
|
234
|
+
return list => {
|
|
235
|
+
if (list.length === 0) {
|
|
236
|
+
return list
|
|
237
|
+
}
|
|
605
238
|
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
} else {
|
|
616
|
-
willReturn[key]++;
|
|
239
|
+
const toReturn = [];
|
|
240
|
+
let counter = list.length;
|
|
241
|
+
|
|
242
|
+
while (counter) {
|
|
243
|
+
const item = list[--counter];
|
|
244
|
+
if (!predicate(item, counter)) {
|
|
245
|
+
toReturn.push(item);
|
|
246
|
+
break
|
|
247
|
+
}
|
|
617
248
|
}
|
|
618
|
-
});
|
|
619
|
-
return willReturn;
|
|
620
|
-
}
|
|
621
249
|
|
|
622
|
-
|
|
250
|
+
while (counter) {
|
|
251
|
+
toReturn.push(list[--counter]);
|
|
252
|
+
}
|
|
623
253
|
|
|
624
|
-
|
|
625
|
-
return input === undefined || input === null || Number.isNaN(input) === true;
|
|
626
|
-
}
|
|
627
|
-
function defaultTo(defaultArgument, input) {
|
|
628
|
-
if (arguments.length === 1) {
|
|
629
|
-
return _input => defaultTo(defaultArgument, _input);
|
|
254
|
+
return toReturn.reverse()
|
|
630
255
|
}
|
|
631
|
-
return isFalsy(input) ? defaultArgument : input;
|
|
632
256
|
}
|
|
633
257
|
|
|
634
|
-
function
|
|
635
|
-
|
|
636
|
-
|
|
258
|
+
function dropWhile(predicate) {
|
|
259
|
+
return iterable => {
|
|
260
|
+
const toReturn = [];
|
|
261
|
+
let counter = 0;
|
|
262
|
+
|
|
263
|
+
while (counter < iterable.length) {
|
|
264
|
+
const item = iterable[counter++];
|
|
265
|
+
if (!predicate(item, counter)) {
|
|
266
|
+
toReturn.push(item);
|
|
267
|
+
break
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
while (counter < iterable.length) {
|
|
272
|
+
toReturn.push(iterable[counter++]);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
return toReturn
|
|
637
276
|
}
|
|
638
|
-
const aValue = getFunction(a);
|
|
639
|
-
const bValue = getFunction(b);
|
|
640
|
-
return createCompareFunction(aValue, bValue, 1, -1);
|
|
641
277
|
}
|
|
642
278
|
|
|
643
279
|
function type(input) {
|
|
644
280
|
if (input === null) {
|
|
645
|
-
return 'Null'
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
281
|
+
return 'Null'
|
|
282
|
+
}
|
|
283
|
+
if (input === undefined) {
|
|
284
|
+
return 'Undefined'
|
|
285
|
+
}
|
|
286
|
+
if (Number.isNaN(input)) {
|
|
287
|
+
return 'NaN'
|
|
650
288
|
}
|
|
651
289
|
const typeResult = Object.prototype.toString.call(input).slice(8, -1);
|
|
652
|
-
return typeResult === 'AsyncFunction' ? 'Promise' : typeResult
|
|
290
|
+
return typeResult === 'AsyncFunction' ? 'Promise' : typeResult
|
|
653
291
|
}
|
|
654
292
|
|
|
655
293
|
function _lastIndexOf(valueToFind, list) {
|
|
656
|
-
if (!isArray(list))
|
|
294
|
+
if (!isArray(list)) {
|
|
295
|
+
throw new Error(`Cannot read property 'indexOf' of ${list}`)
|
|
296
|
+
}
|
|
297
|
+
|
|
657
298
|
const typeOfValue = type(valueToFind);
|
|
658
|
-
if (!['Array', 'NaN', 'Object', 'RegExp'].includes(typeOfValue))
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
299
|
+
if (!['Array', 'NaN', 'Object', 'RegExp'].includes(typeOfValue)) {
|
|
300
|
+
return list.lastIndexOf(valueToFind)
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
const { length } = list;
|
|
662
304
|
let index = length;
|
|
663
305
|
let foundIndex = -1;
|
|
664
|
-
|
|
665
|
-
|
|
306
|
+
|
|
307
|
+
while (--index > -1 && foundIndex === -1) {
|
|
308
|
+
if (equalsFn(list[index], valueToFind)) {
|
|
309
|
+
foundIndex = index;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
return foundIndex
|
|
666
314
|
}
|
|
315
|
+
|
|
667
316
|
function _indexOf(valueToFind, list) {
|
|
668
|
-
if (!isArray(list))
|
|
317
|
+
if (!isArray(list)) {
|
|
318
|
+
throw new Error(`Cannot read property 'indexOf' of ${list}`)
|
|
319
|
+
}
|
|
320
|
+
|
|
669
321
|
const typeOfValue = type(valueToFind);
|
|
670
|
-
if (!['Array', 'NaN', 'Object', 'RegExp'].includes(typeOfValue))
|
|
322
|
+
if (!['Array', 'NaN', 'Object', 'RegExp'].includes(typeOfValue)) {
|
|
323
|
+
return list.indexOf(valueToFind)
|
|
324
|
+
}
|
|
325
|
+
|
|
671
326
|
let index = -1;
|
|
672
327
|
let foundIndex = -1;
|
|
673
|
-
const {
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
328
|
+
const { length } = list;
|
|
329
|
+
|
|
330
|
+
while (++index < length && foundIndex === -1) {
|
|
331
|
+
if (equalsFn(list[index], valueToFind)) {
|
|
332
|
+
foundIndex = index;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
return foundIndex
|
|
678
337
|
}
|
|
338
|
+
|
|
679
339
|
function _arrayFromIterator(iter) {
|
|
680
340
|
const list = [];
|
|
681
341
|
let next;
|
|
682
|
-
while (!(next = iter.next()).done)
|
|
683
|
-
|
|
342
|
+
while (!(next = iter.next()).done) {
|
|
343
|
+
list.push(next.value);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
return list
|
|
684
347
|
}
|
|
348
|
+
|
|
685
349
|
function _compareSets(a, b) {
|
|
686
|
-
if (a.size !== b.size)
|
|
350
|
+
if (a.size !== b.size) {
|
|
351
|
+
return false
|
|
352
|
+
}
|
|
353
|
+
|
|
687
354
|
const aList = _arrayFromIterator(a.values());
|
|
688
355
|
const bList = _arrayFromIterator(b.values());
|
|
356
|
+
|
|
689
357
|
const filtered = aList.filter(aInstance => _indexOf(aInstance, bList) === -1);
|
|
690
|
-
|
|
358
|
+
|
|
359
|
+
return filtered.length === 0
|
|
691
360
|
}
|
|
361
|
+
|
|
692
362
|
function compareErrors(a, b) {
|
|
693
|
-
if (a.message !== b.message)
|
|
694
|
-
|
|
695
|
-
return a.toString() === b.toString();
|
|
696
|
-
}
|
|
697
|
-
function parseDate(maybeDate) {
|
|
698
|
-
if (!maybeDate.toDateString) return [false];
|
|
699
|
-
return [true, maybeDate.getTime()];
|
|
700
|
-
}
|
|
701
|
-
function parseRegex(maybeRegex) {
|
|
702
|
-
if (maybeRegex.constructor !== RegExp) return [false];
|
|
703
|
-
return [true, maybeRegex.toString()];
|
|
704
|
-
}
|
|
705
|
-
function equals(a, b) {
|
|
706
|
-
if (arguments.length === 1) return _b => equals(a, _b);
|
|
707
|
-
if (Object.is(a, b)) return true;
|
|
708
|
-
const aType = type(a);
|
|
709
|
-
if (aType !== type(b)) return false;
|
|
710
|
-
if (aType === 'Function') return a.name === undefined ? false : a.name === b.name;
|
|
711
|
-
if (['NaN', 'Null', 'Undefined'].includes(aType)) return true;
|
|
712
|
-
if (['BigInt', 'Number'].includes(aType)) {
|
|
713
|
-
if (Object.is(-0, a) !== Object.is(-0, b)) return false;
|
|
714
|
-
return a.toString() === b.toString();
|
|
715
|
-
}
|
|
716
|
-
if (['Boolean', 'String'].includes(aType)) return a.toString() === b.toString();
|
|
717
|
-
if (aType === 'Array') {
|
|
718
|
-
const aClone = Array.from(a);
|
|
719
|
-
const bClone = Array.from(b);
|
|
720
|
-
if (aClone.toString() !== bClone.toString()) return false;
|
|
721
|
-
let loopArrayFlag = true;
|
|
722
|
-
aClone.forEach((aCloneInstance, aCloneIndex) => {
|
|
723
|
-
if (loopArrayFlag) if (aCloneInstance !== bClone[aCloneIndex] && !equals(aCloneInstance, bClone[aCloneIndex])) loopArrayFlag = false;
|
|
724
|
-
});
|
|
725
|
-
return loopArrayFlag;
|
|
363
|
+
if (a.message !== b.message) {
|
|
364
|
+
return false
|
|
726
365
|
}
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
if (aRegex[0]) return bRegex[0] ? aRegex[1] === bRegex[1] : false;else if (bRegex[0]) return false;
|
|
730
|
-
const aDate = parseDate(a);
|
|
731
|
-
const bDate = parseDate(b);
|
|
732
|
-
if (aDate[0]) return bDate[0] ? aDate[1] === bDate[1] : false;else if (bDate[0]) return false;
|
|
733
|
-
if (a instanceof Error) {
|
|
734
|
-
if (!(b instanceof Error)) return false;
|
|
735
|
-
return compareErrors(a, b);
|
|
366
|
+
if (a.toString !== b.toString) {
|
|
367
|
+
return false
|
|
736
368
|
}
|
|
737
|
-
if (aType === 'Set') return _compareSets(a, b);
|
|
738
|
-
if (aType === 'Object') {
|
|
739
|
-
const aKeys = Object.keys(a);
|
|
740
|
-
if (aKeys.length !== Object.keys(b).length) return false;
|
|
741
|
-
let loopObjectFlag = true;
|
|
742
|
-
aKeys.forEach(aKeyInstance => {
|
|
743
|
-
if (loopObjectFlag) {
|
|
744
|
-
const aValue = a[aKeyInstance];
|
|
745
|
-
const bValue = b[aKeyInstance];
|
|
746
|
-
if (aValue !== bValue && !equals(aValue, bValue)) loopObjectFlag = false;
|
|
747
|
-
}
|
|
748
|
-
});
|
|
749
|
-
return loopObjectFlag;
|
|
750
|
-
}
|
|
751
|
-
return false;
|
|
752
|
-
}
|
|
753
369
|
|
|
754
|
-
|
|
755
|
-
if (arguments.length === 1) return _iterable => includes$1(valueToFind, _iterable);
|
|
756
|
-
if (typeof iterable === 'string') {
|
|
757
|
-
return iterable.includes(valueToFind);
|
|
758
|
-
}
|
|
759
|
-
if (!iterable) {
|
|
760
|
-
throw new TypeError(`Cannot read property \'indexOf\' of ${iterable}`);
|
|
761
|
-
}
|
|
762
|
-
if (!isArray(iterable)) return false;
|
|
763
|
-
return _indexOf(valueToFind, iterable) > -1;
|
|
370
|
+
return a.toString() === b.toString()
|
|
764
371
|
}
|
|
765
372
|
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
this.items = {};
|
|
770
|
-
}
|
|
771
|
-
checkUniqueness(item) {
|
|
772
|
-
const type$1 = type(item);
|
|
773
|
-
if (['Null', 'Undefined', 'NaN'].includes(type$1)) {
|
|
774
|
-
if (type$1 in this.items) {
|
|
775
|
-
return false;
|
|
776
|
-
}
|
|
777
|
-
this.items[type$1] = true;
|
|
778
|
-
return true;
|
|
779
|
-
}
|
|
780
|
-
if (!['Object', 'Array'].includes(type$1)) {
|
|
781
|
-
const prevSize = this.set.size;
|
|
782
|
-
this.set.add(item);
|
|
783
|
-
return this.set.size !== prevSize;
|
|
784
|
-
}
|
|
785
|
-
if (!(type$1 in this.items)) {
|
|
786
|
-
this.items[type$1] = [item];
|
|
787
|
-
return true;
|
|
788
|
-
}
|
|
789
|
-
if (_indexOf(item, this.items[type$1]) === -1) {
|
|
790
|
-
this.items[type$1].push(item);
|
|
791
|
-
return true;
|
|
792
|
-
}
|
|
793
|
-
return false;
|
|
373
|
+
function parseDate(maybeDate) {
|
|
374
|
+
if (!maybeDate.toDateString) {
|
|
375
|
+
return [false]
|
|
794
376
|
}
|
|
795
|
-
}
|
|
796
377
|
|
|
797
|
-
|
|
798
|
-
const set = new _Set();
|
|
799
|
-
const willReturn = [];
|
|
800
|
-
list.forEach(item => {
|
|
801
|
-
if (set.checkUniqueness(item)) {
|
|
802
|
-
willReturn.push(item);
|
|
803
|
-
}
|
|
804
|
-
});
|
|
805
|
-
return willReturn;
|
|
806
|
-
}
|
|
807
|
-
|
|
808
|
-
function difference(a, b) {
|
|
809
|
-
if (arguments.length === 1) return _b => difference(a, _b);
|
|
810
|
-
return uniq(a).filter(aInstance => !includes$1(aInstance, b));
|
|
378
|
+
return [true, maybeDate.getTime()]
|
|
811
379
|
}
|
|
812
380
|
|
|
813
|
-
function
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
first.forEach(item => {
|
|
817
|
-
const hasItem = second.some(secondItem => fn(item, secondItem));
|
|
818
|
-
if (!hasItem && _indexOf(item, willReturn) === -1) {
|
|
819
|
-
willReturn.push(item);
|
|
820
|
-
}
|
|
821
|
-
});
|
|
822
|
-
return willReturn;
|
|
823
|
-
}
|
|
824
|
-
const differenceWith = curry(differenceWithFn);
|
|
825
|
-
|
|
826
|
-
function dissoc(prop, obj) {
|
|
827
|
-
if (arguments.length === 1) return _obj => dissoc(prop, _obj);
|
|
828
|
-
if (obj === null || obj === undefined) return {};
|
|
829
|
-
const willReturn = {};
|
|
830
|
-
for (const p in obj) {
|
|
831
|
-
willReturn[p] = obj[p];
|
|
832
|
-
}
|
|
833
|
-
delete willReturn[prop];
|
|
834
|
-
return willReturn;
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
function _defineProperty(e, r, t) {
|
|
838
|
-
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
839
|
-
value: t,
|
|
840
|
-
enumerable: !0,
|
|
841
|
-
configurable: !0,
|
|
842
|
-
writable: !0
|
|
843
|
-
}) : e[r] = t, e;
|
|
844
|
-
}
|
|
845
|
-
function ownKeys(e, r) {
|
|
846
|
-
var t = Object.keys(e);
|
|
847
|
-
if (Object.getOwnPropertySymbols) {
|
|
848
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
849
|
-
r && (o = o.filter(function (r) {
|
|
850
|
-
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
851
|
-
})), t.push.apply(t, o);
|
|
852
|
-
}
|
|
853
|
-
return t;
|
|
854
|
-
}
|
|
855
|
-
function _objectSpread2(e) {
|
|
856
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
857
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
858
|
-
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
|
|
859
|
-
_defineProperty(e, r, t[r]);
|
|
860
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
861
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
862
|
-
});
|
|
381
|
+
function parseRegex(maybeRegex) {
|
|
382
|
+
if (maybeRegex.constructor !== RegExp) {
|
|
383
|
+
return [false]
|
|
863
384
|
}
|
|
864
|
-
|
|
385
|
+
|
|
386
|
+
return [true, maybeRegex.toString()]
|
|
865
387
|
}
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
var i = e.call(t, r || "default");
|
|
871
|
-
if ("object" != typeof i) return i;
|
|
872
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
388
|
+
|
|
389
|
+
function equalsFn(a, b) {
|
|
390
|
+
if (Object.is(a, b)) {
|
|
391
|
+
return true
|
|
873
392
|
}
|
|
874
|
-
return ("string" === r ? String : Number)(t);
|
|
875
|
-
}
|
|
876
|
-
function _toPropertyKey(t) {
|
|
877
|
-
var i = _toPrimitive(t, "string");
|
|
878
|
-
return "symbol" == typeof i ? i : i + "";
|
|
879
|
-
}
|
|
880
393
|
|
|
881
|
-
|
|
882
|
-
return String(a) === String(b);
|
|
883
|
-
}
|
|
394
|
+
const aType = type(a);
|
|
884
395
|
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
return false;
|
|
892
|
-
}
|
|
396
|
+
if (aType !== type(b)) {
|
|
397
|
+
return false
|
|
398
|
+
}
|
|
399
|
+
if (aType === 'Function') {
|
|
400
|
+
return a.name === undefined ? false : a.name === b.name
|
|
401
|
+
}
|
|
893
402
|
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
const propsToOmitValue = createPath(propsToOmit, ',');
|
|
898
|
-
const willReturn = {};
|
|
899
|
-
for (const key in obj) if (!includes(key, propsToOmitValue)) willReturn[key] = obj[key];
|
|
900
|
-
return willReturn;
|
|
901
|
-
}
|
|
403
|
+
if (['NaN', 'Null', 'Undefined'].includes(aType)) {
|
|
404
|
+
return true
|
|
405
|
+
}
|
|
902
406
|
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
const pathArrValue = createPath(pathInput);
|
|
907
|
-
while (counter < pathArrValue.length) {
|
|
908
|
-
if (willReturn === null || willReturn === undefined) {
|
|
909
|
-
return undefined;
|
|
407
|
+
if (['BigInt', 'Number'].includes(aType)) {
|
|
408
|
+
if (Object.is(-0, a) !== Object.is(-0, b)) {
|
|
409
|
+
return false
|
|
910
410
|
}
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
counter++;
|
|
411
|
+
|
|
412
|
+
return a.toString() === b.toString()
|
|
914
413
|
}
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
if (arguments.length === 1) return _obj => path(pathInput, _obj);
|
|
919
|
-
if (obj === null || obj === undefined) {
|
|
920
|
-
return undefined;
|
|
414
|
+
|
|
415
|
+
if (['Boolean', 'String'].includes(aType)) {
|
|
416
|
+
return a.toString() === b.toString()
|
|
921
417
|
}
|
|
922
|
-
return pathFn(pathInput, obj);
|
|
923
|
-
}
|
|
924
418
|
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
if (index >= list.length - 1) return list.slice(0, list.length - 1);
|
|
929
|
-
return [...list.slice(0, index), ...list.slice(index + 1)];
|
|
930
|
-
}
|
|
419
|
+
if (aType === 'Array') {
|
|
420
|
+
const aClone = Array.from(a);
|
|
421
|
+
const bClone = Array.from(b);
|
|
931
422
|
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
return clone.fill(newValue, index, index + 1);
|
|
936
|
-
}
|
|
937
|
-
const update = curry(updateFn);
|
|
423
|
+
if (aClone.toString() !== bClone.toString()) {
|
|
424
|
+
return false
|
|
425
|
+
}
|
|
938
426
|
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
const nextPathInput = Array.prototype.slice.call(pathArrValue, 1);
|
|
950
|
-
const intermediateResult = dissocPath(nextPathInput, nextInput, input);
|
|
951
|
-
if (isArray(input)) return update(index, intermediateResult, input);
|
|
952
|
-
return _objectSpread2(_objectSpread2({}, input), {}, {
|
|
953
|
-
[index]: intermediateResult
|
|
427
|
+
let loopArrayFlag = true;
|
|
428
|
+
aClone.forEach((aCloneInstance, aCloneIndex) => {
|
|
429
|
+
if (loopArrayFlag) {
|
|
430
|
+
if (
|
|
431
|
+
aCloneInstance !== bClone[aCloneIndex] &&
|
|
432
|
+
!equalsFn(aCloneInstance, bClone[aCloneIndex])
|
|
433
|
+
) {
|
|
434
|
+
loopArrayFlag = false;
|
|
435
|
+
}
|
|
436
|
+
}
|
|
954
437
|
});
|
|
955
|
-
}
|
|
956
|
-
if (isArray(input)) return removeIndex(index, input);
|
|
957
|
-
return omit([index], input);
|
|
958
|
-
}
|
|
959
438
|
|
|
960
|
-
|
|
961
|
-
if (arguments.length === 1) return _b => divide(a, _b);
|
|
962
|
-
return a / b;
|
|
963
|
-
}
|
|
964
|
-
|
|
965
|
-
function dropLast(howManyToDrop, listOrString) {
|
|
966
|
-
if (arguments.length === 1) {
|
|
967
|
-
return _listOrString => dropLast(howManyToDrop, _listOrString);
|
|
439
|
+
return loopArrayFlag
|
|
968
440
|
}
|
|
969
|
-
return howManyToDrop > 0 ? listOrString.slice(0, -howManyToDrop) : listOrString.slice();
|
|
970
|
-
}
|
|
971
441
|
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
const isArray$1 = isArray(iterable);
|
|
978
|
-
if (typeof predicate !== 'function') {
|
|
979
|
-
throw new Error(`'predicate' is from wrong type ${typeof predicate}`);
|
|
980
|
-
}
|
|
981
|
-
if (!isArray$1 && typeof iterable !== 'string') {
|
|
982
|
-
throw new Error(`'iterable' is from wrong type ${typeof iterable}`);
|
|
983
|
-
}
|
|
984
|
-
const toReturn = [];
|
|
985
|
-
let counter = iterable.length;
|
|
986
|
-
while (counter) {
|
|
987
|
-
const item = iterable[--counter];
|
|
988
|
-
if (!predicate(item)) {
|
|
989
|
-
toReturn.push(item);
|
|
990
|
-
break;
|
|
991
|
-
}
|
|
442
|
+
const aRegex = parseRegex(a);
|
|
443
|
+
const bRegex = parseRegex(b);
|
|
444
|
+
|
|
445
|
+
if (aRegex[0]) {
|
|
446
|
+
return bRegex[0] ? aRegex[1] === bRegex[1] : false
|
|
992
447
|
}
|
|
993
|
-
|
|
994
|
-
|
|
448
|
+
if (bRegex[0]) {
|
|
449
|
+
return false
|
|
995
450
|
}
|
|
996
|
-
return isArray$1 ? toReturn.reverse() : toReturn.reverse().join('');
|
|
997
|
-
}
|
|
998
451
|
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
throw new Error(`${list} is not a list`);
|
|
1002
|
-
}
|
|
1003
|
-
const toReturn = [];
|
|
1004
|
-
list.reduce((prev, current) => {
|
|
1005
|
-
if (!equals(prev, current)) {
|
|
1006
|
-
toReturn.push(current);
|
|
1007
|
-
}
|
|
1008
|
-
return current;
|
|
1009
|
-
}, undefined);
|
|
1010
|
-
return toReturn;
|
|
1011
|
-
}
|
|
1012
|
-
|
|
1013
|
-
function dropRepeatsBy(fn, list) {
|
|
1014
|
-
if (arguments.length === 1) return _list => dropRepeatsBy(fn, _list);
|
|
1015
|
-
let lastEvaluated = null;
|
|
1016
|
-
return list.slice().filter(item => {
|
|
1017
|
-
if (lastEvaluated === null) {
|
|
1018
|
-
lastEvaluated = fn(item);
|
|
1019
|
-
return true;
|
|
1020
|
-
}
|
|
1021
|
-
const evaluatedResult = fn(item);
|
|
1022
|
-
if (equals(lastEvaluated, evaluatedResult)) return false;
|
|
1023
|
-
lastEvaluated = evaluatedResult;
|
|
1024
|
-
return true;
|
|
1025
|
-
});
|
|
1026
|
-
}
|
|
452
|
+
const aDate = parseDate(a);
|
|
453
|
+
const bDate = parseDate(b);
|
|
1027
454
|
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
return _iterable => dropRepeatsWith(predicate, _iterable);
|
|
455
|
+
if (aDate[0]) {
|
|
456
|
+
return bDate[0] ? aDate[1] === bDate[1] : false
|
|
1031
457
|
}
|
|
1032
|
-
if (
|
|
1033
|
-
|
|
458
|
+
if (bDate[0]) {
|
|
459
|
+
return false
|
|
1034
460
|
}
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
if (
|
|
1038
|
-
|
|
1039
|
-
return current;
|
|
1040
|
-
}
|
|
1041
|
-
if (!predicate(prev, current)) {
|
|
1042
|
-
toReturn.push(current);
|
|
461
|
+
|
|
462
|
+
if (a instanceof Error) {
|
|
463
|
+
if (!(b instanceof Error)) {
|
|
464
|
+
return false
|
|
1043
465
|
}
|
|
1044
|
-
return current;
|
|
1045
|
-
}, undefined);
|
|
1046
|
-
return toReturn;
|
|
1047
|
-
}
|
|
1048
466
|
|
|
1049
|
-
|
|
1050
|
-
if (arguments.length === 1) {
|
|
1051
|
-
return _iterable => dropWhile(predicate, _iterable);
|
|
467
|
+
return compareErrors(a, b)
|
|
1052
468
|
}
|
|
1053
|
-
|
|
1054
|
-
if (
|
|
1055
|
-
|
|
469
|
+
|
|
470
|
+
if (aType === 'Set') {
|
|
471
|
+
return _compareSets(a, b)
|
|
1056
472
|
}
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
if (
|
|
1062
|
-
|
|
1063
|
-
break;
|
|
473
|
+
|
|
474
|
+
if (aType === 'Object') {
|
|
475
|
+
const aKeys = Object.keys(a);
|
|
476
|
+
|
|
477
|
+
if (aKeys.length !== Object.keys(b).length) {
|
|
478
|
+
return false
|
|
1064
479
|
}
|
|
1065
|
-
}
|
|
1066
|
-
while (counter < iterable.length) {
|
|
1067
|
-
toReturn.push(iterable[counter++]);
|
|
1068
|
-
}
|
|
1069
|
-
return isArray$1 ? toReturn : toReturn.join('');
|
|
1070
|
-
}
|
|
1071
480
|
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
481
|
+
let loopObjectFlag = true;
|
|
482
|
+
aKeys.forEach(aKeyInstance => {
|
|
483
|
+
if (loopObjectFlag) {
|
|
484
|
+
const aValue = a[aKeyInstance];
|
|
485
|
+
const bValue = b[aKeyInstance];
|
|
486
|
+
|
|
487
|
+
if (aValue !== bValue && !equalsFn(aValue, bValue)) {
|
|
488
|
+
loopObjectFlag = false;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
});
|
|
1078
492
|
|
|
1079
|
-
|
|
1080
|
-
if (typeof list === 'string') return '';
|
|
1081
|
-
if (Array.isArray(list)) {
|
|
1082
|
-
const {
|
|
1083
|
-
name
|
|
1084
|
-
} = list.constructor;
|
|
1085
|
-
if (name === 'Uint8Array') return Uint8Array.from('');
|
|
1086
|
-
if (name === 'Float32Array') return new Float32Array([]);
|
|
1087
|
-
return [];
|
|
493
|
+
return loopObjectFlag
|
|
1088
494
|
}
|
|
1089
|
-
if (type(list) === 'Object') return {};
|
|
1090
|
-
}
|
|
1091
495
|
|
|
1092
|
-
|
|
1093
|
-
if (arguments.length === 1) return _iterable => endsWith(target, _iterable);
|
|
1094
|
-
if (typeof iterable === 'string') {
|
|
1095
|
-
return iterable.endsWith(target);
|
|
1096
|
-
}
|
|
1097
|
-
if (!isArray(target)) return false;
|
|
1098
|
-
const diff = iterable.length - target.length;
|
|
1099
|
-
let correct = true;
|
|
1100
|
-
const filtered = target.filter((x, index) => {
|
|
1101
|
-
if (!correct) return false;
|
|
1102
|
-
const result = equals(x, iterable[index + diff]);
|
|
1103
|
-
if (!result) correct = false;
|
|
1104
|
-
return result;
|
|
1105
|
-
});
|
|
1106
|
-
return filtered.length === target.length;
|
|
496
|
+
return false
|
|
1107
497
|
}
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
return equals(fn(a), fn(b));
|
|
498
|
+
function equals(a) {
|
|
499
|
+
return b => equalsFn(a, b)
|
|
1111
500
|
}
|
|
1112
|
-
const eqBy = curry(eqByFn);
|
|
1113
501
|
|
|
1114
|
-
function
|
|
1115
|
-
|
|
1116
|
-
return obj[searchProperty];
|
|
1117
|
-
}
|
|
1118
|
-
function prop(searchProperty, obj) {
|
|
1119
|
-
if (arguments.length === 1) return _obj => prop(searchProperty, _obj);
|
|
1120
|
-
return propFn(searchProperty, obj);
|
|
502
|
+
function eqBy(fn, a) {
|
|
503
|
+
return b => equalsFn(fn(a), fn(b))
|
|
1121
504
|
}
|
|
1122
505
|
|
|
1123
|
-
function
|
|
1124
|
-
return
|
|
506
|
+
function eqProps(property, objA) {
|
|
507
|
+
return objB => equalsFn( objA[property], objB[property] )
|
|
1125
508
|
}
|
|
1126
|
-
const eqProps = curry(eqPropsFn);
|
|
1127
509
|
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
}
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
return rules[prop](x);
|
|
1142
|
-
}
|
|
1143
|
-
if (typeRule === 'Object') {
|
|
1144
|
-
return evolve(rules[prop], x);
|
|
1145
|
-
}
|
|
1146
|
-
return x;
|
|
1147
|
-
}
|
|
1148
|
-
if (type(rules[prop]) === 'Function') {
|
|
1149
|
-
return rules[prop](x);
|
|
510
|
+
const { keys } = Object;
|
|
511
|
+
|
|
512
|
+
function mapObject(fn) {
|
|
513
|
+
return obj => {
|
|
514
|
+
let index = 0;
|
|
515
|
+
const objKeys = keys(obj);
|
|
516
|
+
const len = objKeys.length;
|
|
517
|
+
const willReturn = {};
|
|
518
|
+
|
|
519
|
+
while (index < len) {
|
|
520
|
+
const key = objKeys[index];
|
|
521
|
+
willReturn[key] = fn(obj[key], key, obj);
|
|
522
|
+
index++;
|
|
1150
523
|
}
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
}
|
|
1154
|
-
function evolve(rules, iterable) {
|
|
1155
|
-
if (arguments.length === 1) {
|
|
1156
|
-
return _iterable => evolve(rules, _iterable);
|
|
1157
|
-
}
|
|
1158
|
-
const rulesType = type(rules);
|
|
1159
|
-
const iterableType = type(iterable);
|
|
1160
|
-
if (iterableType !== rulesType) {
|
|
1161
|
-
throw new Error('iterableType !== rulesType');
|
|
1162
|
-
}
|
|
1163
|
-
if (!['Object', 'Array'].includes(rulesType)) {
|
|
1164
|
-
throw new Error(`'iterable' and 'rules' are from wrong type ${rulesType}`);
|
|
1165
|
-
}
|
|
1166
|
-
if (iterableType === 'Object') {
|
|
1167
|
-
return evolveObject(rules, iterable);
|
|
524
|
+
|
|
525
|
+
return willReturn
|
|
1168
526
|
}
|
|
1169
|
-
return evolveArray(rules, iterable);
|
|
1170
527
|
}
|
|
1171
528
|
|
|
1172
|
-
function
|
|
1173
|
-
|
|
1174
|
-
for (const prop in obj) {
|
|
1175
|
-
if (predicate(obj[prop], prop, obj)) {
|
|
1176
|
-
willReturn[prop] = obj[prop];
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
return willReturn;
|
|
529
|
+
function evolve(rules) {
|
|
530
|
+
return mapObject((x, prop) => type(rules[prop]) === 'Function' ? rules[prop](x): x)
|
|
1180
531
|
}
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
const predicateResult = indexed ? predicate(list[index], index) : predicate(list[index]);
|
|
1187
|
-
if (predicateResult) {
|
|
1188
|
-
willReturn.push(list[index]);
|
|
532
|
+
|
|
533
|
+
function includes(valueToFind) {
|
|
534
|
+
return iterable => {
|
|
535
|
+
if (typeof iterable === 'string') {
|
|
536
|
+
return iterable.includes(valueToFind)
|
|
1189
537
|
}
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
538
|
+
if (!iterable) {
|
|
539
|
+
throw new TypeError(`Cannot read property \'indexOf\' of ${iterable}`)
|
|
540
|
+
}
|
|
541
|
+
if (!isArray(iterable)) {
|
|
542
|
+
return false
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
return _indexOf(valueToFind, iterable) > -1
|
|
1198
546
|
}
|
|
1199
|
-
if (isArray(iterable)) return filterArray(predicate, iterable, false);
|
|
1200
|
-
return filterObject(predicate, iterable);
|
|
1201
547
|
}
|
|
1202
548
|
|
|
1203
|
-
function
|
|
1204
|
-
|
|
1205
|
-
let index = 0;
|
|
1206
|
-
const len = list.length;
|
|
1207
|
-
while (index < len) {
|
|
1208
|
-
const x = list[index];
|
|
1209
|
-
if (predicate(x)) {
|
|
1210
|
-
return x;
|
|
1211
|
-
}
|
|
1212
|
-
index++;
|
|
1213
|
-
}
|
|
549
|
+
function excludes(valueToFind) {
|
|
550
|
+
return iterable => !includes(valueToFind)(iterable)
|
|
1214
551
|
}
|
|
1215
552
|
|
|
1216
|
-
function
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
553
|
+
function filterObject(predicate) {
|
|
554
|
+
return obj => {
|
|
555
|
+
const willReturn = {};
|
|
556
|
+
|
|
557
|
+
for (const prop in obj) {
|
|
558
|
+
if (predicate(obj[prop], prop, obj)) {
|
|
559
|
+
willReturn[prop] = obj[prop];
|
|
560
|
+
}
|
|
1223
561
|
}
|
|
562
|
+
|
|
563
|
+
return willReturn
|
|
1224
564
|
}
|
|
1225
|
-
return -1;
|
|
1226
565
|
}
|
|
1227
566
|
|
|
1228
|
-
function
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
567
|
+
function find(predicate) {
|
|
568
|
+
return list => {
|
|
569
|
+
let index = 0;
|
|
570
|
+
const len = list.length;
|
|
571
|
+
|
|
572
|
+
while (index < len) {
|
|
573
|
+
const x = list[index];
|
|
574
|
+
if (predicate(x)) {
|
|
575
|
+
return x
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
index++;
|
|
1234
579
|
}
|
|
1235
580
|
}
|
|
1236
|
-
return undefined;
|
|
1237
581
|
}
|
|
1238
582
|
|
|
1239
|
-
function
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
583
|
+
function findIndex(predicate) {
|
|
584
|
+
return list => {
|
|
585
|
+
const len = list.length;
|
|
586
|
+
let index = -1;
|
|
587
|
+
|
|
588
|
+
while (++index < len) {
|
|
589
|
+
if (predicate(list[index])) {
|
|
590
|
+
return index
|
|
591
|
+
}
|
|
1245
592
|
}
|
|
593
|
+
|
|
594
|
+
return -1
|
|
1246
595
|
}
|
|
1247
|
-
return -1;
|
|
1248
596
|
}
|
|
1249
597
|
|
|
1250
|
-
function
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
598
|
+
function findLast(predicate) {
|
|
599
|
+
return list => {
|
|
600
|
+
let index = list.length;
|
|
601
|
+
|
|
602
|
+
while (--index >= 0) {
|
|
603
|
+
if (predicate(list[index])) {
|
|
604
|
+
return list[index]
|
|
605
|
+
}
|
|
1257
606
|
}
|
|
607
|
+
|
|
608
|
+
return undefined
|
|
1258
609
|
}
|
|
1259
|
-
return willReturn;
|
|
1260
610
|
}
|
|
1261
611
|
|
|
1262
|
-
function
|
|
1263
|
-
return
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
} else if (input.length === 4) {
|
|
1271
|
-
return fn(input[1], input[0], input[2], input[3]);
|
|
612
|
+
function findLastIndex(fn) {
|
|
613
|
+
return list => {
|
|
614
|
+
let index = list.length;
|
|
615
|
+
|
|
616
|
+
while (--index >= 0) {
|
|
617
|
+
if (fn(list[index])) {
|
|
618
|
+
return index
|
|
619
|
+
}
|
|
1272
620
|
}
|
|
1273
|
-
throw new Error('R.flip doesn\'t work with arity > 4');
|
|
1274
|
-
};
|
|
1275
|
-
}
|
|
1276
|
-
function flip(fn) {
|
|
1277
|
-
return flipFn(fn);
|
|
1278
|
-
}
|
|
1279
621
|
|
|
1280
|
-
|
|
1281
|
-
let index = 0;
|
|
1282
|
-
const listKeys = keys$1(obj);
|
|
1283
|
-
const len = listKeys.length;
|
|
1284
|
-
while (index < len) {
|
|
1285
|
-
const key = listKeys[index];
|
|
1286
|
-
fn(obj[key], key, obj);
|
|
1287
|
-
index++;
|
|
622
|
+
return -1
|
|
1288
623
|
}
|
|
1289
|
-
return obj;
|
|
1290
|
-
}
|
|
1291
|
-
function forEachObjIndexed(fn, list) {
|
|
1292
|
-
if (arguments.length === 1) return _list => forEachObjIndexed(fn, _list);
|
|
1293
|
-
if (list === undefined) return;
|
|
1294
|
-
return forEachObjIndexedFn(fn, list);
|
|
1295
624
|
}
|
|
1296
625
|
|
|
1297
|
-
function
|
|
1298
|
-
|
|
1299
|
-
if (iterable === undefined) return;
|
|
1300
|
-
if (isArray(iterable)) {
|
|
626
|
+
function findNth(predicate, nth) {
|
|
627
|
+
return list => {
|
|
1301
628
|
let index = 0;
|
|
1302
|
-
const len =
|
|
629
|
+
const len = list.length;
|
|
630
|
+
|
|
1303
631
|
while (index < len) {
|
|
1304
|
-
|
|
632
|
+
const x = list[index];
|
|
633
|
+
if (predicate(x)) {
|
|
634
|
+
if (nth === 0) return x
|
|
635
|
+
nth--;
|
|
636
|
+
}
|
|
637
|
+
|
|
1305
638
|
index++;
|
|
1306
639
|
}
|
|
1307
|
-
}
|
|
1308
|
-
return iterable;
|
|
640
|
+
}
|
|
1309
641
|
}
|
|
1310
642
|
|
|
1311
|
-
function
|
|
1312
|
-
|
|
1313
|
-
listOfPairs.forEach(([prop, value]) => toReturn[prop] = value);
|
|
1314
|
-
return toReturn;
|
|
643
|
+
function flatMap(fn) {
|
|
644
|
+
return list => [].concat(...list.map(fn))
|
|
1315
645
|
}
|
|
1316
646
|
|
|
1317
|
-
function
|
|
1318
|
-
|
|
1319
|
-
|
|
647
|
+
function flatten(list, input) {
|
|
648
|
+
const willReturn = input === undefined ? [] : input;
|
|
649
|
+
|
|
1320
650
|
for (let i = 0; i < list.length; i++) {
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
651
|
+
if (isArray(list[i])) {
|
|
652
|
+
flatten(list[i], willReturn);
|
|
653
|
+
} else {
|
|
654
|
+
willReturn.push(list[i]);
|
|
1325
655
|
}
|
|
1326
|
-
result[key].push(item);
|
|
1327
656
|
}
|
|
1328
|
-
return result;
|
|
1329
|
-
}
|
|
1330
|
-
|
|
1331
|
-
function groupWith(compareFn, list) {
|
|
1332
|
-
if (!isArray(list)) throw new TypeError('list.reduce is not a function');
|
|
1333
|
-
const clone = cloneList(list);
|
|
1334
|
-
if (list.length === 1) return [clone];
|
|
1335
|
-
const toReturn = [];
|
|
1336
|
-
let holder = [];
|
|
1337
|
-
clone.reduce((prev, current, i) => {
|
|
1338
|
-
if (i === 0) return current;
|
|
1339
|
-
const okCompare = compareFn(prev, current);
|
|
1340
|
-
const holderIsEmpty = holder.length === 0;
|
|
1341
|
-
const lastCall = i === list.length - 1;
|
|
1342
|
-
if (okCompare) {
|
|
1343
|
-
if (holderIsEmpty) holder.push(prev);
|
|
1344
|
-
holder.push(current);
|
|
1345
|
-
if (lastCall) toReturn.push(holder);
|
|
1346
|
-
return current;
|
|
1347
|
-
}
|
|
1348
|
-
if (holderIsEmpty) {
|
|
1349
|
-
toReturn.push([prev]);
|
|
1350
|
-
if (lastCall) toReturn.push([current]);
|
|
1351
|
-
return current;
|
|
1352
|
-
}
|
|
1353
|
-
toReturn.push(holder);
|
|
1354
|
-
if (lastCall) toReturn.push([current]);
|
|
1355
|
-
holder = [];
|
|
1356
|
-
return current;
|
|
1357
|
-
}, undefined);
|
|
1358
|
-
return toReturn;
|
|
1359
|
-
}
|
|
1360
|
-
|
|
1361
|
-
function gt(a, b) {
|
|
1362
|
-
if (arguments.length === 1) return _b => gt(a, _b);
|
|
1363
|
-
return a > b;
|
|
1364
|
-
}
|
|
1365
657
|
|
|
1366
|
-
|
|
1367
|
-
if (arguments.length === 1) return _b => gte(a, _b);
|
|
1368
|
-
return a >= b;
|
|
658
|
+
return willReturn
|
|
1369
659
|
}
|
|
1370
660
|
|
|
1371
|
-
function
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
661
|
+
function groupByFallback(groupFn, list) {
|
|
662
|
+
const result = {};
|
|
663
|
+
for (let i = 0; i < list.length; i++) {
|
|
664
|
+
const item = list[i];
|
|
665
|
+
const key = groupFn(item);
|
|
1376
666
|
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
}
|
|
1381
|
-
return propFn(searchProperty, obj) !== undefined;
|
|
1382
|
-
}
|
|
667
|
+
if (!result[key]) {
|
|
668
|
+
result[key] = [];
|
|
669
|
+
}
|
|
1383
670
|
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
return objHolder => hasPath(pathInput, objHolder);
|
|
1387
|
-
}
|
|
1388
|
-
return path(pathInput, obj) !== undefined;
|
|
1389
|
-
}
|
|
671
|
+
result[key].push(item);
|
|
672
|
+
}
|
|
1390
673
|
|
|
1391
|
-
|
|
1392
|
-
if (a === b) {
|
|
1393
|
-
return a !== 0 || 1 / a === 1 / b;
|
|
1394
|
-
}
|
|
1395
|
-
return a !== a && b !== b;
|
|
674
|
+
return result
|
|
1396
675
|
}
|
|
1397
|
-
const objectIs = Object.is || _objectIs;
|
|
1398
676
|
|
|
1399
|
-
function identical(a, b) {
|
|
1400
|
-
if (arguments.length === 1) return _b => identical(a, _b);
|
|
1401
|
-
return objectIs(a, b);
|
|
1402
|
-
}
|
|
1403
677
|
|
|
1404
|
-
function
|
|
1405
|
-
return (
|
|
1406
|
-
const conditionResult = typeof condition === 'boolean' ? condition : condition(...input);
|
|
1407
|
-
if (Boolean(conditionResult)) {
|
|
1408
|
-
return onTrue(...input);
|
|
1409
|
-
}
|
|
1410
|
-
return onFalse(...input);
|
|
1411
|
-
};
|
|
678
|
+
function groupBy(groupFn) {
|
|
679
|
+
return iterable => Object.groupBy ? Object.groupBy(iterable,groupFn) : groupByFallback(groupFn, iterable)
|
|
1412
680
|
}
|
|
1413
|
-
const ifElse = curry(ifElseFn);
|
|
1414
681
|
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
const toReturn = {};
|
|
1419
|
-
for (let i = 0; i < list.length; i++) {
|
|
1420
|
-
const item = list[i];
|
|
1421
|
-
toReturn[path(pathInput, item)] = item;
|
|
1422
|
-
}
|
|
1423
|
-
return toReturn;
|
|
1424
|
-
}
|
|
1425
|
-
function indexBy(condition, list) {
|
|
1426
|
-
if (arguments.length === 1) {
|
|
1427
|
-
return _list => indexBy(condition, _list);
|
|
1428
|
-
}
|
|
1429
|
-
if (typeof condition === 'string') {
|
|
1430
|
-
return indexByPath(condition, list);
|
|
1431
|
-
}
|
|
1432
|
-
const toReturn = {};
|
|
1433
|
-
for (let i = 0; i < list.length; i++) {
|
|
1434
|
-
const item = list[i];
|
|
1435
|
-
toReturn[condition(item)] = item;
|
|
682
|
+
function head(listOrString) {
|
|
683
|
+
if (typeof listOrString === 'string') {
|
|
684
|
+
return listOrString[0] || ''
|
|
1436
685
|
}
|
|
1437
|
-
|
|
686
|
+
|
|
687
|
+
return listOrString[0]
|
|
1438
688
|
}
|
|
1439
689
|
|
|
1440
|
-
function indexOf(valueToFind
|
|
1441
|
-
|
|
1442
|
-
return _list => _indexOf(valueToFind, _list);
|
|
1443
|
-
}
|
|
1444
|
-
return _indexOf(valueToFind, list);
|
|
690
|
+
function indexOf(valueToFind) {
|
|
691
|
+
return list => _indexOf(valueToFind, list)
|
|
1445
692
|
}
|
|
1446
693
|
|
|
1447
694
|
function baseSlice(array, start, end) {
|
|
1448
695
|
let index = -1;
|
|
1449
|
-
let {
|
|
1450
|
-
|
|
1451
|
-
} = array;
|
|
696
|
+
let { length } = array;
|
|
697
|
+
|
|
1452
698
|
end = end > length ? length : end;
|
|
1453
699
|
if (end < 0) {
|
|
1454
700
|
end += length;
|
|
1455
701
|
}
|
|
1456
|
-
length = start > end ? 0 : end - start >>> 0;
|
|
702
|
+
length = start > end ? 0 : (end - start) >>> 0;
|
|
1457
703
|
start >>>= 0;
|
|
704
|
+
|
|
1458
705
|
const result = Array(length);
|
|
706
|
+
|
|
1459
707
|
while (++index < length) {
|
|
1460
708
|
result[index] = array[index + start];
|
|
1461
709
|
}
|
|
1462
|
-
|
|
710
|
+
|
|
711
|
+
return result
|
|
1463
712
|
}
|
|
1464
713
|
|
|
1465
|
-
function init(
|
|
1466
|
-
if (typeof
|
|
1467
|
-
|
|
714
|
+
function init(input) {
|
|
715
|
+
if (typeof input === 'string') {
|
|
716
|
+
return input.slice(0, -1)
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
return input.length ? baseSlice(input, 0, -1) : []
|
|
1468
720
|
}
|
|
1469
721
|
|
|
1470
722
|
function _includesWith(pred, x, list) {
|
|
1471
723
|
let idx = 0;
|
|
1472
724
|
const len = list.length;
|
|
725
|
+
|
|
1473
726
|
while (idx < len) {
|
|
1474
|
-
if (pred(x, list[idx]))
|
|
727
|
+
if (pred(x, list[idx])) {
|
|
728
|
+
return true
|
|
729
|
+
}
|
|
730
|
+
|
|
1475
731
|
idx += 1;
|
|
1476
732
|
}
|
|
1477
|
-
|
|
733
|
+
|
|
734
|
+
return false
|
|
1478
735
|
}
|
|
1479
736
|
function _filter(fn, list) {
|
|
1480
737
|
let idx = 0;
|
|
1481
738
|
const len = list.length;
|
|
1482
739
|
const result = [];
|
|
740
|
+
|
|
1483
741
|
while (idx < len) {
|
|
1484
|
-
if (fn(list[idx]))
|
|
742
|
+
if (fn(list[idx])) {
|
|
743
|
+
result[result.length] = list[idx];
|
|
744
|
+
}
|
|
745
|
+
|
|
1485
746
|
idx += 1;
|
|
1486
747
|
}
|
|
1487
|
-
return result;
|
|
1488
|
-
}
|
|
1489
|
-
function innerJoinFn(pred, xs, ys) {
|
|
1490
|
-
return _filter(x => _includesWith(pred, x, ys), xs);
|
|
1491
|
-
}
|
|
1492
|
-
const innerJoin = curry(innerJoinFn);
|
|
1493
748
|
|
|
1494
|
-
|
|
1495
|
-
return [...array.slice(0, indexToInsert), valueToInsert, ...array.slice(indexToInsert)];
|
|
749
|
+
return result
|
|
1496
750
|
}
|
|
1497
|
-
const insert = curry(insertFn);
|
|
1498
751
|
|
|
1499
|
-
function
|
|
1500
|
-
return
|
|
752
|
+
function innerJoin(pred, xs) {
|
|
753
|
+
return ys => _filter(x => _includesWith(pred, x, ys), xs)
|
|
1501
754
|
}
|
|
1502
|
-
const insertAll = curry(insertAllFn);
|
|
1503
755
|
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
return filter(x => includes$1(x, listA), listB);
|
|
1507
|
-
}
|
|
756
|
+
const getOccurrences = input => input.match(/{{\s*.+?\s*}}/g);
|
|
757
|
+
const getOccurrenceProp = occurrence => occurrence.replace(/{{\s*|\s*}}/g, '');
|
|
1508
758
|
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
759
|
+
const replace$1 = ({ inputHolder, prop, replacer }) => {
|
|
760
|
+
const regexBase = `{{${prop}}}`;
|
|
761
|
+
const regex = new RegExp(regexBase, 'g');
|
|
762
|
+
return inputHolder.replace(regex, replacer)
|
|
763
|
+
};
|
|
764
|
+
|
|
765
|
+
function interpolate(input) {
|
|
766
|
+
return templateInput => {
|
|
767
|
+
const occurrences = getOccurrences(input);
|
|
768
|
+
if (occurrences === null) {
|
|
769
|
+
return input
|
|
1519
770
|
}
|
|
771
|
+
let inputHolder = input;
|
|
772
|
+
|
|
773
|
+
for (const occurrence of occurrences) {
|
|
774
|
+
const prop = getOccurrenceProp(occurrence);
|
|
775
|
+
inputHolder = replace$1({
|
|
776
|
+
inputHolder,
|
|
777
|
+
prop,
|
|
778
|
+
replacer: templateInput[prop],
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
return inputHolder
|
|
1520
783
|
}
|
|
1521
|
-
return willReturn;
|
|
1522
784
|
}
|
|
1523
785
|
|
|
1524
|
-
function
|
|
1525
|
-
|
|
1526
|
-
return x != null && x.constructor === targetPrototype || x instanceof targetPrototype;
|
|
786
|
+
function intersection(listA) {
|
|
787
|
+
return listB => filter(x => includes(x)(listA))(listB)
|
|
1527
788
|
}
|
|
1528
789
|
|
|
1529
|
-
function
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
790
|
+
function intersperse(separator) {
|
|
791
|
+
return list => {
|
|
792
|
+
let index = -1;
|
|
793
|
+
const len = list.length;
|
|
794
|
+
const willReturn = [];
|
|
795
|
+
|
|
796
|
+
while (++index < len) {
|
|
797
|
+
if (index === len - 1) {
|
|
798
|
+
willReturn.push(list[index]);
|
|
799
|
+
} else {
|
|
800
|
+
willReturn.push(list[index], separator);
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
return willReturn
|
|
1538
805
|
}
|
|
1539
|
-
return false;
|
|
1540
806
|
}
|
|
1541
807
|
|
|
1542
|
-
function
|
|
1543
|
-
return
|
|
808
|
+
function join(glue) {
|
|
809
|
+
return list => list.join(glue)
|
|
1544
810
|
}
|
|
1545
811
|
|
|
1546
|
-
function
|
|
1547
|
-
|
|
812
|
+
function last(listOrString) {
|
|
813
|
+
if (typeof listOrString === 'string') {
|
|
814
|
+
return listOrString[listOrString.length - 1] || ''
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
return listOrString[listOrString.length - 1]
|
|
1548
818
|
}
|
|
1549
819
|
|
|
1550
|
-
function
|
|
1551
|
-
return
|
|
820
|
+
function lastIndexOf(valueToFind) {
|
|
821
|
+
return list => _lastIndexOf(valueToFind, list)
|
|
1552
822
|
}
|
|
1553
823
|
|
|
1554
|
-
function
|
|
1555
|
-
|
|
1556
|
-
|
|
824
|
+
function map(fn) {
|
|
825
|
+
return list => {
|
|
826
|
+
let index = 0;
|
|
827
|
+
const willReturn = Array(list.length);
|
|
828
|
+
while (index < list.length) {
|
|
829
|
+
willReturn[index] = fn(list[index], index);
|
|
830
|
+
index++;
|
|
831
|
+
}
|
|
832
|
+
return willReturn
|
|
833
|
+
}
|
|
1557
834
|
}
|
|
1558
835
|
|
|
1559
|
-
function
|
|
1560
|
-
return
|
|
836
|
+
function mapAsync(fn) {
|
|
837
|
+
return async list => {
|
|
838
|
+
const willReturn = [];
|
|
839
|
+
let i = 0;
|
|
840
|
+
for (const a of list) {
|
|
841
|
+
willReturn.push(await fn(a, i++));
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
return willReturn
|
|
845
|
+
}
|
|
1561
846
|
}
|
|
1562
847
|
|
|
1563
|
-
function
|
|
1564
|
-
return
|
|
848
|
+
function mapKeys(fn) {
|
|
849
|
+
return obj => {
|
|
850
|
+
const willReturn = {};
|
|
851
|
+
|
|
852
|
+
Object.keys(obj).forEach(key => {
|
|
853
|
+
willReturn[fn(key, obj[key])] = obj[key];
|
|
854
|
+
});
|
|
855
|
+
|
|
856
|
+
return willReturn
|
|
857
|
+
}
|
|
1565
858
|
}
|
|
1566
859
|
|
|
1567
|
-
function
|
|
1568
|
-
|
|
1569
|
-
|
|
860
|
+
function mapObjectAsync(fn) {
|
|
861
|
+
return async obj => {
|
|
862
|
+
const willReturn = {};
|
|
863
|
+
for (const prop in obj) {
|
|
864
|
+
willReturn[prop] = await fn(obj[prop], prop);
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
return willReturn
|
|
1570
868
|
}
|
|
1571
|
-
return listOrString[listOrString.length - 1];
|
|
1572
869
|
}
|
|
1573
870
|
|
|
1574
|
-
function
|
|
1575
|
-
|
|
1576
|
-
return _list => _lastIndexOf(valueToFind, _list);
|
|
1577
|
-
}
|
|
1578
|
-
return _lastIndexOf(valueToFind, list);
|
|
871
|
+
function mapParallelAsync(fn) {
|
|
872
|
+
return async list => Promise.all(list.map((x, i) => fn(x, i)))
|
|
1579
873
|
}
|
|
1580
874
|
|
|
1581
|
-
function
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
875
|
+
function match(pattern) {
|
|
876
|
+
return input => {
|
|
877
|
+
const willReturn = input.match(pattern);
|
|
878
|
+
|
|
879
|
+
return willReturn === null ? [] : willReturn
|
|
880
|
+
}
|
|
1585
881
|
}
|
|
1586
882
|
|
|
1587
|
-
function
|
|
1588
|
-
return
|
|
1589
|
-
return function (target) {
|
|
1590
|
-
return functor(getter(target)).map(focus => setter(focus, target));
|
|
1591
|
-
};
|
|
1592
|
-
};
|
|
883
|
+
function maxBy(compareFn, x) {
|
|
884
|
+
return y => (compareFn(y) > compareFn(x) ? y : x)
|
|
1593
885
|
}
|
|
1594
886
|
|
|
1595
|
-
function
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
return Object.prototype.toString.call(input) === '[object String]' ? input.charAt(idx) : input[idx];
|
|
887
|
+
function merge(target) {
|
|
888
|
+
return objectWithNewProps =>
|
|
889
|
+
Object.assign({}, target || {}, objectWithNewProps || {})
|
|
1599
890
|
}
|
|
1600
891
|
|
|
1601
|
-
function
|
|
1602
|
-
return
|
|
892
|
+
function mergeTypes(x) {
|
|
893
|
+
return x
|
|
1603
894
|
}
|
|
1604
895
|
|
|
1605
|
-
function
|
|
1606
|
-
return
|
|
896
|
+
function minBy(compareFn, x) {
|
|
897
|
+
return y => (compareFn(y) < compareFn(x) ? y : x)
|
|
1607
898
|
}
|
|
1608
899
|
|
|
1609
|
-
function
|
|
1610
|
-
return
|
|
900
|
+
function update(index, newValue) {
|
|
901
|
+
return list => {
|
|
902
|
+
const clone = cloneList$1(list);
|
|
903
|
+
if (index === -1) {
|
|
904
|
+
return clone.fill(newValue, index)
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
return clone.fill(newValue, index, index + 1)
|
|
908
|
+
}
|
|
1611
909
|
}
|
|
1612
910
|
|
|
1613
|
-
function
|
|
1614
|
-
if (
|
|
1615
|
-
|
|
911
|
+
function modifyFn(property, fn, list) {
|
|
912
|
+
if (list[property] === undefined) {
|
|
913
|
+
return list
|
|
914
|
+
}
|
|
915
|
+
if (isArray(list)) {
|
|
916
|
+
return update(property, fn(list[property]))(list)
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
return {
|
|
920
|
+
...list,
|
|
921
|
+
[property]: fn(list[property]),
|
|
922
|
+
}
|
|
1616
923
|
}
|
|
1617
924
|
|
|
1618
|
-
function
|
|
1619
|
-
|
|
1620
|
-
return a <= b;
|
|
925
|
+
function modifyProp(property, fn) {
|
|
926
|
+
return obj => modifyFn(property, fn, obj)
|
|
1621
927
|
}
|
|
1622
928
|
|
|
1623
|
-
function
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
929
|
+
function none(predicate) {
|
|
930
|
+
return list => {
|
|
931
|
+
for (let i = 0; i < list.length; i++) {
|
|
932
|
+
if (predicate(list[i])) {
|
|
933
|
+
return false
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
return true
|
|
938
|
+
}
|
|
1627
939
|
}
|
|
1628
940
|
|
|
1629
|
-
function
|
|
1630
|
-
|
|
1631
|
-
if (!isInteger(x) || !isInteger(y) || y < 1) return NaN;
|
|
1632
|
-
return (x % y + y) % y;
|
|
941
|
+
function objOf(key) {
|
|
942
|
+
return value => ({ [key]: value })
|
|
1633
943
|
}
|
|
1634
944
|
|
|
1635
|
-
function
|
|
1636
|
-
return
|
|
945
|
+
function objectIncludes(condition) {
|
|
946
|
+
return obj => {
|
|
947
|
+
const result = filterObject((conditionValue, conditionProp) =>
|
|
948
|
+
equals(conditionValue)(obj[conditionProp]),
|
|
949
|
+
)(condition);
|
|
950
|
+
|
|
951
|
+
return Object.keys(result).length === Object.keys(condition).length
|
|
952
|
+
}
|
|
1637
953
|
}
|
|
1638
|
-
const maxBy = curry(maxByFn);
|
|
1639
954
|
|
|
1640
|
-
function
|
|
1641
|
-
return
|
|
955
|
+
function createPath(path, delimiter = '.') {
|
|
956
|
+
return typeof path === 'string'
|
|
957
|
+
? path.split(delimiter).map(x => (Number.isInteger(Number(x)) ? Number(x) : x))
|
|
958
|
+
: path
|
|
1642
959
|
}
|
|
1643
960
|
|
|
1644
|
-
function
|
|
1645
|
-
|
|
961
|
+
function _includes(x, list) {
|
|
962
|
+
let index = -1;
|
|
963
|
+
const { length } = list;
|
|
964
|
+
|
|
965
|
+
while (++index < length) {
|
|
966
|
+
if (String(list[index]) === String(x)) {
|
|
967
|
+
return true
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
return false
|
|
1646
972
|
}
|
|
1647
973
|
|
|
1648
|
-
function
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
974
|
+
function omit(propsToOmit) {
|
|
975
|
+
return obj => {
|
|
976
|
+
if (!obj) {
|
|
977
|
+
return undefined
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
const propsToOmitValue = createPath(propsToOmit, ',');
|
|
981
|
+
const willReturn = {};
|
|
982
|
+
|
|
983
|
+
for (const key in obj) {
|
|
984
|
+
if (!_includes(key, propsToOmitValue)) {
|
|
985
|
+
willReturn[key] = obj[key];
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
return willReturn
|
|
990
|
+
}
|
|
1657
991
|
}
|
|
1658
992
|
|
|
1659
|
-
function
|
|
1660
|
-
|
|
1661
|
-
|
|
993
|
+
function partition(predicate) {
|
|
994
|
+
return list => {
|
|
995
|
+
const yes = [];
|
|
996
|
+
const no = [];
|
|
997
|
+
let counter = -1;
|
|
998
|
+
|
|
999
|
+
while (counter++ < list.length - 1) {
|
|
1000
|
+
if (predicate(list[counter], counter)) {
|
|
1001
|
+
yes.push(list[counter]);
|
|
1002
|
+
} else {
|
|
1003
|
+
no.push(list[counter]);
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
return [yes, no]
|
|
1008
|
+
}
|
|
1662
1009
|
}
|
|
1663
1010
|
|
|
1664
|
-
function
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1011
|
+
function partitionObject(predicate) {
|
|
1012
|
+
return obj => {
|
|
1013
|
+
const yes = {};
|
|
1014
|
+
const no = {};
|
|
1015
|
+
Object.entries(obj).forEach(([prop, value]) => {
|
|
1016
|
+
if (predicate(value, prop)) {
|
|
1017
|
+
yes[prop] = value;
|
|
1018
|
+
} else {
|
|
1019
|
+
no[prop] = value;
|
|
1020
|
+
}
|
|
1021
|
+
});
|
|
1022
|
+
|
|
1023
|
+
return [yes, no]
|
|
1024
|
+
}
|
|
1670
1025
|
}
|
|
1671
1026
|
|
|
1672
|
-
function
|
|
1027
|
+
function path(pathInput, obj) {
|
|
1673
1028
|
if (arguments.length === 1) {
|
|
1674
|
-
return
|
|
1029
|
+
return _obj => path(pathInput, _obj)
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
if (!obj) {
|
|
1033
|
+
return undefined
|
|
1034
|
+
}
|
|
1035
|
+
let willReturn = obj;
|
|
1036
|
+
let counter = 0;
|
|
1037
|
+
|
|
1038
|
+
const pathArrValue = createPath(pathInput);
|
|
1039
|
+
|
|
1040
|
+
while (counter < pathArrValue.length) {
|
|
1041
|
+
if (willReturn === null || willReturn === undefined) {
|
|
1042
|
+
return undefined
|
|
1043
|
+
}
|
|
1044
|
+
if (willReturn[pathArrValue[counter]] === null) {
|
|
1045
|
+
return undefined
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
willReturn = willReturn[pathArrValue[counter]];
|
|
1049
|
+
counter++;
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
return willReturn
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
/**
|
|
1056
|
+
* Source:
|
|
1057
|
+
* https://github.com/denoland/std/blob/main/collections/permutations.ts
|
|
1058
|
+
*/
|
|
1059
|
+
function permutations(inputArray) {
|
|
1060
|
+
const result = [];
|
|
1061
|
+
const array = cloneList$1(inputArray);
|
|
1062
|
+
const k = array.length;
|
|
1063
|
+
if (k === 0) {
|
|
1064
|
+
return result;
|
|
1675
1065
|
}
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1066
|
+
|
|
1067
|
+
const c = new Array(k).fill(0);
|
|
1068
|
+
|
|
1069
|
+
result.push([...array]);
|
|
1070
|
+
|
|
1071
|
+
let i = 1;
|
|
1072
|
+
|
|
1073
|
+
while (i < k) {
|
|
1074
|
+
if (c[i] < i) {
|
|
1075
|
+
if (i % 2 === 0) {
|
|
1076
|
+
[array[0], array[i]] = [array[i], array[0]];
|
|
1681
1077
|
} else {
|
|
1682
|
-
|
|
1078
|
+
[array[c[i]], array[i]] = [array[i], array[c[i]]];
|
|
1683
1079
|
}
|
|
1080
|
+
|
|
1081
|
+
result.push([...array]);
|
|
1082
|
+
|
|
1083
|
+
c[i] += 1;
|
|
1084
|
+
i = 1;
|
|
1684
1085
|
} else {
|
|
1685
|
-
|
|
1086
|
+
c[i] = 0;
|
|
1087
|
+
i += 1;
|
|
1686
1088
|
}
|
|
1687
|
-
}
|
|
1688
|
-
return willReturn;
|
|
1689
|
-
}
|
|
1089
|
+
}
|
|
1690
1090
|
|
|
1691
|
-
|
|
1692
|
-
return mergeDeepRight(target, newProps);
|
|
1091
|
+
return result;
|
|
1693
1092
|
}
|
|
1694
1093
|
|
|
1695
|
-
function
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1094
|
+
function pick(propsToPick) {
|
|
1095
|
+
return input => {
|
|
1096
|
+
if (!input === null) {
|
|
1097
|
+
return undefined
|
|
1098
|
+
}
|
|
1099
|
+
const keys = createPath(propsToPick, ',');
|
|
1100
|
+
const willReturn = {};
|
|
1101
|
+
let counter = 0;
|
|
1699
1102
|
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
});
|
|
1707
|
-
Object.keys(b).forEach(key => {
|
|
1708
|
-
if (willReturn[key] !== undefined) return;
|
|
1709
|
-
if (a[key] === undefined) willReturn[key] = b[key];else willReturn[key] = mergeFn(a[key], b[key]);
|
|
1710
|
-
});
|
|
1711
|
-
return willReturn;
|
|
1712
|
-
}
|
|
1713
|
-
const mergeWith = curry(mergeWithFn);
|
|
1103
|
+
while (counter < keys.length) {
|
|
1104
|
+
if (keys[counter] in input) {
|
|
1105
|
+
willReturn[keys[counter]] = input[keys[counter]];
|
|
1106
|
+
}
|
|
1107
|
+
counter++;
|
|
1108
|
+
}
|
|
1714
1109
|
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
return y < x ? y : x;
|
|
1110
|
+
return willReturn
|
|
1111
|
+
}
|
|
1718
1112
|
}
|
|
1719
1113
|
|
|
1720
|
-
function
|
|
1721
|
-
return
|
|
1722
|
-
|
|
1723
|
-
|
|
1114
|
+
function reduce(reducer, acc) {
|
|
1115
|
+
return list => {
|
|
1116
|
+
if (list == null) {
|
|
1117
|
+
return acc
|
|
1118
|
+
}
|
|
1119
|
+
if (!isArray(list)) {
|
|
1120
|
+
throw new TypeError('reduce: list must be array or iterable')
|
|
1121
|
+
}
|
|
1122
|
+
let index = 0;
|
|
1123
|
+
const len = list.length;
|
|
1724
1124
|
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1125
|
+
while (index < len) {
|
|
1126
|
+
acc = reducer(acc, list[index], index, list);
|
|
1127
|
+
index++;
|
|
1128
|
+
}
|
|
1728
1129
|
|
|
1729
|
-
|
|
1730
|
-
if (!isIterable(iterable)) return iterable;
|
|
1731
|
-
if (iterable[property] === undefined) return iterable;
|
|
1732
|
-
if (isArray(iterable)) {
|
|
1733
|
-
return updateFn(property, fn(iterable[property]), iterable);
|
|
1130
|
+
return acc
|
|
1734
1131
|
}
|
|
1735
|
-
return _objectSpread2(_objectSpread2({}, iterable), {}, {
|
|
1736
|
-
[property]: fn(iterable[property])
|
|
1737
|
-
});
|
|
1738
1132
|
}
|
|
1739
|
-
const modify = curry(modifyFn);
|
|
1740
1133
|
|
|
1741
|
-
function
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1134
|
+
function _arity(n, fn) {
|
|
1135
|
+
switch (n) {
|
|
1136
|
+
case 0:
|
|
1137
|
+
return function () {
|
|
1138
|
+
return fn.apply(this, arguments)
|
|
1139
|
+
}
|
|
1140
|
+
case 1:
|
|
1141
|
+
return function (a0) {
|
|
1142
|
+
return fn.apply(this, arguments)
|
|
1143
|
+
}
|
|
1144
|
+
case 2:
|
|
1145
|
+
return function (a0, a1) {
|
|
1146
|
+
return fn.apply(this, arguments)
|
|
1147
|
+
}
|
|
1148
|
+
case 3:
|
|
1149
|
+
return function (a0, a1, a2) {
|
|
1150
|
+
return fn.apply(this, arguments)
|
|
1151
|
+
}
|
|
1152
|
+
case 4:
|
|
1153
|
+
return function (a0, a1, a2, a3) {
|
|
1154
|
+
return fn.apply(this, arguments)
|
|
1155
|
+
}
|
|
1156
|
+
case 5:
|
|
1157
|
+
return function (a0, a1, a2, a3, a4) {
|
|
1158
|
+
return fn.apply(this, arguments)
|
|
1159
|
+
}
|
|
1160
|
+
case 6:
|
|
1161
|
+
return function (a0, a1, a2, a3, a4, a5) {
|
|
1162
|
+
return fn.apply(this, arguments)
|
|
1163
|
+
}
|
|
1164
|
+
case 7:
|
|
1165
|
+
return function (a0, a1, a2, a3, a4, a5, a6) {
|
|
1166
|
+
return fn.apply(this, arguments)
|
|
1167
|
+
}
|
|
1168
|
+
case 8:
|
|
1169
|
+
return function (a0, a1, a2, a3, a4, a5, a6, a7) {
|
|
1170
|
+
return fn.apply(this, arguments)
|
|
1171
|
+
}
|
|
1172
|
+
case 9:
|
|
1173
|
+
return function (a0, a1, a2, a3, a4, a5, a6, a7, a8) {
|
|
1174
|
+
return fn.apply(this, arguments)
|
|
1175
|
+
}
|
|
1176
|
+
case 10:
|
|
1177
|
+
return function (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) {
|
|
1178
|
+
return fn.apply(this, arguments)
|
|
1179
|
+
}
|
|
1180
|
+
default:
|
|
1181
|
+
throw new Error(
|
|
1182
|
+
'First argument to _arity must be a non-negative integer no greater than ten',
|
|
1183
|
+
)
|
|
1752
1184
|
}
|
|
1753
|
-
return assoc(path$1[0], val, object);
|
|
1754
1185
|
}
|
|
1755
|
-
const modifyPath = curry(modifyPathFn);
|
|
1756
1186
|
|
|
1757
|
-
function
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
}
|
|
1761
|
-
|
|
1762
|
-
function moveFn(fromIndex, toIndex, list) {
|
|
1763
|
-
if (fromIndex < 0 || toIndex < 0) {
|
|
1764
|
-
throw new Error('Rambda.move does not support negative indexes');
|
|
1187
|
+
function _pipe(f, g) {
|
|
1188
|
+
return function () {
|
|
1189
|
+
return g.call(this, f.apply(this, arguments))
|
|
1765
1190
|
}
|
|
1766
|
-
if (fromIndex > list.length - 1 || toIndex > list.length - 1) return list;
|
|
1767
|
-
const clone = cloneList(list);
|
|
1768
|
-
clone[fromIndex] = list[toIndex];
|
|
1769
|
-
clone[toIndex] = list[fromIndex];
|
|
1770
|
-
return clone;
|
|
1771
1191
|
}
|
|
1772
|
-
const move = curry(moveFn);
|
|
1773
1192
|
|
|
1774
|
-
function
|
|
1775
|
-
if (arguments.length ===
|
|
1776
|
-
|
|
1777
|
-
}
|
|
1193
|
+
function pipeFn() {
|
|
1194
|
+
if (arguments.length === 0) {
|
|
1195
|
+
throw new Error('pipe requires at least one argument')
|
|
1196
|
+
}
|
|
1778
1197
|
|
|
1779
|
-
|
|
1780
|
-
|
|
1198
|
+
return _arity(
|
|
1199
|
+
arguments[0].length,
|
|
1200
|
+
reduce(
|
|
1201
|
+
_pipe,
|
|
1202
|
+
arguments[0],
|
|
1203
|
+
)(Array.prototype.slice.call(arguments, 1, Number.POSITIVE_INFINITY)),
|
|
1204
|
+
)
|
|
1781
1205
|
}
|
|
1782
1206
|
|
|
1783
|
-
function
|
|
1784
|
-
|
|
1785
|
-
for (let i = 0; i < list.length; i++) {
|
|
1786
|
-
if (predicate(list[i])) return false;
|
|
1787
|
-
}
|
|
1788
|
-
return true;
|
|
1789
|
-
}
|
|
1207
|
+
function pipe(...inputs) {
|
|
1208
|
+
const [input, ...fnList] = inputs;
|
|
1790
1209
|
|
|
1791
|
-
|
|
1792
|
-
return !input;
|
|
1210
|
+
return pipeFn(...fnList)(input)
|
|
1793
1211
|
}
|
|
1794
1212
|
|
|
1795
|
-
function
|
|
1796
|
-
|
|
1797
|
-
|
|
1213
|
+
async function pipeAsync(input, ...fnList) {
|
|
1214
|
+
let willReturn = input;
|
|
1215
|
+
for (const fn of fnList) {
|
|
1216
|
+
const initialResult = fn(willReturn);
|
|
1217
|
+
willReturn =
|
|
1218
|
+
type(initialResult) === 'Promise' ? await initialResult : initialResult;
|
|
1798
1219
|
}
|
|
1799
|
-
return
|
|
1800
|
-
[key]: value
|
|
1801
|
-
};
|
|
1220
|
+
return willReturn
|
|
1802
1221
|
}
|
|
1803
1222
|
|
|
1804
|
-
function
|
|
1805
|
-
return
|
|
1806
|
-
|
|
1223
|
+
function pluck(property) {
|
|
1224
|
+
return list => {
|
|
1225
|
+
const willReturn = [];
|
|
1807
1226
|
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
return (_a, _b) => on(binaryFn, unaryFn, _a, _b);
|
|
1814
|
-
}
|
|
1815
|
-
return binaryFn(unaryFn(a), unaryFn(b));
|
|
1816
|
-
}
|
|
1227
|
+
list.forEach(x => {
|
|
1228
|
+
if (x[property] !== undefined) {
|
|
1229
|
+
willReturn.push(x[property]);
|
|
1230
|
+
}
|
|
1231
|
+
});
|
|
1817
1232
|
|
|
1818
|
-
|
|
1819
|
-
let result;
|
|
1820
|
-
return function () {
|
|
1821
|
-
if (fn) {
|
|
1822
|
-
result = fn.apply(context || this, arguments);
|
|
1823
|
-
fn = null;
|
|
1824
|
-
}
|
|
1825
|
-
return result;
|
|
1826
|
-
};
|
|
1827
|
-
}
|
|
1828
|
-
function once(fn, context) {
|
|
1829
|
-
if (arguments.length === 1) {
|
|
1830
|
-
const wrap = onceFn(fn, context);
|
|
1831
|
-
return curry(wrap);
|
|
1233
|
+
return willReturn
|
|
1832
1234
|
}
|
|
1833
|
-
return onceFn(fn, context);
|
|
1834
1235
|
}
|
|
1835
1236
|
|
|
1836
|
-
function
|
|
1837
|
-
|
|
1838
|
-
return a || b;
|
|
1237
|
+
function prepend(x) {
|
|
1238
|
+
return list => [x].concat(list)
|
|
1839
1239
|
}
|
|
1840
1240
|
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
map: fn => Identity(fn(x))
|
|
1844
|
-
});
|
|
1845
|
-
function overFn(lens, fn, object) {
|
|
1846
|
-
return lens(x => Identity(fn(x)))(object).x;
|
|
1241
|
+
function prop(searchProperty) {
|
|
1242
|
+
return obj => (obj ? obj[searchProperty] : undefined)
|
|
1847
1243
|
}
|
|
1848
|
-
const over = curry(overFn);
|
|
1849
1244
|
|
|
1850
|
-
function
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
if (argList.length + rest.length >= len) {
|
|
1855
|
-
return fn(...argList, ...rest);
|
|
1245
|
+
function propEq(valueToMatch, propToFind) {
|
|
1246
|
+
return obj => {
|
|
1247
|
+
if (!obj) {
|
|
1248
|
+
return false
|
|
1856
1249
|
}
|
|
1857
|
-
return partial(fn, ...[...argList, ...rest]);
|
|
1858
|
-
};
|
|
1859
|
-
}
|
|
1860
1250
|
|
|
1861
|
-
|
|
1862
|
-
|
|
1251
|
+
return equalsFn(valueToMatch, obj[propToFind])
|
|
1252
|
+
}
|
|
1863
1253
|
}
|
|
1864
1254
|
|
|
1865
|
-
function
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
if (predicate(value, prop)) {
|
|
1870
|
-
yes[prop] = value;
|
|
1871
|
-
} else {
|
|
1872
|
-
no[prop] = value;
|
|
1873
|
-
}
|
|
1874
|
-
});
|
|
1875
|
-
return [yes, no];
|
|
1876
|
-
}
|
|
1877
|
-
function partitionArray(predicate, list, indexed = false) {
|
|
1878
|
-
const yes = [];
|
|
1879
|
-
const no = [];
|
|
1880
|
-
let counter = -1;
|
|
1881
|
-
while (counter++ < list.length - 1) {
|
|
1882
|
-
if (indexed ? predicate(list[counter], counter) : predicate(list[counter])) {
|
|
1883
|
-
yes.push(list[counter]);
|
|
1884
|
-
} else {
|
|
1885
|
-
no.push(list[counter]);
|
|
1255
|
+
function propOr(defaultValue, property) {
|
|
1256
|
+
return obj => {
|
|
1257
|
+
if (!obj) {
|
|
1258
|
+
return defaultValue
|
|
1886
1259
|
}
|
|
1260
|
+
|
|
1261
|
+
return defaultTo(defaultValue, obj[property])
|
|
1887
1262
|
}
|
|
1888
|
-
return [yes, no];
|
|
1889
|
-
}
|
|
1890
|
-
function partition(predicate, iterable) {
|
|
1891
|
-
if (arguments.length === 1) {
|
|
1892
|
-
return listHolder => partition(predicate, listHolder);
|
|
1893
|
-
}
|
|
1894
|
-
if (!isArray(iterable)) return partitionObject(predicate, iterable);
|
|
1895
|
-
return partitionArray(predicate, iterable);
|
|
1896
1263
|
}
|
|
1897
1264
|
|
|
1898
|
-
function
|
|
1899
|
-
return
|
|
1265
|
+
function propSatisfies(predicate, property) {
|
|
1266
|
+
return obj => predicate(obj[property])
|
|
1900
1267
|
}
|
|
1901
|
-
const pathEq = curry(pathEqFn);
|
|
1902
1268
|
|
|
1903
|
-
function
|
|
1904
|
-
return
|
|
1905
|
-
|
|
1906
|
-
|
|
1269
|
+
function range(start) {
|
|
1270
|
+
return end => {
|
|
1271
|
+
if (Number.isNaN(Number(start)) || Number.isNaN(Number(end))) {
|
|
1272
|
+
throw new TypeError('Both arguments to range must be numbers')
|
|
1273
|
+
}
|
|
1907
1274
|
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
}
|
|
1912
|
-
const pathSatisfies = curry(pathSatisfiesFn);
|
|
1275
|
+
if (end <= start) {
|
|
1276
|
+
return []
|
|
1277
|
+
}
|
|
1913
1278
|
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
return _obj => paths(pathsToSearch, _obj);
|
|
1917
|
-
}
|
|
1918
|
-
return pathsToSearch.map(singlePath => path(singlePath, obj));
|
|
1919
|
-
}
|
|
1279
|
+
const len = end - start;
|
|
1280
|
+
const willReturn = Array(len);
|
|
1920
1281
|
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
if (input === null || input === undefined) {
|
|
1924
|
-
return undefined;
|
|
1925
|
-
}
|
|
1926
|
-
const keys = createPath(propsToPick, ',');
|
|
1927
|
-
const willReturn = {};
|
|
1928
|
-
let counter = 0;
|
|
1929
|
-
while (counter < keys.length) {
|
|
1930
|
-
if (keys[counter] in input) {
|
|
1931
|
-
willReturn[keys[counter]] = input[keys[counter]];
|
|
1282
|
+
for (let i = 0; i < len + 1; i++) {
|
|
1283
|
+
willReturn[i] = start + i;
|
|
1932
1284
|
}
|
|
1933
|
-
counter++;
|
|
1934
|
-
}
|
|
1935
|
-
return willReturn;
|
|
1936
|
-
}
|
|
1937
1285
|
|
|
1938
|
-
|
|
1939
|
-
if (arguments.length === 1) return _obj => pickAll(propsToPick, _obj);
|
|
1940
|
-
if (obj === null || obj === undefined) {
|
|
1941
|
-
return undefined;
|
|
1942
|
-
}
|
|
1943
|
-
const keysValue = createPath(propsToPick, ',');
|
|
1944
|
-
const willReturn = {};
|
|
1945
|
-
let counter = 0;
|
|
1946
|
-
while (counter < keysValue.length) {
|
|
1947
|
-
if (keysValue[counter] in obj) {
|
|
1948
|
-
willReturn[keysValue[counter]] = obj[keysValue[counter]];
|
|
1949
|
-
} else {
|
|
1950
|
-
willReturn[keysValue[counter]] = undefined;
|
|
1951
|
-
}
|
|
1952
|
-
counter++;
|
|
1286
|
+
return willReturn
|
|
1953
1287
|
}
|
|
1954
|
-
return willReturn;
|
|
1955
1288
|
}
|
|
1956
1289
|
|
|
1957
|
-
function
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
return Object.keys(obj).reduce((accum, key) => {
|
|
1962
|
-
if (predicate(obj[key], key, obj)) {
|
|
1963
|
-
accum[key] = obj[key];
|
|
1290
|
+
function rangeDescending(start) {
|
|
1291
|
+
return end => {
|
|
1292
|
+
if (Number.isNaN(Number(start)) || Number.isNaN(Number(end))) {
|
|
1293
|
+
throw new TypeError('Both arguments to range must be numbers')
|
|
1964
1294
|
}
|
|
1965
|
-
return accum;
|
|
1966
|
-
}, {});
|
|
1967
|
-
}
|
|
1968
1295
|
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
const willReturn = [];
|
|
1972
|
-
map(x => {
|
|
1973
|
-
if (x[property] !== undefined) {
|
|
1974
|
-
willReturn.push(x[property]);
|
|
1296
|
+
if (end >= start) {
|
|
1297
|
+
return []
|
|
1975
1298
|
}
|
|
1976
|
-
}, list);
|
|
1977
|
-
return willReturn;
|
|
1978
|
-
}
|
|
1979
1299
|
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
if (typeof input === 'string') return [x].concat(input.split(''));
|
|
1983
|
-
return [x].concat(input);
|
|
1984
|
-
}
|
|
1300
|
+
const len = start - end;
|
|
1301
|
+
const willReturn = Array(len);
|
|
1985
1302
|
|
|
1986
|
-
|
|
1303
|
+
for (let i = 0; i < len + 1; i++) {
|
|
1304
|
+
willReturn[i] = start - i;
|
|
1305
|
+
}
|
|
1987
1306
|
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
return equals(valueToMatch, prop(propToFind, obj));
|
|
1307
|
+
return willReturn
|
|
1308
|
+
}
|
|
1991
1309
|
}
|
|
1992
|
-
const propEq = curry(propEqFn);
|
|
1993
1310
|
|
|
1994
|
-
function
|
|
1995
|
-
return
|
|
1311
|
+
function replace(pattern, replacer) {
|
|
1312
|
+
return str => str.replace(pattern, replacer)
|
|
1996
1313
|
}
|
|
1997
|
-
const propIs = curry(propIsFn);
|
|
1998
1314
|
|
|
1999
|
-
function
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
1315
|
+
function replaceItemAtIndex(index, replaceFn) {
|
|
1316
|
+
return list => {
|
|
1317
|
+
const actualIndex = index < 0 ? list.length + index : index;
|
|
1318
|
+
if (index >= list.length || actualIndex < 0) {
|
|
1319
|
+
return list
|
|
1320
|
+
}
|
|
2004
1321
|
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
}
|
|
2008
|
-
const propSatisfies = curry(propSatisfiesFn);
|
|
1322
|
+
const clone = cloneList$1(list);
|
|
1323
|
+
clone[actualIndex] = replaceFn(clone[actualIndex]);
|
|
2009
1324
|
|
|
2010
|
-
|
|
2011
|
-
if (arguments.length === 1) {
|
|
2012
|
-
return _obj => props(propsToPick, _obj);
|
|
2013
|
-
}
|
|
2014
|
-
if (!isArray(propsToPick)) {
|
|
2015
|
-
throw new Error('propsToPick is not a list');
|
|
1325
|
+
return clone
|
|
2016
1326
|
}
|
|
2017
|
-
return mapArray(prop => obj[prop], propsToPick);
|
|
2018
1327
|
}
|
|
2019
1328
|
|
|
2020
|
-
function
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
1329
|
+
function shuffle(listInput) {
|
|
1330
|
+
const list = cloneList(listInput);
|
|
1331
|
+
let counter = list.length;
|
|
1332
|
+
while (counter > 0) {
|
|
1333
|
+
const index = Math.floor(Math.random() * counter);
|
|
1334
|
+
counter--;
|
|
1335
|
+
const temp = list[counter];
|
|
1336
|
+
list[counter] = list[index];
|
|
1337
|
+
list[index] = temp;
|
|
2024
1338
|
}
|
|
2025
|
-
if (end < start) return [];
|
|
2026
|
-
const len = end - start;
|
|
2027
|
-
const willReturn = Array(len);
|
|
2028
|
-
for (let i = 0; i < len; i++) {
|
|
2029
|
-
willReturn[i] = start + i;
|
|
2030
|
-
}
|
|
2031
|
-
return willReturn;
|
|
2032
|
-
}
|
|
2033
1339
|
|
|
2034
|
-
|
|
2035
|
-
const key = keyFn(elt);
|
|
2036
|
-
const value = valueFn(has(key, acc) ? acc[key] : clone(valueAcc), elt);
|
|
2037
|
-
acc[key] = value;
|
|
2038
|
-
return acc;
|
|
1340
|
+
return list
|
|
2039
1341
|
}
|
|
2040
|
-
function reduceByFn(valueFn, valueAcc, keyFn, list) {
|
|
2041
|
-
return reduce((acc, elt) => reduceByFunction(valueFn, valueAcc, keyFn, acc, elt), {}, list);
|
|
2042
|
-
}
|
|
2043
|
-
const reduceBy = curry(reduceByFn);
|
|
2044
1342
|
|
|
2045
|
-
function
|
|
2046
|
-
|
|
2047
|
-
return filter(x => !predicate(x), list);
|
|
1343
|
+
function sort(sortFn) {
|
|
1344
|
+
return list => cloneList$1(list).sort(sortFn)
|
|
2048
1345
|
}
|
|
2049
1346
|
|
|
2050
|
-
function
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
}
|
|
2054
|
-
return Array(timesToRepeat).fill(x);
|
|
2055
|
-
}
|
|
1347
|
+
function sortBy(sortFn) {
|
|
1348
|
+
return list => {
|
|
1349
|
+
const clone = cloneList$1(list);
|
|
2056
1350
|
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
const replace = curry(replaceFn);
|
|
1351
|
+
return clone.sort((a, b) => {
|
|
1352
|
+
const aSortResult = sortFn(a);
|
|
1353
|
+
const bSortResult = sortFn(b);
|
|
2061
1354
|
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
}
|
|
2065
|
-
const set = curry(setFn);
|
|
1355
|
+
if (aSortResult === bSortResult) {
|
|
1356
|
+
return 0
|
|
1357
|
+
}
|
|
2066
1358
|
|
|
2067
|
-
|
|
2068
|
-
|
|
1359
|
+
return aSortResult < bSortResult ? -1 : 1
|
|
1360
|
+
})
|
|
1361
|
+
}
|
|
2069
1362
|
}
|
|
2070
|
-
const slice = curry(sliceFn);
|
|
2071
1363
|
|
|
2072
|
-
function
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
1364
|
+
function sortObject(predicate) {
|
|
1365
|
+
return obj => {
|
|
1366
|
+
const keys = Object.keys(obj);
|
|
1367
|
+
const sortedKeys = sort((a, b) => predicate(a, b, obj[a], obj[b]))(keys);
|
|
2076
1368
|
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
return aSortResult < bSortResult ? -1 : 1;
|
|
2085
|
-
});
|
|
1369
|
+
const toReturn = {};
|
|
1370
|
+
sortedKeys.forEach(singleKey => {
|
|
1371
|
+
toReturn[singleKey] = obj[singleKey];
|
|
1372
|
+
});
|
|
1373
|
+
|
|
1374
|
+
return toReturn
|
|
1375
|
+
}
|
|
2086
1376
|
}
|
|
2087
1377
|
|
|
2088
1378
|
function sortHelper(a, b, listOfSortingFns) {
|
|
@@ -2092,659 +1382,297 @@ function sortHelper(a, b, listOfSortingFns) {
|
|
|
2092
1382
|
result = listOfSortingFns[i](a, b);
|
|
2093
1383
|
i += 1;
|
|
2094
1384
|
}
|
|
2095
|
-
return result;
|
|
2096
|
-
}
|
|
2097
|
-
function sortWith(listOfSortingFns, list) {
|
|
2098
|
-
if (arguments.length === 1) return _list => sortWith(listOfSortingFns, _list);
|
|
2099
|
-
if (Array.isArray(list) === false) return [];
|
|
2100
|
-
const clone = list.slice();
|
|
2101
|
-
clone.sort((a, b) => sortHelper(a, b, listOfSortingFns));
|
|
2102
|
-
return clone;
|
|
2103
|
-
}
|
|
2104
1385
|
|
|
2105
|
-
|
|
2106
|
-
if (arguments.length === 1) return _str => split(separator, _str);
|
|
2107
|
-
return str.split(separator);
|
|
1386
|
+
return result
|
|
2108
1387
|
}
|
|
2109
1388
|
|
|
2110
|
-
function
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
}
|
|
1389
|
+
function sortWith(listOfSortingFns) {
|
|
1390
|
+
return list => {
|
|
1391
|
+
if (Array.isArray(list) === false) {
|
|
1392
|
+
return []
|
|
1393
|
+
}
|
|
2115
1394
|
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
if (howMany < 0) return listOrString.slice();
|
|
2119
|
-
if (typeof listOrString === 'string') return listOrString.slice(0, howMany);
|
|
2120
|
-
return baseSlice(listOrString, 0, howMany);
|
|
2121
|
-
}
|
|
1395
|
+
const clone = list.slice();
|
|
1396
|
+
clone.sort((a, b) => sortHelper(a, b, listOfSortingFns));
|
|
2122
1397
|
|
|
2123
|
-
|
|
2124
|
-
if (arguments.length === 1) {
|
|
2125
|
-
return _list => splitAt(index, _list);
|
|
1398
|
+
return clone
|
|
2126
1399
|
}
|
|
2127
|
-
if (!input) throw new TypeError(`Cannot read property 'slice' of ${input}`);
|
|
2128
|
-
if (!isArray(input) && typeof input !== 'string') return [[], []];
|
|
2129
|
-
const correctIndex = maybe(index < 0, input.length + index < 0 ? 0 : input.length + index, index);
|
|
2130
|
-
return [take(correctIndex, input), drop(correctIndex, input)];
|
|
2131
1400
|
}
|
|
2132
1401
|
|
|
2133
|
-
function
|
|
2134
|
-
|
|
2135
|
-
return _listOrString => splitEvery(sliceLength, _listOrString);
|
|
2136
|
-
}
|
|
2137
|
-
if (sliceLength < 1) {
|
|
2138
|
-
throw new Error('First argument to splitEvery must be a positive integer');
|
|
2139
|
-
}
|
|
2140
|
-
const willReturn = [];
|
|
2141
|
-
let counter = 0;
|
|
2142
|
-
while (counter < listOrString.length) {
|
|
2143
|
-
willReturn.push(listOrString.slice(counter, counter += sliceLength));
|
|
2144
|
-
}
|
|
2145
|
-
return willReturn;
|
|
1402
|
+
function split(separator) {
|
|
1403
|
+
return str => str.split(separator)
|
|
2146
1404
|
}
|
|
2147
1405
|
|
|
2148
|
-
function
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
postFound.push(input[counter]);
|
|
2160
|
-
} else if (predicate(input[counter])) {
|
|
2161
|
-
postFound.push(input[counter]);
|
|
2162
|
-
found = true;
|
|
2163
|
-
} else {
|
|
2164
|
-
preFound.push(input[counter]);
|
|
1406
|
+
function splitEvery(sliceLength) {
|
|
1407
|
+
return list => {
|
|
1408
|
+
if (sliceLength < 1) {
|
|
1409
|
+
throw new Error('First argument to splitEvery must be a positive integer')
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
const willReturn = [];
|
|
1413
|
+
let counter = 0;
|
|
1414
|
+
|
|
1415
|
+
while (counter < list.length) {
|
|
1416
|
+
willReturn.push(list.slice(counter, (counter += sliceLength)));
|
|
2165
1417
|
}
|
|
2166
|
-
}
|
|
2167
|
-
return [preFound, postFound];
|
|
2168
|
-
}
|
|
2169
1418
|
|
|
2170
|
-
|
|
2171
|
-
if (arguments.length === 1) return _iterable => startsWith(question, _iterable);
|
|
2172
|
-
if (typeof iterable === 'string') {
|
|
2173
|
-
return iterable.startsWith(question);
|
|
1419
|
+
return willReturn
|
|
2174
1420
|
}
|
|
2175
|
-
if (!isArray(question)) return false;
|
|
2176
|
-
let correct = true;
|
|
2177
|
-
const filtered = question.filter((x, index) => {
|
|
2178
|
-
if (!correct) return false;
|
|
2179
|
-
const result = equals(x, iterable[index]);
|
|
2180
|
-
if (!result) correct = false;
|
|
2181
|
-
return result;
|
|
2182
|
-
});
|
|
2183
|
-
return filtered.length === question.length;
|
|
2184
|
-
}
|
|
2185
|
-
|
|
2186
|
-
function subtract(a, b) {
|
|
2187
|
-
if (arguments.length === 1) return _b => subtract(a, _b);
|
|
2188
|
-
return a - b;
|
|
2189
|
-
}
|
|
2190
|
-
|
|
2191
|
-
function swapArrayOrString(indexA, indexB, iterable) {
|
|
2192
|
-
const actualIndexA = indexA < 0 ? iterable.length + indexA : indexA;
|
|
2193
|
-
const actualIndexB = indexB < 0 ? iterable.length + indexB : indexB;
|
|
2194
|
-
if (actualIndexA === actualIndexB || Math.min(actualIndexA, actualIndexB) < 0 || Math.max(actualIndexA, actualIndexB) >= iterable.length) return iterable;
|
|
2195
|
-
if (typeof iterable === 'string') {
|
|
2196
|
-
return iterable.slice(0, actualIndexA) + iterable[actualIndexB] + iterable.slice(actualIndexA + 1, actualIndexB) + iterable[actualIndexA] + iterable.slice(actualIndexB + 1);
|
|
2197
|
-
}
|
|
2198
|
-
const clone = iterable.slice();
|
|
2199
|
-
const temp = clone[actualIndexA];
|
|
2200
|
-
clone[actualIndexA] = clone[actualIndexB];
|
|
2201
|
-
clone[actualIndexB] = temp;
|
|
2202
|
-
return clone;
|
|
2203
|
-
}
|
|
2204
|
-
function swapFn(indexA, indexB, iterable) {
|
|
2205
|
-
if (isArray(iterable) || typeof iterable === 'string') return swapArrayOrString(indexA, indexB, iterable);
|
|
2206
|
-
const aVal = iterable[indexA];
|
|
2207
|
-
const bVal = iterable[indexB];
|
|
2208
|
-
if (aVal === undefined || bVal === undefined) return iterable;
|
|
2209
|
-
return _objectSpread2(_objectSpread2({}, iterable), {}, {
|
|
2210
|
-
[indexA]: iterable[indexB],
|
|
2211
|
-
[indexB]: iterable[indexA]
|
|
2212
|
-
});
|
|
2213
1421
|
}
|
|
2214
|
-
const swap = curry(swapFn);
|
|
2215
1422
|
|
|
2216
|
-
function symmetricDifference(x
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
1423
|
+
function symmetricDifference(x) {
|
|
1424
|
+
return y => [
|
|
1425
|
+
...filter(value => !includes(value)(y))(x),
|
|
1426
|
+
...filter(value => !includes(value)(x))(y),
|
|
1427
|
+
]
|
|
2221
1428
|
}
|
|
2222
1429
|
|
|
2223
|
-
function
|
|
2224
|
-
|
|
2225
|
-
const len = listOrString.length;
|
|
2226
|
-
if (howMany < 0) return listOrString.slice();
|
|
2227
|
-
let numValue = howMany > len ? len : howMany;
|
|
2228
|
-
if (typeof listOrString === 'string') return listOrString.slice(len - numValue);
|
|
2229
|
-
numValue = len - numValue;
|
|
2230
|
-
return baseSlice(listOrString, numValue, len);
|
|
1430
|
+
function tail(listOrString) {
|
|
1431
|
+
return drop(1)(listOrString)
|
|
2231
1432
|
}
|
|
2232
1433
|
|
|
2233
|
-
function
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
if (input.length === 0) return input;
|
|
2238
|
-
const toReturn = [];
|
|
2239
|
-
let counter = input.length;
|
|
2240
|
-
while (counter) {
|
|
2241
|
-
const item = input[--counter];
|
|
2242
|
-
if (!predicate(item)) {
|
|
2243
|
-
break;
|
|
1434
|
+
function take(numberOfItems) {
|
|
1435
|
+
return input => {
|
|
1436
|
+
if (numberOfItems < 0) {
|
|
1437
|
+
return input.slice()
|
|
2244
1438
|
}
|
|
2245
|
-
|
|
1439
|
+
if (typeof input === 'string') {
|
|
1440
|
+
return input.slice(0, numberOfItems)
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
return baseSlice(input, 0, numberOfItems)
|
|
2246
1444
|
}
|
|
2247
|
-
return isArray(input) ? toReturn.reverse() : toReturn.reverse().join('');
|
|
2248
1445
|
}
|
|
2249
1446
|
|
|
2250
|
-
function
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
while (counter < iterable.length) {
|
|
2261
|
-
const item = iterable[counter++];
|
|
2262
|
-
if (!predicate(item)) {
|
|
2263
|
-
break;
|
|
1447
|
+
function takeLast(numberOfItems) {
|
|
1448
|
+
return input => {
|
|
1449
|
+
const len = input.length;
|
|
1450
|
+
if (numberOfItems < 0) {
|
|
1451
|
+
return input.slice()
|
|
1452
|
+
}
|
|
1453
|
+
let numValue = numberOfItems > len ? len : numberOfItems;
|
|
1454
|
+
|
|
1455
|
+
if (typeof input === 'string') {
|
|
1456
|
+
return input.slice(len - numValue)
|
|
2264
1457
|
}
|
|
2265
|
-
|
|
1458
|
+
|
|
1459
|
+
numValue = len - numValue;
|
|
1460
|
+
|
|
1461
|
+
return baseSlice(input, numValue, len)
|
|
2266
1462
|
}
|
|
2267
|
-
return isArray$1 ? toReturn : toReturn.join('');
|
|
2268
1463
|
}
|
|
2269
1464
|
|
|
2270
|
-
function
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
}
|
|
1465
|
+
function takeLastWhile(predicate) {
|
|
1466
|
+
return input => {
|
|
1467
|
+
if (input.length === 0) {
|
|
1468
|
+
return input
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1471
|
+
const toReturn = [];
|
|
1472
|
+
let counter = input.length;
|
|
1473
|
+
|
|
1474
|
+
while (counter) {
|
|
1475
|
+
const item = input[--counter];
|
|
1476
|
+
if (!predicate(item)) {
|
|
1477
|
+
break
|
|
1478
|
+
}
|
|
1479
|
+
toReturn.push(item);
|
|
1480
|
+
}
|
|
2275
1481
|
|
|
2276
|
-
|
|
2277
|
-
if (arguments.length === 1) return _str => test(pattern, _str);
|
|
2278
|
-
if (typeof pattern === 'string') {
|
|
2279
|
-
throw new TypeError(`R.test requires a value of type RegExp as its first argument; received "${pattern}"`);
|
|
1482
|
+
return toReturn.reverse()
|
|
2280
1483
|
}
|
|
2281
|
-
return str.search(pattern) !== -1;
|
|
2282
1484
|
}
|
|
2283
1485
|
|
|
2284
|
-
function
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
1486
|
+
function takeWhile(predicate) {
|
|
1487
|
+
return iterable => {
|
|
1488
|
+
const toReturn = [];
|
|
1489
|
+
let counter = 0;
|
|
1490
|
+
|
|
1491
|
+
while (counter < iterable.length) {
|
|
1492
|
+
const item = iterable[counter++];
|
|
1493
|
+
if (!predicate(item)) {
|
|
1494
|
+
break
|
|
1495
|
+
}
|
|
1496
|
+
toReturn.push(item);
|
|
1497
|
+
}
|
|
1498
|
+
return toReturn
|
|
2288
1499
|
}
|
|
2289
|
-
return map(fn, range(0, howMany));
|
|
2290
1500
|
}
|
|
2291
1501
|
|
|
2292
|
-
function
|
|
2293
|
-
return
|
|
2294
|
-
|
|
1502
|
+
function tap(fn) {
|
|
1503
|
+
return x => {
|
|
1504
|
+
fn(x);
|
|
2295
1505
|
|
|
2296
|
-
|
|
2297
|
-
|
|
1506
|
+
return x
|
|
1507
|
+
}
|
|
2298
1508
|
}
|
|
2299
1509
|
|
|
2300
|
-
function
|
|
2301
|
-
return
|
|
1510
|
+
function test(pattern) {
|
|
1511
|
+
return str => str.search(pattern) !== -1
|
|
2302
1512
|
}
|
|
2303
1513
|
|
|
2304
|
-
function
|
|
2305
|
-
return
|
|
1514
|
+
function tryCatch(fn, fallback) {
|
|
1515
|
+
return input => {
|
|
1516
|
+
try {
|
|
1517
|
+
return fn(input)
|
|
1518
|
+
} catch (e) {
|
|
1519
|
+
return fallback
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
2306
1522
|
}
|
|
2307
1523
|
|
|
2308
|
-
function
|
|
2309
|
-
return
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
1524
|
+
function union(x) {
|
|
1525
|
+
return y => {
|
|
1526
|
+
const toReturn = cloneList$1(x);
|
|
1527
|
+
|
|
1528
|
+
y.forEach(yInstance => {
|
|
1529
|
+
if (!includes(yInstance)(x)) {
|
|
1530
|
+
toReturn.push(yInstance);
|
|
1531
|
+
}
|
|
1532
|
+
});
|
|
2314
1533
|
|
|
2315
|
-
|
|
2316
|
-
|
|
1534
|
+
return toReturn
|
|
1535
|
+
}
|
|
2317
1536
|
}
|
|
2318
1537
|
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
1538
|
+
class _Set {
|
|
1539
|
+
constructor() {
|
|
1540
|
+
this.set = new Set();
|
|
1541
|
+
this.items = {};
|
|
2323
1542
|
}
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
1543
|
+
|
|
1544
|
+
checkUniqueness(item) {
|
|
1545
|
+
const type$1 = type(item);
|
|
1546
|
+
if (['Null', 'Undefined', 'NaN'].includes(type$1)) {
|
|
1547
|
+
if (type$1 in this.items) {
|
|
1548
|
+
return false
|
|
1549
|
+
}
|
|
1550
|
+
this.items[type$1] = true;
|
|
1551
|
+
|
|
1552
|
+
return true
|
|
1553
|
+
}
|
|
1554
|
+
if (!['Object', 'Array'].includes(type$1)) {
|
|
1555
|
+
const prevSize = this.set.size;
|
|
1556
|
+
this.set.add(item);
|
|
1557
|
+
|
|
1558
|
+
return this.set.size !== prevSize
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
if (!(type$1 in this.items)) {
|
|
1562
|
+
this.items[type$1] = [item];
|
|
1563
|
+
|
|
1564
|
+
return true
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1567
|
+
if (_indexOf(item, this.items[type$1]) === -1) {
|
|
1568
|
+
this.items[type$1].push(item);
|
|
1569
|
+
|
|
1570
|
+
return true
|
|
2330
1571
|
}
|
|
2331
|
-
};
|
|
2332
|
-
}
|
|
2333
1572
|
|
|
2334
|
-
|
|
2335
|
-
|
|
2336
|
-
return fn.call(this, args);
|
|
2337
|
-
};
|
|
1573
|
+
return false
|
|
1574
|
+
}
|
|
2338
1575
|
}
|
|
2339
1576
|
|
|
2340
|
-
function
|
|
2341
|
-
|
|
2342
|
-
const
|
|
2343
|
-
|
|
2344
|
-
if (
|
|
1577
|
+
function uniq(list) {
|
|
1578
|
+
const set = new _Set();
|
|
1579
|
+
const willReturn = [];
|
|
1580
|
+
list.forEach(item => {
|
|
1581
|
+
if (set.checkUniqueness(item)) {
|
|
1582
|
+
willReturn.push(item);
|
|
1583
|
+
}
|
|
2345
1584
|
});
|
|
2346
|
-
|
|
1585
|
+
|
|
1586
|
+
return willReturn
|
|
2347
1587
|
}
|
|
2348
1588
|
|
|
2349
|
-
function uniqBy(fn
|
|
2350
|
-
|
|
2351
|
-
|
|
1589
|
+
function uniqBy(fn) {
|
|
1590
|
+
return list => {
|
|
1591
|
+
const set = new _Set();
|
|
1592
|
+
|
|
1593
|
+
return list.filter(item => set.checkUniqueness(fn(item)))
|
|
2352
1594
|
}
|
|
2353
|
-
const set = new _Set();
|
|
2354
|
-
return list.filter(item => set.checkUniqueness(fn(item)));
|
|
2355
1595
|
}
|
|
2356
1596
|
|
|
2357
1597
|
function includesWith(predicate, target, list) {
|
|
2358
1598
|
let willReturn = false;
|
|
2359
1599
|
let index = -1;
|
|
1600
|
+
|
|
2360
1601
|
while (++index < list.length && !willReturn) {
|
|
2361
1602
|
const value = list[index];
|
|
1603
|
+
|
|
2362
1604
|
if (predicate(target, value)) {
|
|
2363
1605
|
willReturn = true;
|
|
2364
1606
|
}
|
|
2365
1607
|
}
|
|
2366
|
-
return willReturn;
|
|
2367
|
-
}
|
|
2368
|
-
function uniqWith(predicate, list) {
|
|
2369
|
-
if (arguments.length === 1) return _list => uniqWith(predicate, _list);
|
|
2370
|
-
let index = -1;
|
|
2371
|
-
const willReturn = [];
|
|
2372
|
-
while (++index < list.length) {
|
|
2373
|
-
const value = list[index];
|
|
2374
|
-
if (!includesWith(predicate, value, willReturn)) {
|
|
2375
|
-
willReturn.push(value);
|
|
2376
|
-
}
|
|
2377
|
-
}
|
|
2378
|
-
return willReturn;
|
|
2379
|
-
}
|
|
2380
1608
|
|
|
2381
|
-
|
|
2382
|
-
if (predicate(input)) return input;
|
|
2383
|
-
return whenFalseFn(input);
|
|
1609
|
+
return willReturn
|
|
2384
1610
|
}
|
|
2385
|
-
const unless = curry(unlessFn);
|
|
2386
1611
|
|
|
2387
|
-
function
|
|
2388
|
-
return list
|
|
2389
|
-
|
|
2390
|
-
|
|
1612
|
+
function uniqWith(predicate) {
|
|
1613
|
+
return list => {
|
|
1614
|
+
let index = -1;
|
|
1615
|
+
const willReturn = [];
|
|
1616
|
+
|
|
1617
|
+
while (++index < list.length) {
|
|
1618
|
+
const value = list[index];
|
|
1619
|
+
|
|
1620
|
+
if (!includesWith(predicate, value, willReturn)) {
|
|
1621
|
+
willReturn.push(value);
|
|
1622
|
+
}
|
|
2391
1623
|
}
|
|
2392
|
-
return [...acc, item];
|
|
2393
|
-
}, []);
|
|
2394
|
-
}
|
|
2395
1624
|
|
|
2396
|
-
|
|
2397
|
-
if (arguments.length === 1) {
|
|
2398
|
-
return _obj => unwind(property, _obj);
|
|
1625
|
+
return willReturn
|
|
2399
1626
|
}
|
|
2400
|
-
if (!isArray(obj[property])) return [obj];
|
|
2401
|
-
return mapArray(x => _objectSpread2(_objectSpread2({}, obj), {}, {
|
|
2402
|
-
[property]: x
|
|
2403
|
-
}), obj[property]);
|
|
2404
|
-
}
|
|
2405
|
-
|
|
2406
|
-
function values(obj) {
|
|
2407
|
-
if (type(obj) !== 'Object') return [];
|
|
2408
|
-
return Object.values(obj);
|
|
2409
1627
|
}
|
|
2410
1628
|
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
if (arguments.length === 1) return _target => view(lens, _target);
|
|
2417
|
-
return lens(Const)(target).x;
|
|
2418
|
-
}
|
|
1629
|
+
function unless(predicate, whenFalseFn) {
|
|
1630
|
+
return input => {
|
|
1631
|
+
if (predicate(input)) {
|
|
1632
|
+
return input
|
|
1633
|
+
}
|
|
2419
1634
|
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
return whenTrueFn(input);
|
|
1635
|
+
return whenFalseFn(input)
|
|
1636
|
+
}
|
|
2423
1637
|
}
|
|
2424
|
-
const when = curry(whenFn);
|
|
2425
1638
|
|
|
2426
|
-
function
|
|
2427
|
-
|
|
2428
|
-
return
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
if (!flag) continue;
|
|
2433
|
-
const result = conditions[prop](input[prop]);
|
|
2434
|
-
if (flag && result === false) {
|
|
2435
|
-
flag = false;
|
|
2436
|
-
}
|
|
1639
|
+
function unwind(property) {
|
|
1640
|
+
return obj => {
|
|
1641
|
+
return obj[property].map(x => ({
|
|
1642
|
+
...obj,
|
|
1643
|
+
[property]: x,
|
|
1644
|
+
}))
|
|
2437
1645
|
}
|
|
2438
|
-
return flag;
|
|
2439
1646
|
}
|
|
2440
1647
|
|
|
2441
|
-
function
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
for (const prop in conditions) {
|
|
2446
|
-
if (conditions[prop](input[prop])) {
|
|
2447
|
-
return true;
|
|
1648
|
+
function when(predicate, whenTrueFn) {
|
|
1649
|
+
return input => {
|
|
1650
|
+
if (!predicate(input)) {
|
|
1651
|
+
return input
|
|
2448
1652
|
}
|
|
2449
|
-
}
|
|
2450
|
-
return false;
|
|
2451
|
-
}
|
|
2452
1653
|
|
|
2453
|
-
|
|
2454
|
-
if (arguments.length === 1) {
|
|
2455
|
-
return _input => whereEq(condition, _input);
|
|
1654
|
+
return whenTrueFn(input)
|
|
2456
1655
|
}
|
|
2457
|
-
const result = filter((conditionValue, conditionProp) => equals(conditionValue, input[conditionProp]), condition);
|
|
2458
|
-
return Object.keys(result).length === Object.keys(condition).length;
|
|
2459
1656
|
}
|
|
2460
1657
|
|
|
2461
|
-
function
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
return reduce((prev, current) => _indexOf(current, matchAgainst) > -1 ? prev : prev.concat(current), [], source);
|
|
2466
|
-
}
|
|
1658
|
+
function zip(left) {
|
|
1659
|
+
return right => {
|
|
1660
|
+
const result = [];
|
|
1661
|
+
const length = Math.min(left.length, right.length);
|
|
2467
1662
|
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
}
|
|
1663
|
+
for (let i = 0; i < length; i++) {
|
|
1664
|
+
result[i] = [left[i], right[i]];
|
|
1665
|
+
}
|
|
2472
1666
|
|
|
2473
|
-
|
|
2474
|
-
if (arguments.length === 1) return _right => zip(left, _right);
|
|
2475
|
-
const result = [];
|
|
2476
|
-
const length = Math.min(left.length, right.length);
|
|
2477
|
-
for (let i = 0; i < length; i++) {
|
|
2478
|
-
result[i] = [left[i], right[i]];
|
|
1667
|
+
return result
|
|
2479
1668
|
}
|
|
2480
|
-
return result;
|
|
2481
1669
|
}
|
|
2482
1670
|
|
|
2483
|
-
function
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
function zipWithFn(fn, x, y) {
|
|
2492
|
-
return take(x.length > y.length ? y.length : x.length, x).map((xInstance, i) => fn(xInstance, y[i]));
|
|
2493
|
-
}
|
|
2494
|
-
const zipWith = curry(zipWithFn);
|
|
2495
|
-
|
|
2496
|
-
exports.F = F;
|
|
2497
|
-
exports.T = T;
|
|
2498
|
-
exports.__findHighestArity = __findHighestArity;
|
|
2499
|
-
exports._indexOf = _indexOf;
|
|
2500
|
-
exports._lastIndexOf = _lastIndexOf;
|
|
2501
|
-
exports._pipe = _pipe;
|
|
2502
|
-
exports.add = add;
|
|
2503
|
-
exports.addIndex = addIndex;
|
|
2504
|
-
exports.addIndexRight = addIndexRight;
|
|
2505
|
-
exports.adjust = adjust;
|
|
2506
|
-
exports.all = all;
|
|
2507
|
-
exports.allPass = allPass;
|
|
2508
|
-
exports.always = always;
|
|
2509
|
-
exports.and = and;
|
|
2510
|
-
exports.any = any;
|
|
2511
|
-
exports.anyPass = anyPass;
|
|
2512
|
-
exports.ap = ap;
|
|
2513
|
-
exports.aperture = aperture;
|
|
2514
|
-
exports.append = append;
|
|
2515
|
-
exports.apply = apply;
|
|
2516
|
-
exports.applySpec = applySpec;
|
|
2517
|
-
exports.applyTo = applyTo;
|
|
2518
|
-
exports.ascend = ascend;
|
|
2519
|
-
exports.assoc = assoc;
|
|
2520
|
-
exports.assocFn = assocFn;
|
|
2521
|
-
exports.assocPath = assocPath;
|
|
2522
|
-
exports.assocPathFn = assocPathFn;
|
|
2523
|
-
exports.binary = binary;
|
|
2524
|
-
exports.bind = bind;
|
|
2525
|
-
exports.both = both;
|
|
2526
|
-
exports.call = call;
|
|
2527
|
-
exports.chain = chain;
|
|
2528
|
-
exports.clamp = clamp;
|
|
2529
|
-
exports.clone = clone;
|
|
2530
|
-
exports.collectBy = collectBy;
|
|
2531
|
-
exports.comparator = comparator;
|
|
2532
|
-
exports.complement = complement;
|
|
2533
|
-
exports.compose = compose;
|
|
2534
|
-
exports.composeWith = composeWith;
|
|
2535
|
-
exports.concat = concat;
|
|
2536
|
-
exports.cond = cond;
|
|
2537
|
-
exports.converge = converge;
|
|
2538
|
-
exports.count = count;
|
|
2539
|
-
exports.countBy = countBy;
|
|
2540
|
-
exports.createCompareFunction = createCompareFunction;
|
|
2541
|
-
exports.curry = curry;
|
|
2542
|
-
exports.curryN = curryN;
|
|
2543
|
-
exports.dec = dec;
|
|
2544
|
-
exports.defaultTo = defaultTo;
|
|
2545
|
-
exports.descend = descend;
|
|
2546
|
-
exports.difference = difference;
|
|
2547
|
-
exports.differenceWith = differenceWith;
|
|
2548
|
-
exports.differenceWithFn = differenceWithFn;
|
|
2549
|
-
exports.dissoc = dissoc;
|
|
2550
|
-
exports.dissocPath = dissocPath;
|
|
2551
|
-
exports.divide = divide;
|
|
2552
|
-
exports.drop = drop;
|
|
2553
|
-
exports.dropLast = dropLast;
|
|
2554
|
-
exports.dropLastWhile = dropLastWhile;
|
|
2555
|
-
exports.dropRepeats = dropRepeats;
|
|
2556
|
-
exports.dropRepeatsBy = dropRepeatsBy;
|
|
2557
|
-
exports.dropRepeatsWith = dropRepeatsWith;
|
|
2558
|
-
exports.dropWhile = dropWhile;
|
|
2559
|
-
exports.either = either;
|
|
2560
|
-
exports.empty = empty;
|
|
2561
|
-
exports.endsWith = endsWith;
|
|
2562
|
-
exports.eqBy = eqBy;
|
|
2563
|
-
exports.eqByFn = eqByFn;
|
|
2564
|
-
exports.eqProps = eqProps;
|
|
2565
|
-
exports.equals = equals;
|
|
2566
|
-
exports.evolve = evolve;
|
|
2567
|
-
exports.evolveArray = evolveArray;
|
|
2568
|
-
exports.evolveObject = evolveObject;
|
|
2569
|
-
exports.filter = filter;
|
|
2570
|
-
exports.filterArray = filterArray;
|
|
2571
|
-
exports.filterObject = filterObject;
|
|
2572
|
-
exports.find = find;
|
|
2573
|
-
exports.findIndex = findIndex;
|
|
2574
|
-
exports.findLast = findLast;
|
|
2575
|
-
exports.findLastIndex = findLastIndex;
|
|
2576
|
-
exports.flatten = flatten;
|
|
2577
|
-
exports.flip = flip;
|
|
2578
|
-
exports.forEach = forEach;
|
|
2579
|
-
exports.forEachObjIndexed = forEachObjIndexed;
|
|
2580
|
-
exports.forEachObjIndexedFn = forEachObjIndexedFn;
|
|
2581
|
-
exports.fromPairs = fromPairs;
|
|
2582
|
-
exports.groupBy = groupBy;
|
|
2583
|
-
exports.groupWith = groupWith;
|
|
2584
|
-
exports.gt = gt;
|
|
2585
|
-
exports.gte = gte;
|
|
2586
|
-
exports.has = has;
|
|
2587
|
-
exports.hasIn = hasIn;
|
|
2588
|
-
exports.hasPath = hasPath;
|
|
2589
|
-
exports.head = head;
|
|
2590
|
-
exports.identical = identical;
|
|
2591
|
-
exports.identity = identity;
|
|
2592
|
-
exports.ifElse = ifElse;
|
|
2593
|
-
exports.inc = inc;
|
|
2594
|
-
exports.includes = includes$1;
|
|
2595
|
-
exports.indexBy = indexBy;
|
|
2596
|
-
exports.indexOf = indexOf;
|
|
2597
|
-
exports.init = init;
|
|
2598
|
-
exports.innerJoin = innerJoin;
|
|
2599
|
-
exports.innerJoinFn = innerJoinFn;
|
|
2600
|
-
exports.insert = insert;
|
|
2601
|
-
exports.insertAll = insertAll;
|
|
2602
|
-
exports.insertAllFn = insertAllFn;
|
|
2603
|
-
exports.insertFn = insertFn;
|
|
2604
|
-
exports.intersection = intersection;
|
|
2605
|
-
exports.intersperse = intersperse;
|
|
2606
|
-
exports.is = is;
|
|
2607
|
-
exports.isEmpty = isEmpty;
|
|
2608
|
-
exports.isNil = isNil;
|
|
2609
|
-
exports.isNotEmpty = isNotEmpty;
|
|
2610
|
-
exports.isNotNil = isNotNil;
|
|
2611
|
-
exports.join = join;
|
|
2612
|
-
exports.juxt = juxt;
|
|
2613
|
-
exports.keys = keys;
|
|
2614
|
-
exports.last = last;
|
|
2615
|
-
exports.lastIndexOf = lastIndexOf;
|
|
2616
|
-
exports.length = length;
|
|
2617
|
-
exports.lens = lens;
|
|
2618
|
-
exports.lensIndex = lensIndex;
|
|
2619
|
-
exports.lensPath = lensPath;
|
|
2620
|
-
exports.lensProp = lensProp;
|
|
2621
|
-
exports.lt = lt;
|
|
2622
|
-
exports.lte = lte;
|
|
2623
|
-
exports.map = map;
|
|
2624
|
-
exports.mapArray = mapArray;
|
|
2625
|
-
exports.mapObjIndexed = mapObjIndexed;
|
|
2626
|
-
exports.mapObject = mapObject;
|
|
2627
|
-
exports.match = match;
|
|
2628
|
-
exports.mathMod = mathMod;
|
|
2629
|
-
exports.max = max;
|
|
2630
|
-
exports.maxBy = maxBy;
|
|
2631
|
-
exports.maxByFn = maxByFn;
|
|
2632
|
-
exports.mean = mean;
|
|
2633
|
-
exports.median = median;
|
|
2634
|
-
exports.merge = mergeRight;
|
|
2635
|
-
exports.mergeAll = mergeAll;
|
|
2636
|
-
exports.mergeDeepLeft = mergeDeepLeft;
|
|
2637
|
-
exports.mergeDeepRight = mergeDeepRight;
|
|
2638
|
-
exports.mergeLeft = mergeLeft;
|
|
2639
|
-
exports.mergeRight = mergeRight;
|
|
2640
|
-
exports.mergeWith = mergeWith;
|
|
2641
|
-
exports.mergeWithFn = mergeWithFn;
|
|
2642
|
-
exports.min = min;
|
|
2643
|
-
exports.minBy = minBy;
|
|
2644
|
-
exports.minByFn = minByFn;
|
|
2645
|
-
exports.modify = modify;
|
|
2646
|
-
exports.modifyPath = modifyPath;
|
|
2647
|
-
exports.modifyPathFn = modifyPathFn;
|
|
2648
|
-
exports.modulo = modulo;
|
|
2649
|
-
exports.move = move;
|
|
2650
|
-
exports.multiply = multiply;
|
|
2651
|
-
exports.negate = negate;
|
|
2652
|
-
exports.none = none;
|
|
2653
|
-
exports.not = not;
|
|
2654
|
-
exports.nth = nth;
|
|
2655
|
-
exports.objOf = objOf;
|
|
2656
|
-
exports.of = of;
|
|
2657
|
-
exports.omit = omit;
|
|
2658
|
-
exports.on = on;
|
|
2659
|
-
exports.once = once;
|
|
2660
|
-
exports.or = or;
|
|
2661
|
-
exports.over = over;
|
|
2662
|
-
exports.partial = partial;
|
|
2663
|
-
exports.partialObject = partialObject;
|
|
2664
|
-
exports.partition = partition;
|
|
2665
|
-
exports.partitionArray = partitionArray;
|
|
2666
|
-
exports.partitionObject = partitionObject;
|
|
2667
|
-
exports.path = path;
|
|
2668
|
-
exports.pathEq = pathEq;
|
|
2669
|
-
exports.pathFn = pathFn;
|
|
2670
|
-
exports.pathOr = pathOr;
|
|
2671
|
-
exports.pathSatisfies = pathSatisfies;
|
|
2672
|
-
exports.pathSatisfiesFn = pathSatisfiesFn;
|
|
2673
|
-
exports.paths = paths;
|
|
2674
|
-
exports.pick = pick;
|
|
2675
|
-
exports.pickAll = pickAll;
|
|
2676
|
-
exports.pickBy = pickBy;
|
|
2677
|
-
exports.pipe = pipe;
|
|
2678
|
-
exports.pipeWith = pipeWith;
|
|
2679
|
-
exports.pluck = pluck;
|
|
2680
|
-
exports.prepend = prepend;
|
|
2681
|
-
exports.product = product;
|
|
2682
|
-
exports.prop = prop;
|
|
2683
|
-
exports.propEq = propEq;
|
|
2684
|
-
exports.propFn = propFn;
|
|
2685
|
-
exports.propIs = propIs;
|
|
2686
|
-
exports.propOr = propOr;
|
|
2687
|
-
exports.propSatisfies = propSatisfies;
|
|
2688
|
-
exports.props = props;
|
|
2689
|
-
exports.range = range;
|
|
2690
|
-
exports.reduce = reduce;
|
|
2691
|
-
exports.reduceBy = reduceBy;
|
|
2692
|
-
exports.reduceByFn = reduceByFn;
|
|
2693
|
-
exports.reduceFn = reduceFn;
|
|
2694
|
-
exports.reduceStopper = reduceStopper;
|
|
2695
|
-
exports.reject = reject;
|
|
2696
|
-
exports.removeIndex = removeIndex;
|
|
2697
|
-
exports.repeat = repeat;
|
|
2698
|
-
exports.replace = replace;
|
|
2699
|
-
exports.reverse = reverse;
|
|
2700
|
-
exports.set = set;
|
|
2701
|
-
exports.slice = slice;
|
|
2702
|
-
exports.sort = sort;
|
|
2703
|
-
exports.sortBy = sortBy;
|
|
2704
|
-
exports.sortWith = sortWith;
|
|
2705
|
-
exports.split = split;
|
|
2706
|
-
exports.splitAt = splitAt;
|
|
2707
|
-
exports.splitEvery = splitEvery;
|
|
2708
|
-
exports.splitWhen = splitWhen;
|
|
2709
|
-
exports.startsWith = startsWith;
|
|
2710
|
-
exports.subtract = subtract;
|
|
2711
|
-
exports.sum = sum;
|
|
2712
|
-
exports.swap = swap;
|
|
2713
|
-
exports.symmetricDifference = symmetricDifference;
|
|
2714
|
-
exports.tail = tail;
|
|
2715
|
-
exports.take = take;
|
|
2716
|
-
exports.takeLast = takeLast;
|
|
2717
|
-
exports.takeLastWhile = takeLastWhile;
|
|
2718
|
-
exports.takeWhile = takeWhile;
|
|
2719
|
-
exports.tap = tap;
|
|
2720
|
-
exports.test = test;
|
|
2721
|
-
exports.times = times;
|
|
2722
|
-
exports.toLower = toLower;
|
|
2723
|
-
exports.toPairs = toPairs;
|
|
2724
|
-
exports.toString = toString;
|
|
2725
|
-
exports.toUpper = toUpper;
|
|
2726
|
-
exports.transpose = transpose;
|
|
2727
|
-
exports.trim = trim;
|
|
2728
|
-
exports.tryCatch = tryCatch;
|
|
2729
|
-
exports.type = type;
|
|
2730
|
-
exports.unapply = unapply;
|
|
2731
|
-
exports.union = union;
|
|
2732
|
-
exports.uniq = uniq;
|
|
2733
|
-
exports.uniqBy = uniqBy;
|
|
2734
|
-
exports.uniqWith = uniqWith;
|
|
2735
|
-
exports.unless = unless;
|
|
2736
|
-
exports.unnest = unnest;
|
|
2737
|
-
exports.unwind = unwind;
|
|
2738
|
-
exports.update = update;
|
|
2739
|
-
exports.updateFn = updateFn;
|
|
2740
|
-
exports.values = values;
|
|
2741
|
-
exports.view = view;
|
|
2742
|
-
exports.when = when;
|
|
2743
|
-
exports.where = where;
|
|
2744
|
-
exports.whereAny = whereAny;
|
|
2745
|
-
exports.whereEq = whereEq;
|
|
2746
|
-
exports.without = without;
|
|
2747
|
-
exports.xor = xor;
|
|
2748
|
-
exports.zip = zip;
|
|
2749
|
-
exports.zipObj = zipObj;
|
|
2750
|
-
exports.zipWith = zipWith;
|
|
1671
|
+
function zipWith(fn, x) {
|
|
1672
|
+
return y =>
|
|
1673
|
+
take(x.length > y.length ? y.length : x.length)(x).map((xInstance, i) =>
|
|
1674
|
+
fn(xInstance, y[i]),
|
|
1675
|
+
)
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
export { _arity, _includes, _indexOf, _lastIndexOf, addProp, all, allPass, any, anyPass, append, ascend, checkObjectWithSpec, compact, complement, concat, count, countBy, createCompareFunction, createObjectFromKeys, defaultTo, descend, drop, dropLast, dropLastWhile, dropWhile, eqBy, eqProps, equals, equalsFn, evolve, excludes, filter, filterObject, find, findIndex, findLast, findLastIndex, findNth, flatMap, flatten, groupBy, groupByFallback, head, includes, indexOf, init, innerJoin, interpolate, intersection, intersperse, join, last, lastIndexOf, map, mapAsync, mapKeys, mapObject, mapObjectAsync, mapParallelAsync, match, maxBy, merge, mergeTypes, minBy, modifyProp, none, objOf, objectIncludes, omit, partition, partitionObject, path, permutations, pick, pipe, pipeAsync, pluck, prepend, prop, propEq, propOr, propSatisfies, range, rangeDescending, reduce, reject, rejectObject, replace, replaceItemAtIndex, shuffle, sort, sortBy, sortObject, sortWith, split, splitEvery, symmetricDifference, tail, take, takeLast, takeLastWhile, takeWhile, tap, test, tryCatch, type, union, uniq, uniqBy, uniqWith, unless, unwind, update, when, zip, zipWith };
|