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