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.
Files changed (257) hide show
  1. package/CHANGELOG.md +69 -1
  2. package/README.md +4637 -13433
  3. package/dist/rambda.esm.js +1487 -0
  4. package/dist/rambda.js +952 -2113
  5. package/dist/rambda.umd.js +1595 -1
  6. package/immutable.d.ts +1066 -1293
  7. package/index.d.ts +1066 -1293
  8. package/package.json +95 -94
  9. package/rambda.js +10 -138
  10. package/src/_internals/baseSlice.js +5 -7
  11. package/src/_internals/createPath.js +4 -6
  12. package/src/_internals/includes.js +8 -4
  13. package/src/_internals/set.js +11 -11
  14. package/src/all.js +8 -6
  15. package/src/allPass.js +4 -4
  16. package/src/any.js +10 -10
  17. package/src/anyPass.js +4 -4
  18. package/src/append.js +4 -6
  19. package/src/checkObjectWithSpec.js +16 -0
  20. package/src/complement.js +1 -1
  21. package/src/concat.js +2 -4
  22. package/src/count.js +5 -4
  23. package/src/countBy.js +6 -7
  24. package/src/defaultTo.js +4 -6
  25. package/src/drop.js +4 -2
  26. package/src/dropLast.js +4 -8
  27. package/src/dropLastWhile.js +17 -26
  28. package/src/dropWhile.js +14 -22
  29. package/src/eqBy.js +3 -8
  30. package/src/eqProps.js +3 -8
  31. package/src/equals.js +99 -58
  32. package/src/evolve.js +19 -52
  33. package/src/excludes.js +5 -0
  34. package/src/filter.js +10 -40
  35. package/src/filterObject.js +13 -0
  36. package/src/find.js +6 -6
  37. package/src/findIndex.js +5 -5
  38. package/src/findLast.js +6 -6
  39. package/src/findLastIndex.js +5 -5
  40. package/src/flatMap.js +3 -0
  41. package/src/flatten.js +5 -5
  42. package/src/groupBy.js +9 -7
  43. package/src/head.js +5 -3
  44. package/src/includes.js +10 -7
  45. package/src/indexOf.js +2 -6
  46. package/src/init.js +6 -8
  47. package/src/innerJoin.js +11 -19
  48. package/src/intersection.js +2 -4
  49. package/src/intersperse.js +7 -7
  50. package/src/join.js +2 -4
  51. package/src/last.js +4 -4
  52. package/src/lastIndexOf.js +2 -6
  53. package/src/map.js +9 -49
  54. package/src/mapAsync.js +11 -0
  55. package/src/mapObject.js +18 -0
  56. package/src/mapObjectAsync.js +10 -0
  57. package/src/match.js +6 -6
  58. package/src/maxBy.js +2 -8
  59. package/src/merge.js +4 -1
  60. package/src/mergeTypes.js +3 -0
  61. package/src/minBy.js +2 -8
  62. package/src/modifyPath.js +22 -25
  63. package/src/none.js +8 -6
  64. package/src/objOf.js +2 -6
  65. package/src/omit.js +26 -11
  66. package/src/partition.js +20 -23
  67. package/src/path.js +14 -15
  68. package/src/pick.js +15 -15
  69. package/src/pipe.js +70 -13
  70. package/src/pipeAsync.js +10 -0
  71. package/src/pluck.js +7 -9
  72. package/src/prepend.js +2 -6
  73. package/src/prop.js +2 -10
  74. package/src/propEq.js +8 -10
  75. package/src/propOr.js +7 -8
  76. package/src/propSatisfies.js +2 -7
  77. package/src/range.js +3 -3
  78. package/src/reduce.js +15 -30
  79. package/src/reject.js +2 -4
  80. package/src/replace.js +2 -8
  81. package/src/replaceItemAtIndex.js +15 -0
  82. package/src/sort.js +2 -4
  83. package/src/sortBy.js +3 -3
  84. package/src/sortWith.js +9 -13
  85. package/src/split.js +2 -4
  86. package/src/splitEvery.js +6 -8
  87. package/src/symmetricDifference.js +5 -8
  88. package/src/tail.js +2 -2
  89. package/src/take.js +11 -9
  90. package/src/takeLast.js +14 -14
  91. package/src/takeLastWhile.js +19 -20
  92. package/src/takeWhile.js +12 -21
  93. package/src/tap.js +3 -3
  94. package/src/test.js +2 -8
  95. package/src/tryCatch.js +5 -14
  96. package/src/type.js +6 -5
  97. package/src/union.js +10 -8
  98. package/src/uniq.js +2 -2
  99. package/src/uniqBy.js +5 -6
  100. package/src/uniqWith.js +10 -14
  101. package/src/unless.js +7 -9
  102. package/src/unwind.js +6 -14
  103. package/src/update.js +8 -11
  104. package/src/when.js +7 -9
  105. package/src/zip.js +8 -8
  106. package/src/zipWith.js +5 -7
  107. package/src/F.js +0 -3
  108. package/src/T.js +0 -3
  109. package/src/_internals/_arity.js +0 -64
  110. package/src/_internals/compare.js +0 -3
  111. package/src/_internals/constants.js +0 -1
  112. package/src/_internals/createPathInput.js +0 -7
  113. package/src/_internals/isFalsy.js +0 -13
  114. package/src/_internals/isInteger.js +0 -10
  115. package/src/_internals/isIterable.js +0 -5
  116. package/src/_internals/isObject.js +0 -5
  117. package/src/_internals/isTruthy.js +0 -13
  118. package/src/_internals/objectIs.js +0 -9
  119. package/src/_internals/utils.js +0 -21
  120. package/src/add.js +0 -5
  121. package/src/addIndex.js +0 -23
  122. package/src/addIndexRight.js +0 -9
  123. package/src/adjust.js +0 -16
  124. package/src/always.js +0 -3
  125. package/src/and.js +0 -5
  126. package/src/ap.js +0 -7
  127. package/src/aperture.js +0 -15
  128. package/src/apply.js +0 -7
  129. package/src/applySpec.js +0 -132
  130. package/src/applyTo.js +0 -7
  131. package/src/ascend.js +0 -23
  132. package/src/assoc.js +0 -11
  133. package/src/assocPath.js +0 -46
  134. package/src/binary.js +0 -5
  135. package/src/bind.js +0 -9
  136. package/src/both.js +0 -5
  137. package/src/call.js +0 -1
  138. package/src/chain.js +0 -7
  139. package/src/clamp.js +0 -15
  140. package/src/clone.js +0 -18
  141. package/src/collectBy.js +0 -27
  142. package/src/comparator.js +0 -5
  143. package/src/compose.js +0 -9
  144. package/src/composeWith.js +0 -33
  145. package/src/cond.js +0 -14
  146. package/src/converge.js +0 -18
  147. package/src/curry.js +0 -7
  148. package/src/curryN.js +0 -40
  149. package/src/dec.js +0 -1
  150. package/src/descend.js +0 -17
  151. package/src/difference.js +0 -8
  152. package/src/differenceWith.js +0 -20
  153. package/src/dissoc.js +0 -13
  154. package/src/dissocPath.js +0 -47
  155. package/src/divide.js +0 -5
  156. package/src/dropRepeats.js +0 -20
  157. package/src/dropRepeatsBy.js +0 -21
  158. package/src/dropRepeatsWith.js +0 -28
  159. package/src/either.js +0 -8
  160. package/src/empty.js +0 -15
  161. package/src/endsWith.js +0 -23
  162. package/src/flip.js +0 -23
  163. package/src/forEach.js +0 -19
  164. package/src/forEachObjIndexed.js +0 -24
  165. package/src/fromPairs.js +0 -6
  166. package/src/groupWith.js +0 -46
  167. package/src/gt.js +0 -6
  168. package/src/gte.js +0 -6
  169. package/src/has.js +0 -7
  170. package/src/hasIn.js +0 -9
  171. package/src/hasPath.js +0 -9
  172. package/src/identical.js +0 -7
  173. package/src/identity.js +0 -3
  174. package/src/ifElse.js +0 -17
  175. package/src/inc.js +0 -1
  176. package/src/indexBy.js +0 -29
  177. package/src/insert.js +0 -11
  178. package/src/insertAll.js +0 -7
  179. package/src/is.js +0 -8
  180. package/src/isEmpty.js +0 -18
  181. package/src/isNil.js +0 -3
  182. package/src/isNotEmpty.js +0 -5
  183. package/src/isNotNil.js +0 -3
  184. package/src/isPromise.js +0 -5
  185. package/src/juxt.js +0 -3
  186. package/src/keys.js +0 -3
  187. package/src/length.js +0 -8
  188. package/src/lens.js +0 -7
  189. package/src/lensIndex.js +0 -7
  190. package/src/lensPath.js +0 -7
  191. package/src/lensProp.js +0 -7
  192. package/src/lt.js +0 -6
  193. package/src/lte.js +0 -6
  194. package/src/mathMod.js +0 -8
  195. package/src/max.js +0 -5
  196. package/src/maybe.js +0 -13
  197. package/src/mean.js +0 -5
  198. package/src/median.js +0 -17
  199. package/src/mergeAll.js +0 -11
  200. package/src/mergeDeepLeft.js +0 -5
  201. package/src/mergeDeepRight.js +0 -24
  202. package/src/mergeLeft.js +0 -7
  203. package/src/mergeRight.js +0 -8
  204. package/src/mergeWith.js +0 -25
  205. package/src/min.js +0 -5
  206. package/src/modify.js +0 -23
  207. package/src/modulo.js +0 -5
  208. package/src/move.js +0 -19
  209. package/src/multiply.js +0 -5
  210. package/src/negate.js +0 -3
  211. package/src/not.js +0 -3
  212. package/src/nth.js +0 -9
  213. package/src/of.js +0 -3
  214. package/src/on.js +0 -16
  215. package/src/once.js +0 -24
  216. package/src/or.js +0 -5
  217. package/src/over.js +0 -14
  218. package/src/partial.js +0 -17
  219. package/src/partialObject.js +0 -5
  220. package/src/pathEq.js +0 -11
  221. package/src/pathOr.js +0 -11
  222. package/src/pathSatisfies.js +0 -9
  223. package/src/paths.js +0 -9
  224. package/src/pickAll.js +0 -23
  225. package/src/pickBy.js +0 -11
  226. package/src/product.js +0 -4
  227. package/src/propIs.js +0 -10
  228. package/src/props.js +0 -13
  229. package/src/reduceBy.js +0 -29
  230. package/src/removeIndex.js +0 -7
  231. package/src/repeat.js +0 -7
  232. package/src/reverse.js +0 -9
  233. package/src/set.js +0 -9
  234. package/src/slice.js +0 -9
  235. package/src/splitAt.js +0 -21
  236. package/src/splitWhen.js +0 -25
  237. package/src/startsWith.js +0 -23
  238. package/src/subtract.js +0 -5
  239. package/src/sum.js +0 -3
  240. package/src/swap.js +0 -42
  241. package/src/times.js +0 -12
  242. package/src/toLower.js +0 -3
  243. package/src/toPairs.js +0 -3
  244. package/src/toString.js +0 -3
  245. package/src/toUpper.js +0 -3
  246. package/src/transpose.js +0 -10
  247. package/src/trim.js +0 -3
  248. package/src/unapply.js +0 -5
  249. package/src/unnest.js +0 -9
  250. package/src/values.js +0 -6
  251. package/src/view.js +0 -10
  252. package/src/where.js +0 -15
  253. package/src/whereAny.js +0 -12
  254. package/src/whereEq.js +0 -14
  255. package/src/without.js +0 -15
  256. package/src/xor.js +0 -5
  257. package/src/zipObj.js +0 -13
package/dist/rambda.js CHANGED
@@ -1,1254 +1,597 @@
1
1
  'use strict';
2
2
 
3
- function F() {
4
- return false;
5
- }
6
-
7
- function T() {
8
- return true;
9
- }
10
-
11
- function add(a, b) {
12
- if (arguments.length === 1) return _b => add(a, _b);
13
- return Number(a) + Number(b);
14
- }
15
-
16
- function _concat(set1, set2) {
17
- set1 = set1 || [];
18
- set2 = set2 || [];
19
- let idx;
20
- const len1 = set1.length;
21
- const len2 = set2.length;
22
- const result = [];
23
- idx = 0;
24
- while (idx < len1) {
25
- result[result.length] = set1[idx];
26
- idx += 1;
27
- }
28
- idx = 0;
29
- while (idx < len2) {
30
- result[result.length] = set2[idx];
31
- idx += 1;
32
- }
33
- return result;
34
- }
35
-
36
- function _arity(n, fn) {
37
- switch (n) {
38
- case 0:
39
- return function () {
40
- return fn.apply(this, arguments);
41
- };
42
- case 1:
43
- return function (_1) {
44
- return fn.apply(this, arguments);
45
- };
46
- case 2:
47
- return function (_1, _2) {
48
- return fn.apply(this, arguments);
49
- };
50
- case 3:
51
- return function (_1, _2, _3) {
52
- return fn.apply(this, arguments);
53
- };
54
- case 4:
55
- return function (_1, _2, _3, _4) {
56
- return fn.apply(this, arguments);
57
- };
58
- case 5:
59
- return function (_1, _2, _3, _4, _5) {
60
- return fn.apply(this, arguments);
61
- };
62
- case 6:
63
- return function (_1, _2, _3, _4, _5, _6) {
64
- return fn.apply(this, arguments);
65
- };
66
- case 7:
67
- return function (_1, _2, _3, _4, _5, _6, _7) {
68
- return fn.apply(this, arguments);
69
- };
70
- case 8:
71
- return function (_1, _2, _3, _4, _5, _6, _7, _8) {
72
- return fn.apply(this, arguments);
73
- };
74
- case 9:
75
- return function (_1, _2, _3, _4, _5, _6, _7, _8, _9) {
76
- return fn.apply(this, arguments);
77
- };
78
- default:
79
- return function (_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) {
80
- return fn.apply(this, arguments);
81
- };
82
- }
83
- }
84
-
85
- function _curryN(n, cache, fn) {
86
- return function () {
87
- let ci = 0;
88
- let ai = 0;
89
- const cl = cache.length;
90
- const al = arguments.length;
91
- const args = new Array(cl + al);
92
- while (ci < cl) {
93
- args[ci] = cache[ci];
94
- ci++;
95
- }
96
- while (ai < al) {
97
- args[cl + ai] = arguments[ai];
98
- ai++;
99
- }
100
- const remaining = n - args.length;
101
- return args.length >= n ? fn.apply(this, args) : _arity(remaining, _curryN(n, args, fn));
102
- };
103
- }
104
- function curryN(n, fn) {
105
- if (arguments.length === 1) return _fn => curryN(n, _fn);
106
- if (n > 10) {
107
- throw new Error('First argument to _arity must be a non-negative integer no greater than ten');
108
- }
109
- return _arity(n, _curryN(n, [], fn));
110
- }
111
-
112
- function addIndex(originalFunction, initialIndexFn = () => 0, loopIndexChange = x => x + 1) {
113
- return curryN(originalFunction.length, function () {
114
- const origFn = arguments[0];
115
- const list = arguments[arguments.length - 1];
116
- let idx = initialIndexFn(list.length);
117
- const args = Array.prototype.slice.call(arguments, 0);
118
- args[0] = function () {
119
- const result = origFn.apply(this, _concat(arguments, [idx, list]));
120
- idx = loopIndexChange(idx);
121
- return result;
122
- };
123
- return originalFunction.apply(this, args);
124
- });
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
- function all(predicate, list) {
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 (...input) => {
16
+ return input => {
156
17
  let counter = 0;
157
18
  while (counter < predicates.length) {
158
- if (!predicates[counter](...input)) {
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
- function always(x) {
168
- return _ => x;
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, list) {
177
- if (arguments.length === 1) return _list => any(predicate, _list);
178
- let counter = 0;
179
- while (counter < list.length) {
180
- if (predicate(list[counter], counter)) {
181
- return true;
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
- counter++;
38
+
39
+ return false
184
40
  }
185
- return false;
186
41
  }
187
42
 
188
43
  function anyPass(predicates) {
189
- return (...input) => {
44
+ return input => {
190
45
  let counter = 0;
191
46
  while (counter < predicates.length) {
192
- if (predicates[counter](...input)) {
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
- function ap(functions, input) {
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
- function aperture(step, list) {
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, input) {
224
- if (arguments.length === 1) return _input => append(x, _input);
225
- if (typeof input === 'string') return input.split('').concat(x);
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
- function apply(fn, args) {
232
- if (arguments.length === 1) {
233
- return _args => apply(fn, _args);
234
- }
235
- return fn.apply(this, args);
64
+ return clone
65
+ }
236
66
  }
237
67
 
238
- const {
239
- isArray
240
- } = Array;
241
-
242
- function __findHighestArity(spec, max = 0) {
243
- for (const key in spec) {
244
- if (spec.hasOwnProperty(key) === false || key === 'constructor') continue;
245
- if (typeof spec[key] === 'object') {
246
- max = Math.max(max, __findHighestArity(spec[key]));
247
- }
248
- if (typeof spec[key] === 'function') {
249
- max = Math.max(max, spec[key].length);
250
- }
251
- }
252
- return max;
253
- }
254
- function __filterUndefined() {
255
- const defined = [];
256
- let i = 0;
257
- const l = arguments.length;
258
- while (i < l) {
259
- if (typeof arguments[i] === 'undefined') break;
260
- defined[i] = arguments[i];
261
- i++;
262
- }
263
- return defined;
264
- }
265
- function __applySpecWithArity(spec, arity, cache) {
266
- const remaining = arity - cache.length;
267
- if (remaining === 1) return x => __applySpecWithArity(spec, arity, __filterUndefined(...cache, x));
268
- if (remaining === 2) return (x, y) => __applySpecWithArity(spec, arity, __filterUndefined(...cache, x, y));
269
- if (remaining === 3) return (x, y, z) => __applySpecWithArity(spec, arity, __filterUndefined(...cache, x, y, z));
270
- if (remaining === 4) return (x, y, z, a) => __applySpecWithArity(spec, arity, __filterUndefined(...cache, x, y, z, a));
271
- if (remaining > 4) return (...args) => __applySpecWithArity(spec, arity, __filterUndefined(...cache, ...args));
272
- if (isArray(spec)) {
273
- const ret = [];
274
- let i = 0;
275
- const l = spec.length;
276
- for (; i < l; i++) {
277
- if (typeof spec[i] === 'object' || isArray(spec[i])) {
278
- ret[i] = __applySpecWithArity(spec[i], arity, cache);
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
- if (typeof spec[i] === 'function') {
281
- ret[i] = spec[i](...cache);
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
- function createCompareFunction(a, b, winner, loser) {
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 assocFn(prop, newValue, obj) {
329
- return Object.assign({}, obj, {
330
- [prop]: newValue
331
- });
85
+ function complement(fn) {
86
+ return (...input) => !fn(...input)
332
87
  }
333
- const assoc = curry(assocFn);
334
88
 
335
- function _isInteger(n) {
336
- return n << 0 === n;
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
- function createPath(path, delimiter = '.') {
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 assocPathFn(path, newValue, input) {
346
- const pathArrValue = createPath(path);
347
- if (pathArrValue.length === 0) return newValue;
348
- const index = pathArrValue[0];
349
- if (pathArrValue.length > 1) {
350
- const condition = typeof input !== 'object' || input === null || !input.hasOwnProperty(index);
351
- const nextInput = condition ? isIndexInteger(pathArrValue[1]) ? [] : {} : input[index];
352
- newValue = assocPathFn(Array.prototype.slice.call(pathArrValue, 1), newValue, nextInput);
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
- function bind(fn, thisObj) {
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
- const call = (fn, ...inputs) => fn(...inputs);
105
+ function countBy(fn) {
106
+ return list => {
107
+ const willReturn = {};
381
108
 
382
- function chain(fn, list) {
383
- if (arguments.length === 1) {
384
- return _list => chain(fn, _list);
385
- }
386
- return [].concat(...list.map(fn));
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
- function clampFn(min, max, input) {
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
- class ReduceStopper {
410
- constructor(value) {
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 collectBy(fn, list) {
126
+ function defaultTo(defaultArgument, input) {
436
127
  if (arguments.length === 1) {
437
- return _list => collectBy(fn, _list);
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
- function complement(fn) {
461
- return (...input) => !fn(...input);
131
+ return isFalsy(input) ? defaultArgument : input
462
132
  }
463
133
 
464
- function _pipe(f, g) {
465
- return function () {
466
- return g.call(this, f.apply(this, arguments));
467
- };
468
- }
469
- function pipe() {
470
- if (arguments.length === 0) {
471
- throw new Error('pipe requires at least one argument');
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
- function compose() {
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 head(listOrString) {
484
- if (typeof listOrString === 'string') return listOrString[0] || '';
485
- return listOrString[0];
142
+ function dropLast(numberItems) {
143
+ return list => numberItems > 0
144
+ ? list.slice(0, -numberItems)
145
+ : list.slice()
486
146
  }
487
147
 
488
- function identity(x) {
489
- return x;
490
- }
148
+ function dropLastWhile(predicate) {
149
+ return list => {
150
+ if (list.length === 0) {
151
+ return list
152
+ }
491
153
 
492
- function reverse(listOrString) {
493
- if (typeof listOrString === 'string') {
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
- function drop(howManyToDrop, listOrString) {
501
- if (arguments.length === 1) return _list => drop(howManyToDrop, _list);
502
- return listOrString.slice(howManyToDrop > 0 ? howManyToDrop : 0);
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
- function tail(listOrString) {
506
- return drop(1, listOrString);
507
- }
165
+ while (counter) {
166
+ toReturn.push(list[--counter]);
167
+ }
508
168
 
509
- function pipeWith(xf, list) {
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 concat(x, y) {
527
- if (arguments.length === 1) return _y => concat(x, _y);
528
- return typeof x === 'string' ? `${x}${y}` : [...x, ...y];
529
- }
173
+ function dropWhile(predicate) {
174
+ return iterable => {
175
+ const toReturn = [];
176
+ let counter = 0;
530
177
 
531
- function cond(conditions) {
532
- return (...input) => {
533
- let done = false;
534
- let toReturn;
535
- conditions.forEach(([predicate, getResult]) => {
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
- const {
548
- keys: keys$1
549
- } = Object;
186
+ while (counter < iterable.length) {
187
+ toReturn.push(iterable[counter++]);
188
+ }
550
189
 
551
- function mapArray(fn, list, isIndexed = false) {
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
- function mapObject(fn, obj) {
561
- if (arguments.length === 1) {
562
- return _obj => mapObject(fn, _obj);
193
+
194
+ function type(input) {
195
+ if (input === null) {
196
+ return 'Null'
563
197
  }
564
- let index = 0;
565
- const objKeys = keys$1(obj);
566
- const len = objKeys.length;
567
- const willReturn = {};
568
- while (index < len) {
569
- const key = objKeys[index];
570
- willReturn[key] = fn(obj[key], key, obj);
571
- index++;
198
+ if (input === undefined) {
199
+ return 'Undefined'
572
200
  }
573
- return willReturn;
574
- }
575
- const mapObjIndexed = mapObject;
576
- function map(fn, iterable) {
577
- if (arguments.length === 1) return _iterable => map(fn, _iterable);
578
- if (!iterable) {
579
- throw new Error(INCORRECT_ITERABLE_INPUT);
201
+ if (Number.isNaN(input)) {
202
+ return 'NaN'
580
203
  }
581
- if (isArray(iterable)) return mapArray(fn, iterable);
582
- return mapObject(fn, iterable);
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 count(predicate, list) {
599
- if (arguments.length === 1) {
600
- return _list => count(predicate, _list);
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
- function countBy(fn, list) {
607
- if (arguments.length === 1) {
608
- return _list => countBy(fn, _list);
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 dec = x => x - 1;
218
+ const { length } = list;
219
+ let index = length;
220
+ let foundIndex = -1;
623
221
 
624
- function isFalsy(input) {
625
- return input === undefined || input === null || Number.isNaN(input) === true;
626
- }
627
- function defaultTo(defaultArgument, input) {
628
- if (arguments.length === 1) {
629
- return _input => defaultTo(defaultArgument, _input);
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
- function descend(getFunction, a, b) {
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 type(input) {
644
- if (input === null) {
645
- return 'Null';
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)) return list.lastIndexOf(valueToFind);
659
- const {
660
- length
661
- } = list;
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
- length
675
- } = list;
676
- while (++index < length && foundIndex === -1) if (equals(list[index], valueToFind)) foundIndex = index;
677
- return foundIndex;
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) list.push(next.value);
683
- return list;
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
- function includes$1(valueToFind, iterable) {
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
- class _Set {
767
- constructor() {
768
- this.set = new Set();
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
- function uniq(list) {
798
- const set = new _Set();
799
- const willReturn = [];
800
- list.forEach(item => {
801
- if (set.checkUniqueness(item)) {
802
- willReturn.push(item);
803
- }
804
- });
805
- return willReturn;
806
- }
269
+ const aList = _arrayFromIterator(a.values());
270
+ const bList = _arrayFromIterator(b.values());
807
271
 
808
- function difference(a, b) {
809
- if (arguments.length === 1) return _b => difference(a, _b);
810
- return uniq(a).filter(aInstance => !includes$1(aInstance, b));
811
- }
272
+ const filtered = aList.filter(aInstance => _indexOf(aInstance, bList) === -1);
812
273
 
813
- function differenceWithFn(fn, a, b) {
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 dissoc(prop, obj) {
827
- if (arguments.length === 1) return _obj => dissoc(prop, _obj);
828
- if (obj === null || obj === undefined) return {};
829
- const willReturn = {};
830
- for (const p in obj) {
831
- willReturn[p] = obj[p];
832
- }
833
- delete willReturn[prop];
834
- return willReturn;
835
- }
836
-
837
- function _defineProperty(e, r, t) {
838
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
839
- value: t,
840
- enumerable: !0,
841
- configurable: !0,
842
- writable: !0
843
- }) : e[r] = t, e;
844
- }
845
- function ownKeys(e, r) {
846
- var t = Object.keys(e);
847
- if (Object.getOwnPropertySymbols) {
848
- var o = Object.getOwnPropertySymbols(e);
849
- r && (o = o.filter(function (r) {
850
- return Object.getOwnPropertyDescriptor(e, r).enumerable;
851
- })), t.push.apply(t, o);
852
- }
853
- return t;
854
- }
855
- function _objectSpread2(e) {
856
- for (var r = 1; r < arguments.length; r++) {
857
- var t = null != arguments[r] ? arguments[r] : {};
858
- r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
859
- _defineProperty(e, r, t[r]);
860
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
861
- Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
862
- });
277
+ function compareErrors(a, b) {
278
+ if (a.message !== b.message) {
279
+ return false
863
280
  }
864
- return e;
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
- function compare(a, b) {
882
- return String(a) === String(b);
285
+ return a.toString() === b.toString()
883
286
  }
884
287
 
885
- function includes(a, list) {
886
- let index = -1;
887
- const {
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
- function updateFn(index, newValue, list) {
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 dissocPath(pathInput, input) {
940
- if (arguments.length === 1) return _obj => dissocPath(pathInput, _obj);
941
- const pathArrValue = createPath(pathInput);
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
- function divide(a, b) {
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 dropLast(howManyToDrop, listOrString) {
966
- if (arguments.length === 1) {
967
- return _listOrString => dropLast(howManyToDrop, _listOrString);
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
- function dropLastWhile(predicate, iterable) {
973
- if (arguments.length === 1) {
974
- return _iterable => dropLastWhile(predicate, _iterable);
309
+ const aType = type(a);
310
+
311
+ if (aType !== type(b)) {
312
+ return false
975
313
  }
976
- if (iterable.length === 0) return iterable;
977
- const isArray$1 = isArray(iterable);
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
- if (!isArray$1 && typeof iterable !== 'string') {
982
- throw new Error(`'iterable' is from wrong type ${typeof iterable}`);
317
+
318
+ if (['NaN', 'Null', 'Undefined'].includes(aType)) {
319
+ return true
983
320
  }
984
- const toReturn = [];
985
- let counter = iterable.length;
986
- while (counter) {
987
- const item = iterable[--counter];
988
- if (!predicate(item)) {
989
- toReturn.push(item);
990
- break;
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
- while (counter) {
994
- toReturn.push(iterable[--counter]);
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
- function dropRepeats(list) {
1000
- if (!isArray(list)) {
1001
- throw new Error(`${list} is not a list`);
1002
- }
1003
- const toReturn = [];
1004
- list.reduce((prev, current) => {
1005
- if (!equals(prev, current)) {
1006
- toReturn.push(current);
1007
- }
1008
- return current;
1009
- }, undefined);
1010
- return toReturn;
1011
- }
1012
-
1013
- function dropRepeatsBy(fn, list) {
1014
- if (arguments.length === 1) return _list => dropRepeatsBy(fn, _list);
1015
- let lastEvaluated = null;
1016
- return list.slice().filter(item => {
1017
- if (lastEvaluated === null) {
1018
- lastEvaluated = fn(item);
1019
- return true;
1020
- }
1021
- const evaluatedResult = fn(item);
1022
- if (equals(lastEvaluated, evaluatedResult)) return false;
1023
- lastEvaluated = evaluatedResult;
1024
- return true;
1025
- });
1026
- }
334
+ if (aType === 'Array') {
335
+ const aClone = Array.from(a);
336
+ const bClone = Array.from(b);
1027
337
 
1028
- function dropRepeatsWith(predicate, list) {
1029
- if (arguments.length === 1) {
1030
- return _iterable => dropRepeatsWith(predicate, _iterable);
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
- if (!isArray(list)) {
1033
- throw new Error(`${list} is not a list`);
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
- function dropWhile(predicate, iterable) {
1050
- if (arguments.length === 1) {
1051
- return _iterable => dropWhile(predicate, _iterable);
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
- const isArray$1 = isArray(iterable);
1054
- if (!isArray$1 && typeof iterable !== 'string') {
1055
- throw new Error('`iterable` is neither list nor a string');
373
+ if (bDate[0]) {
374
+ return false
1056
375
  }
1057
- const toReturn = [];
1058
- let counter = 0;
1059
- while (counter < iterable.length) {
1060
- const item = iterable[counter++];
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
- function either(firstPredicate, secondPredicate) {
1073
- if (arguments.length === 1) {
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
- function empty(list) {
1080
- if (typeof list === 'string') return '';
1081
- if (Array.isArray(list)) {
1082
- const {
1083
- name
1084
- } = list.constructor;
1085
- if (name === 'Uint8Array') return Uint8Array.from('');
1086
- if (name === 'Float32Array') return new Float32Array([]);
1087
- return [];
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
- function endsWith(target, iterable) {
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
- function eqByFn(fn, a, b) {
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 propFn(searchProperty, obj) {
1115
- if (!obj) return undefined;
1116
- return obj[searchProperty];
417
+ function eqBy(fn, a) {
418
+ return b => equalsFn(fn(a), fn(b))
1117
419
  }
1118
- function prop(searchProperty, obj) {
1119
- if (arguments.length === 1) return _obj => prop(searchProperty, _obj);
1120
- return propFn(searchProperty, obj);
420
+
421
+ function prop(searchProperty) {
422
+ return obj => (obj ? obj[searchProperty] : undefined)
1121
423
  }
1122
424
 
1123
- function eqPropsFn(property, objA, objB) {
1124
- return equals(prop(property, objA), prop(property, objB));
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
- function evolveArray(rules, list) {
1129
- return mapArray((x, i) => {
1130
- if (type(rules[i]) === 'Function') {
1131
- return rules[i](x);
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
- return x;
1134
- }, list, true);
443
+
444
+ return willReturn
445
+ }
1135
446
  }
1136
- function evolveObject(rules, iterable) {
1137
- return mapObject((x, prop) => {
1138
- if (type(x) === 'Object') {
1139
- const typeRule = type(rules[prop]);
1140
- if (typeRule === 'Function') {
1141
- return rules[prop](x);
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 (typeRule === 'Object') {
1144
- return evolve(rules[prop], x);
461
+ if (type(rules[prop]) === 'Function') {
462
+ return rules[prop](x)
1145
463
  }
1146
- return x;
1147
- }
1148
- if (type(rules[prop]) === 'Function') {
1149
- return rules[prop](x);
1150
- }
1151
- return x;
1152
- }, iterable);
464
+
465
+ return x
466
+ })(obj)
1153
467
  }
1154
- function evolve(rules, iterable) {
1155
- if (arguments.length === 1) {
1156
- return _iterable => evolve(rules, _iterable);
1157
- }
1158
- const rulesType = type(rules);
1159
- const iterableType = type(iterable);
1160
- if (iterableType !== rulesType) {
1161
- throw new Error('iterableType !== rulesType');
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 (!['Object', 'Array'].includes(rulesType)) {
1164
- throw new Error(`'iterable' and 'rules' are from wrong type ${rulesType}`);
479
+ if (!iterable) {
480
+ throw new TypeError(`Cannot read property \'indexOf\' of ${iterable}`)
1165
481
  }
1166
- if (iterableType === 'Object') {
1167
- return evolveObject(rules, iterable);
482
+ if (!isArray(iterable)) {
483
+ return false
1168
484
  }
1169
- return evolveArray(rules, iterable);
485
+
486
+ return _indexOf(valueToFind, iterable) > -1
487
+ }
1170
488
  }
1171
489
 
1172
- function filterObject(predicate, obj) {
1173
- const willReturn = {};
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
- function filterArray(predicate, list, indexed = false) {
1182
- let index = 0;
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
- const predicateResult = indexed ? predicate(list[index], index) : predicate(list[index]);
1187
- if (predicateResult) {
504
+ if (predicate(list[index], index)) {
1188
505
  willReturn.push(list[index]);
1189
506
  }
507
+
1190
508
  index++;
1191
509
  }
1192
- return willReturn;
510
+
511
+ return willReturn
512
+ }
1193
513
  }
1194
- function filter(predicate, iterable) {
1195
- if (arguments.length === 1) return _iterable => filter(predicate, _iterable);
1196
- if (!iterable) {
1197
- throw new Error('Incorrect iterable input');
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, list) {
1204
- if (arguments.length === 1) return _list => find(predicate, _list);
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, list) {
1217
- if (arguments.length === 1) return _list => findIndex(predicate, _list);
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
- return -1;
555
+
556
+ return -1
557
+ }
1226
558
  }
1227
559
 
1228
- function findLast(predicate, list) {
1229
- if (arguments.length === 1) return _list => findLast(predicate, _list);
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
- return undefined;
569
+
570
+ return undefined
571
+ }
1237
572
  }
1238
573
 
1239
- function findLastIndex(fn, list) {
1240
- if (arguments.length === 1) return _list => findLastIndex(fn, _list);
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
- return -1;
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
- function flipFn(fn) {
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 forEachObjIndexedFn(fn, obj) {
1281
- let index = 0;
1282
- const listKeys = keys$1(obj);
1283
- const len = listKeys.length;
1284
- while (index < len) {
1285
- const key = listKeys[index];
1286
- fn(obj[key], key, obj);
1287
- index++;
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
- function groupWith(compareFn, list) {
1332
- if (!isArray(list)) throw new TypeError('list.reduce is not a function');
1333
- const clone = cloneList(list);
1334
- if (list.length === 1) return [clone];
1335
- const toReturn = [];
1336
- let holder = [];
1337
- clone.reduce((prev, current, i) => {
1338
- if (i === 0) return current;
1339
- const okCompare = compareFn(prev, current);
1340
- const holderIsEmpty = holder.length === 0;
1341
- const lastCall = i === list.length - 1;
1342
- if (okCompare) {
1343
- if (holderIsEmpty) holder.push(prev);
1344
- holder.push(current);
1345
- if (lastCall) toReturn.push(holder);
1346
- return current;
1347
- }
1348
- if (holderIsEmpty) {
1349
- toReturn.push([prev]);
1350
- if (lastCall) toReturn.push([current]);
1351
- return current;
1352
- }
1353
- toReturn.push(holder);
1354
- if (lastCall) toReturn.push([current]);
1355
- holder = [];
1356
- return current;
1357
- }, undefined);
1358
- return toReturn;
1359
- }
1360
-
1361
- function gt(a, b) {
1362
- if (arguments.length === 1) return _b => gt(a, _b);
1363
- return a > b;
1364
- }
1365
-
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
- function hasPath(pathInput, obj) {
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 _objectIs(a, b) {
1392
- if (a === b) {
1393
- return a !== 0 || 1 / a === 1 / b;
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
- function indexByPath(pathInput, list) {
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, list) {
1441
- if (arguments.length === 1) {
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
- length
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
- return result;
654
+
655
+ return result
1463
656
  }
1464
657
 
1465
- function init(listOrString) {
1466
- if (typeof listOrString === 'string') return listOrString.slice(0, -1);
1467
- return listOrString.length ? baseSlice(listOrString, 0, -1) : [];
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])) return true;
671
+ if (pred(x, list[idx])) {
672
+ return true
673
+ }
674
+
1475
675
  idx += 1;
1476
676
  }
1477
- return false;
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])) result[result.length] = 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
- function insertFn(indexToInsert, valueToInsert, array) {
1495
- return [...array.slice(0, indexToInsert), valueToInsert, ...array.slice(indexToInsert)];
693
+ return result
1496
694
  }
1497
- const insert = curry(insertFn);
1498
695
 
1499
- function insertAllFn(index, listToInsert, list) {
1500
- return [...list.slice(0, index), ...listToInsert, ...list.slice(index)];
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, listB) {
1505
- if (arguments.length === 1) return _list => intersection(listA, _list);
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, list) {
1510
- if (arguments.length === 1) return _list => intersperse(separator, _list);
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
- function join(glue, list) {
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 keys(x) {
1564
- return Object.keys(x);
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
- function lensPath(key) {
1606
- return lens(path(key), assocPath(key));
731
+ return listOrString[listOrString.length - 1]
1607
732
  }
1608
733
 
1609
- function lensProp(key) {
1610
- return lens(prop(key), assoc(key));
734
+ function lastIndexOf(valueToFind) {
735
+ return list => _lastIndexOf(valueToFind, list)
1611
736
  }
1612
737
 
1613
- function lt(a, b) {
1614
- if (arguments.length === 1) return _b => lt(a, _b);
1615
- return a < b;
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 lte(a, b) {
1619
- if (arguments.length === 1) return _b => lte(a, _b);
1620
- return a <= b;
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
- function match(pattern, input) {
1624
- if (arguments.length === 1) return _input => match(pattern, _input);
1625
- const willReturn = input.match(pattern);
1626
- return willReturn === null ? [] : willReturn;
758
+ return willReturn
759
+ }
1627
760
  }
1628
761
 
1629
- function mathMod(x, y) {
1630
- if (arguments.length === 1) return _y => mathMod(x, _y);
1631
- if (!isInteger(x) || !isInteger(y) || y < 1) return NaN;
1632
- return (x % y + y) % y;
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 maxByFn(compareFn, x, y) {
1636
- return compareFn(y) > compareFn(x) ? y : x;
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 sum(list) {
1641
- return list.reduce((prev, current) => prev + current, 0);
781
+ function maxBy(compareFn, x) {
782
+ return y => (compareFn(y) > compareFn(x) ? y : x)
1642
783
  }
1643
784
 
1644
- function mean(list) {
1645
- return sum(list) / list.length;
785
+ function merge(target) {
786
+ return objectWithNewProps =>
787
+ Object.assign({}, target || {}, objectWithNewProps || {})
1646
788
  }
1647
789
 
1648
- function median(list) {
1649
- const len = list.length;
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 mergeRight(target, newProps) {
1660
- if (arguments.length === 1) return _newProps => mergeRight(target, _newProps);
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 mergeAll(arr) {
1665
- let willReturn = {};
1666
- map(val => {
1667
- willReturn = mergeRight(willReturn, val);
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 mergeDeepRight(target, source) {
804
+ function path(pathInput, obj) {
1673
805
  if (arguments.length === 1) {
1674
- return sourceHolder => mergeDeepRight(target, sourceHolder);
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
- function min(x, y) {
1716
- if (arguments.length === 1) return _y => min(x, _y);
1717
- return y < x ? y : x;
1718
- }
809
+ if (!obj) {
810
+ return undefined
811
+ }
812
+ let willReturn = obj;
813
+ let counter = 0;
1719
814
 
1720
- function minByFn(compareFn, x, y) {
1721
- return compareFn(y) < compareFn(x) ? y : x;
1722
- }
1723
- const minBy = curry(minByFn);
815
+ const pathArrValue = createPath(pathInput);
1724
816
 
1725
- function isIterable(input) {
1726
- return Array.isArray(input) || type(input) === 'Object';
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
- function modifyFn(property, fn, iterable) {
1730
- if (!isIterable(iterable)) return iterable;
1731
- if (iterable[property] === undefined) return iterable;
1732
- if (isArray(iterable)) {
1733
- return updateFn(property, fn(iterable[property]), iterable);
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
- function modifyPathFn(pathInput, fn, object) {
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 modulo(x, y) {
1758
- if (arguments.length === 1) return _y => modulo(x, _y);
1759
- return x % y;
832
+ function assoc(prop, newValue) {
833
+ return obj => Object.assign({}, obj, { [prop]: newValue })
1760
834
  }
1761
835
 
1762
- function moveFn(fromIndex, toIndex, list) {
1763
- if (fromIndex < 0 || toIndex < 0) {
1764
- throw new Error('Rambda.move does not support negative indexes');
1765
- }
1766
- if (fromIndex > list.length - 1 || toIndex > list.length - 1) return list;
1767
- const clone = cloneList(list);
1768
- clone[fromIndex] = list[toIndex];
1769
- clone[toIndex] = list[fromIndex];
1770
- return clone;
1771
- }
1772
- const move = curry(moveFn);
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
- function multiply(x, y) {
1775
- if (arguments.length === 1) return _y => multiply(x, _y);
1776
- return x * y;
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
- function negate(x) {
1780
- return -x;
853
+ return assoc(path$1[0], val)(obj)
1781
854
  }
1782
855
 
1783
- function none(predicate, list) {
1784
- if (arguments.length === 1) return _list => none(predicate, _list);
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 not(input) {
1792
- return !input;
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
- function objOf(key, value) {
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 of(value) {
1805
- return [value];
872
+ function objOf(key) {
873
+ return value => ({ [key]: value })
1806
874
  }
1807
875
 
1808
- function on(binaryFn, unaryFn, a, b) {
1809
- if (arguments.length === 3) {
1810
- return _b => on(binaryFn, unaryFn, a, _b);
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
- function onceFn(fn, context) {
1819
- let result;
1820
- return function () {
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
- function or(a, b) {
1837
- if (arguments.length === 1) return _b => or(a, _b);
1838
- return a || b;
886
+ return false
1839
887
  }
1840
888
 
1841
- const Identity = x => ({
1842
- x,
1843
- map: fn => Identity(fn(x))
1844
- });
1845
- function overFn(lens, fn, object) {
1846
- return lens(x => Identity(fn(x)))(object).x;
1847
- }
1848
- const over = curry(overFn);
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
- function partial(fn, ...args) {
1851
- const len = fn.length;
1852
- const argList = args.length === 1 && isArray(args[0]) ? args[0] : args;
1853
- return (...rest) => {
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
- function partialObject(fn, input) {
1862
- return nextInput => fn(mergeDeepRight(nextInput, input));
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
- return [yes, no];
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
- function pathEqFn(pathToSearch, target, input) {
1899
- return equals(path(pathToSearch, input), target);
935
+ return [yes, no]
1900
936
  }
1901
- const pathEq = curry(pathEqFn);
1902
937
 
1903
- function pathOrFn(defaultValue, pathInput, obj) {
1904
- return defaultTo(defaultValue, path(pathInput, obj));
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 pathSatisfiesFn(fn, pathInput, obj) {
1909
- if (pathInput.length === 0) throw new Error("R.pathSatisfies received an empty path");
1910
- return Boolean(fn(path(pathInput, obj)));
1911
- }
1912
- const pathSatisfies = curry(pathSatisfiesFn);
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
- function paths(pathsToSearch, obj) {
1915
- if (arguments.length === 1) {
1916
- return _obj => paths(pathsToSearch, _obj);
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 pick(propsToPick, input) {
1922
- if (arguments.length === 1) return _input => pick(propsToPick, _input);
1923
- if (input === null || input === undefined) {
1924
- return undefined;
1925
- }
1926
- const keys = createPath(propsToPick, ',');
1927
- const willReturn = {};
1928
- let counter = 0;
1929
- while (counter < keys.length) {
1930
- if (keys[counter] in input) {
1931
- willReturn[keys[counter]] = input[keys[counter]];
968
+ function reduce(reducer, acc) {
969
+ return list => {
970
+ if (list == null) {
971
+ return acc
1932
972
  }
1933
- counter++;
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 pickAll(propsToPick, obj) {
1939
- if (arguments.length === 1) return _obj => pickAll(propsToPick, _obj);
1940
- if (obj === null || obj === undefined) {
1941
- return undefined;
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
- const keysValue = createPath(propsToPick, ',');
1944
- const willReturn = {};
1945
- let counter = 0;
1946
- while (counter < keysValue.length) {
1947
- if (keysValue[counter] in obj) {
1948
- willReturn[keysValue[counter]] = obj[keysValue[counter]];
1949
- } else {
1950
- willReturn[keysValue[counter]] = undefined;
1951
- }
1952
- counter++;
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 pickBy(predicate, obj) {
1958
- if (arguments.length === 1) {
1959
- return _obj => pickBy(predicate, _obj);
1047
+ function pipeFn() {
1048
+ if (arguments.length === 0) {
1049
+ throw new Error('pipe requires at least one argument')
1960
1050
  }
1961
- return Object.keys(obj).reduce((accum, key) => {
1962
- if (predicate(obj[key], key, obj)) {
1963
- accum[key] = obj[key];
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
- return accum;
1966
- }, {});
1073
+ return willReturn
1967
1074
  }
1968
1075
 
1969
- function pluck(property, list) {
1970
- if (arguments.length === 1) return _list => pluck(property, _list);
1076
+ function pluck(property) {
1077
+ return list => {
1971
1078
  const willReturn = [];
1972
- map(x => {
1079
+
1080
+ list.forEach(x => {
1973
1081
  if (x[property] !== undefined) {
1974
1082
  willReturn.push(x[property]);
1975
1083
  }
1976
- }, list);
1977
- return willReturn;
1084
+ });
1085
+
1086
+ return willReturn
1087
+ }
1978
1088
  }
1979
1089
 
1980
- function prepend(x, input) {
1981
- if (arguments.length === 1) return _input => prepend(x, _input);
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
- const product = reduce(multiply, 1);
1094
+ function propEq(valueToMatch, propToFind) {
1095
+ return obj => {
1096
+ if (!obj) {
1097
+ return false
1098
+ }
1987
1099
 
1988
- function propEqFn(valueToMatch, propToFind, obj) {
1989
- if (!obj) return false;
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 propIsFn(targetPrototype, property, obj) {
1995
- return is(targetPrototype, obj[property]);
1996
- }
1997
- const propIs = curry(propIsFn);
1104
+ function propOr(defaultValue, property) {
1105
+ return obj => {
1106
+ if (!obj) {
1107
+ return defaultValue
1108
+ }
1998
1109
 
1999
- function propOrFn(defaultValue, property, obj) {
2000
- if (!obj) return defaultValue;
2001
- return defaultTo(defaultValue, obj[property]);
1110
+ return defaultTo(defaultValue, obj[property])
1111
+ }
2002
1112
  }
2003
- const propOr = curry(propOrFn);
2004
1113
 
2005
- function propSatisfiesFn(predicate, property, obj) {
2006
- return predicate(prop(property, obj));
1114
+ function propSatisfies(predicate, property) {
1115
+ return obj => predicate(prop(property))
2007
1116
  }
2008
- const propSatisfies = curry(propSatisfiesFn);
2009
1117
 
2010
- function props(propsToPick, obj) {
2011
- if (arguments.length === 1) {
2012
- return _obj => props(propsToPick, _obj);
2013
- }
2014
- if (!isArray(propsToPick)) {
2015
- throw new Error('propsToPick is not a list');
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
- function range(start, end) {
2021
- if (arguments.length === 1) return _end => range(start, _end);
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
- for (let i = 0; i < len; i++) {
2029
- willReturn[i] = start + i;
1128
+
1129
+ for (let i = 0; i < len; i++){
1130
+ willReturn[ i ] = start + i;
2030
1131
  }
2031
- return willReturn;
2032
- }
2033
1132
 
2034
- function reduceByFunction(valueFn, valueAcc, keyFn, acc, elt) {
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, list) {
2046
- if (arguments.length === 1) return _list => reject(predicate, _list);
2047
- return filter(x => !predicate(x), list);
1137
+ function reject(predicate) {
1138
+ return list => filter(x => !predicate(x))
2048
1139
  }
2049
1140
 
2050
- function repeat(x, timesToRepeat) {
2051
- if (arguments.length === 1) {
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 replaceFn(pattern, replacer, str) {
2058
- return str.replace(pattern, replacer);
2059
- }
2060
- const replace = curry(replaceFn);
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
- function setFn(lens, replacer, x) {
2063
- return over(lens, always(replacer), x);
2064
- }
2065
- const set = curry(setFn);
1152
+ const clone = cloneList(list);
1153
+ clone[actualIndex] = replaceFn(clone[actualIndex]);
2066
1154
 
2067
- function sliceFn(from, to, list) {
2068
- return list.slice(from, to);
1155
+ return clone
1156
+ }
2069
1157
  }
2070
- const slice = curry(sliceFn);
2071
1158
 
2072
- function sort(sortFn, list) {
2073
- if (arguments.length === 1) return _list => sort(sortFn, _list);
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, list) {
2078
- if (arguments.length === 1) return _list => sortBy(sortFn, _list);
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
- if (aSortResult === bSortResult) return 0;
2084
- return aSortResult < bSortResult ? -1 : 1;
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
- return result;
1185
+
1186
+ return result
2096
1187
  }
2097
- function sortWith(listOfSortingFns, list) {
2098
- if (arguments.length === 1) return _list => sortWith(listOfSortingFns, _list);
2099
- if (Array.isArray(list) === false) return [];
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
- function maybe(ifRule, whenIf, whenElse) {
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 splitAt(index, input) {
2124
- if (arguments.length === 1) {
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, listOrString) {
2134
- if (arguments.length === 1) {
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
- function splitWhen(predicate, input) {
2149
- if (arguments.length === 1) {
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
- function startsWith(question, iterable) {
2171
- if (arguments.length === 1) return _iterable => startsWith(question, _iterable);
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 subtract(a, b) {
2187
- if (arguments.length === 1) return _b => subtract(a, _b);
2188
- return a - b;
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 swapArrayOrString(indexA, indexB, iterable) {
2192
- const actualIndexA = indexA < 0 ? iterable.length + indexA : indexA;
2193
- const actualIndexB = indexB < 0 ? iterable.length + indexB : indexB;
2194
- if (actualIndexA === actualIndexB || Math.min(actualIndexA, actualIndexB) < 0 || Math.max(actualIndexA, actualIndexB) >= iterable.length) return iterable;
2195
- if (typeof iterable === 'string') {
2196
- return iterable.slice(0, actualIndexA) + iterable[actualIndexB] + iterable.slice(actualIndexA + 1, actualIndexB) + iterable[actualIndexA] + iterable.slice(actualIndexB + 1);
2197
- }
2198
- const clone = iterable.slice();
2199
- const temp = clone[actualIndexA];
2200
- clone[actualIndexA] = clone[actualIndexB];
2201
- clone[actualIndexB] = temp;
2202
- return clone;
2203
- }
2204
- function swapFn(indexA, indexB, iterable) {
2205
- if (isArray(iterable) || typeof iterable === 'string') return swapArrayOrString(indexA, indexB, iterable);
2206
- const aVal = iterable[indexA];
2207
- const bVal = iterable[indexB];
2208
- if (aVal === undefined || bVal === undefined) return iterable;
2209
- return _objectSpread2(_objectSpread2({}, iterable), {}, {
2210
- [indexA]: iterable[indexB],
2211
- [indexB]: iterable[indexA]
2212
- });
1230
+ function tail(listOrString) {
1231
+ return drop(1)(listOrString)
2213
1232
  }
2214
- const swap = curry(swapFn);
2215
1233
 
2216
- function symmetricDifference(x, y) {
2217
- if (arguments.length === 1) {
2218
- return _y => symmetricDifference(x, _y);
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(howMany, listOrString) {
2224
- if (arguments.length === 1) return _listOrString => takeLast(howMany, _listOrString);
2225
- const len = listOrString.length;
2226
- if (howMany < 0) return listOrString.slice();
2227
- let numValue = howMany > len ? len : howMany;
2228
- if (typeof listOrString === 'string') return listOrString.slice(len - numValue);
2229
- numValue = len - numValue;
2230
- return baseSlice(listOrString, numValue, len);
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
- function takeLastWhile(predicate, input) {
2234
- if (arguments.length === 1) {
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
- toReturn.push(item);
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 takeWhile(predicate, iterable) {
2251
- if (arguments.length === 1) {
2252
- return _iterable => takeWhile(predicate, _iterable);
2253
- }
2254
- const isArray$1 = isArray(iterable);
2255
- if (!isArray$1 && typeof iterable !== 'string') {
2256
- throw new Error('`iterable` is neither list nor a string');
2257
- }
2258
- const toReturn = [];
2259
- let counter = 0;
2260
- while (counter < iterable.length) {
2261
- const item = iterable[counter++];
2262
- if (!predicate(item)) {
2263
- break;
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.push(item);
1298
+ return toReturn
2266
1299
  }
2267
- return isArray$1 ? toReturn : toReturn.join('');
2268
1300
  }
2269
1301
 
2270
- function tap(fn, x) {
2271
- if (arguments.length === 1) return _x => tap(fn, _x);
1302
+ function tap(fn) {
1303
+ return x => {
2272
1304
  fn(x);
2273
- return x;
1305
+
1306
+ return x
1307
+ }
2274
1308
  }
2275
1309
 
2276
- function test(pattern, str) {
2277
- if (arguments.length === 1) return _str => test(pattern, _str);
2278
- if (typeof pattern === 'string') {
2279
- throw new TypeError(`R.test requires a value of type RegExp as its first argument; received "${pattern}"`);
2280
- }
2281
- return str.search(pattern) !== -1;
1310
+ function test(pattern) {
1311
+ return str => str.search(pattern) !== -1
2282
1312
  }
2283
1313
 
2284
- function times(fn, howMany) {
2285
- if (arguments.length === 1) return _howMany => times(fn, _howMany);
2286
- if (!isInteger(howMany) || howMany < 0) {
2287
- throw new RangeError('n must be an integer');
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 toLower(str) {
2293
- return str.toLowerCase();
2294
- }
1324
+ function union(x) {
1325
+ return y => {
1326
+ const toReturn = cloneList(x);
2295
1327
 
2296
- function toPairs(obj) {
2297
- return Object.entries(obj);
2298
- }
1328
+ y.forEach(yInstance => {
1329
+ if (!includes(yInstance)(x)) {
1330
+ toReturn.push(yInstance);
1331
+ }
1332
+ });
2299
1333
 
2300
- function toString(x) {
2301
- return x.toString();
1334
+ return toReturn
1335
+ }
2302
1336
  }
2303
1337
 
2304
- function toUpper(str) {
2305
- return str.toUpperCase();
2306
- }
1338
+ class _Set {
1339
+ constructor() {
1340
+ this.set = new Set();
1341
+ this.items = {};
1342
+ }
2307
1343
 
2308
- function transpose(array) {
2309
- return array.reduce((acc, el) => {
2310
- el.forEach((nestedEl, i) => isArray(acc[i]) ? acc[i].push(nestedEl) : acc.push([nestedEl]));
2311
- return acc;
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
- function trim(str) {
2316
- return str.trim();
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
- const isFunction = x => ['Promise', 'Function'].includes(type(x));
2320
- function tryCatch(fn, fallback) {
2321
- if (!isFunction(fn)) {
2322
- throw new Error(`R.tryCatch | fn '${fn}'`);
2323
- }
2324
- const passFallback = isFunction(fallback);
2325
- return (...inputs) => {
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
- function unapply(fn) {
2335
- return function (...args) {
2336
- return fn.call(this, args);
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 union(x, y) {
2341
- if (arguments.length === 1) return _y => union(x, _y);
2342
- const toReturn = cloneList(x);
2343
- y.forEach(yInstance => {
2344
- if (!includes$1(yInstance, x)) toReturn.push(yInstance);
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
- return toReturn;
1385
+
1386
+ return willReturn
2347
1387
  }
2348
1388
 
2349
- function uniqBy(fn, list) {
2350
- if (arguments.length === 1) {
2351
- return _list => uniqBy(fn, _list);
2352
- }
2353
- const set = new _Set();
2354
- return list.filter(item => set.checkUniqueness(fn(item)));
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
- return willReturn;
1408
+
1409
+ return willReturn
2367
1410
  }
2368
- function uniqWith(predicate, list) {
2369
- if (arguments.length === 1) return _list => uniqWith(predicate, _list);
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
- function unlessFn(predicate, whenFalseFn, input) {
2382
- if (predicate(input)) return input;
2383
- return whenFalseFn(input);
1425
+ return willReturn
1426
+ }
2384
1427
  }
2385
- const unless = curry(unlessFn);
2386
1428
 
2387
- function unnest(list) {
2388
- return list.reduce((acc, item) => {
2389
- if (Array.isArray(item)) {
2390
- return [...acc, ...item];
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
- function unwind(property, obj) {
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 whenFn(predicate, whenTrueFn, input) {
2421
- if (!predicate(input)) return input;
2422
- return whenTrueFn(input);
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 where(conditions, input) {
2427
- if (input === undefined) {
2428
- return _input => where(conditions, _input);
2429
- }
2430
- let flag = true;
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 whereAny(conditions, input) {
2442
- if (input === undefined) {
2443
- return _input => whereAny(conditions, _input);
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
- function whereEq(condition, input) {
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 without(matchAgainst, source) {
2462
- if (source === undefined) {
2463
- return _source => without(matchAgainst, _source);
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
- function xor(a, b) {
2469
- if (arguments.length === 1) return _b => xor(a, _b);
2470
- return Boolean(a) && !b || Boolean(b) && !a;
2471
- }
1474
+ for (let i = 0; i < length; i++) {
1475
+ result[i] = [left[i], right[i]];
1476
+ }
2472
1477
 
2473
- function zip(left, right) {
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 zipWithFn(fn, x, y) {
2492
- return take(x.length > y.length ? y.length : x.length, x).map((xInstance, i) => fn(xInstance, y[i]));
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.F = F;
2497
- exports.T = T;
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.apply = apply;
2516
- exports.applySpec = applySpec;
2517
- exports.applyTo = applyTo;
2518
- exports.ascend = ascend;
2519
- exports.assoc = assoc;
2520
- exports.assocFn = assocFn;
2521
- exports.assocPath = assocPath;
2522
- exports.assocPathFn = assocPathFn;
2523
- exports.binary = binary;
2524
- exports.bind = bind;
2525
- exports.both = both;
2526
- exports.call = call;
2527
- exports.chain = chain;
2528
- exports.clamp = clamp;
2529
- exports.clone = clone;
2530
- exports.collectBy = collectBy;
2531
- exports.comparator = comparator;
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.evolveArray = evolveArray;
2568
- exports.evolveObject = evolveObject;
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.identical = identical;
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.mapArray = mapArray;
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.maxByFn = maxByFn;
2632
- exports.mean = mean;
2633
- exports.median = median;
2634
- exports.merge = mergeRight;
2635
- exports.mergeAll = mergeAll;
2636
- exports.mergeDeepLeft = mergeDeepLeft;
2637
- exports.mergeDeepRight = mergeDeepRight;
2638
- exports.mergeLeft = mergeLeft;
2639
- exports.mergeRight = mergeRight;
2640
- exports.mergeWith = mergeWith;
2641
- exports.mergeWithFn = mergeWithFn;
2642
- exports.min = min;
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.pipeWith = pipeWith;
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.reverse = reverse;
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;