Comparing version 7.0.3 to 7.1.0
@@ -1,3 +0,7 @@ | ||
WIP 7.1.0 | ||
7.1.0 | ||
- Add `R.mergeRight` - introduced by Ramda's latest release. While Ramda renames `R.merge`, Rambda will keep `R.merge`. | ||
- Rambda's `pipe/compose` doesn't return proper length of composed function which leads to issue with `R.applySpec`. It was fixed by using Ramda's `pipe/compose` logic - [Issue #627](https://github.com/selfrefactor/rambda/issues/627) | ||
- Replace `Async` with `Promise` as return type of `R.type`. | ||
@@ -7,5 +11,17 @@ | ||
- Add `R.juxt` method | ||
- Add `R.propSatisfies` method | ||
- Add new methods after `Ramda` version upgrade to `0.28.0`: | ||
-- R.count | ||
-- R.modifyPath | ||
-- R.on | ||
-- R.whereAny | ||
-- R.partialObject | ||
7.0.3 | ||
Rambda.none has wrong logic - [Issue #625](https://github.com/selfrefactor/rambda/issues/625) | ||
Rambda.none has wrong logic introduced in version `7.0.0` - [Issue #625](https://github.com/selfrefactor/rambda/issues/625) | ||
@@ -12,0 +28,0 @@ 7.0.2 |
@@ -18,2 +18,4 @@ 'use strict'; | ||
const cloneList = list => Array.prototype.slice.call(list); | ||
function curry(fn, args = []) { | ||
@@ -23,6 +25,2 @@ return (..._args) => (rest => rest.length >= fn.length ? fn(...rest) : curry(fn, rest))([...args, ..._args]); | ||
const cloneList = list => { | ||
return Array.prototype.slice.call(list); | ||
}; | ||
function adjustFn(index, replaceFn, list) { | ||
@@ -65,3 +63,3 @@ const actualIndex = index < 0 ? list.length + index : index; | ||
function always(x) { | ||
return () => x; | ||
return _ => x; | ||
} | ||
@@ -267,7 +265,7 @@ | ||
const remaining = n - args.length; | ||
return args.length >= n ? fn.apply(this, args) : _arity(remaining, _curryN(n, args, fn)); | ||
return args.length >= n ? fn.apply(this, args) : _arity$1(remaining, _curryN(n, args, fn)); | ||
}; | ||
} | ||
function _arity(n, fn) { | ||
function _arity$1(n, fn) { | ||
switch (n) { | ||
@@ -338,3 +336,3 @@ case 0: | ||
return _arity(n, _curryN(n, [], fn)); | ||
return _arity$1(n, _curryN(n, [], fn)); | ||
} | ||
@@ -391,23 +389,103 @@ | ||
function compose(...fns) { | ||
if (fns.length === 0) { | ||
throw new Error('compose requires at least one argument'); | ||
const _keys = Object.keys; | ||
function reduceFn(reducer, acc, list) { | ||
if (!_isArray(list)) { | ||
throw new TypeError('reduce: list must be array or iterable'); | ||
} | ||
return function (...args) { | ||
const list = fns.slice(); | ||
let index = 0; | ||
const len = list.length; | ||
if (list.length > 0) { | ||
const fn = list.pop(); | ||
let result = fn.apply(this, args); | ||
while (index < len) { | ||
acc = reducer(acc, list[index], index, list); | ||
index++; | ||
} | ||
while (list.length > 0) { | ||
result = list.pop()(result); | ||
} | ||
return acc; | ||
} | ||
const reduce = curry(reduceFn); | ||
return result; | ||
} | ||
function _arity(n, fn) { | ||
switch (n) { | ||
case 0: | ||
return function () { | ||
return fn.apply(this, arguments); | ||
}; | ||
case 1: | ||
return function (a0) { | ||
return fn.apply(this, arguments); | ||
}; | ||
case 2: | ||
return function (a0, a1) { | ||
return fn.apply(this, arguments); | ||
}; | ||
case 3: | ||
return function (a0, a1, a2) { | ||
return fn.apply(this, arguments); | ||
}; | ||
case 4: | ||
return function (a0, a1, a2, a3) { | ||
return fn.apply(this, arguments); | ||
}; | ||
case 5: | ||
return function (a0, a1, a2, a3, a4) { | ||
return fn.apply(this, arguments); | ||
}; | ||
case 6: | ||
return function (a0, a1, a2, a3, a4, a5) { | ||
return fn.apply(this, arguments); | ||
}; | ||
case 7: | ||
return function (a0, a1, a2, a3, a4, a5, a6) { | ||
return fn.apply(this, arguments); | ||
}; | ||
case 8: | ||
return function (a0, a1, a2, a3, a4, a5, a6, a7) { | ||
return fn.apply(this, arguments); | ||
}; | ||
case 9: | ||
return function (a0, a1, a2, a3, a4, a5, a6, a7, a8) { | ||
return fn.apply(this, arguments); | ||
}; | ||
case 10: | ||
return function (a0, a1, a2, a3, a4, a5, a6, a7, a8, a9) { | ||
return fn.apply(this, arguments); | ||
}; | ||
default: | ||
throw new Error('First argument to _arity must be a non-negative integer no greater than ten'); | ||
} | ||
} | ||
function _pipe(f, g) { | ||
return function () { | ||
return g.call(this, f.apply(this, arguments)); | ||
}; | ||
} | ||
function pipe() { | ||
if (arguments.length === 0) { | ||
throw new Error('pipe requires at least one argument'); | ||
} | ||
return _arity(arguments[0].length, reduceFn(_pipe, arguments[0], Array.prototype.slice.call(arguments, 1, Infinity))); | ||
} | ||
function compose() { | ||
if (arguments.length === 0) { | ||
throw new Error('compose requires at least one argument'); | ||
} | ||
return pipe.apply(this, Array.prototype.slice.call(arguments, 0).reverse()); | ||
} | ||
function concat(x, y) { | ||
@@ -432,4 +510,2 @@ if (arguments.length === 1) return _y => concat(x, _y); | ||
const _keys = Object.keys; | ||
function mapArray(fn, list, isIndexed = false) { | ||
@@ -479,26 +555,35 @@ let index = 0; | ||
function reduceFn(reducer, acc, list) { | ||
if (!_isArray(list)) { | ||
throw new TypeError('reduce: list must be array or iterable'); | ||
function converge(fn, transformers) { | ||
if (arguments.length === 1) return _transformers => converge(fn, _transformers); | ||
const highestArity = reduce((a, b) => max(a, b.length), 0, transformers); | ||
return curryN(highestArity, function () { | ||
return fn.apply(this, map(g => g.apply(this, arguments), transformers)); | ||
}); | ||
} | ||
function count(predicate, list) { | ||
if (arguments.length === 1) { | ||
return _list => count(predicate, _list); | ||
} | ||
let index = 0; | ||
const len = list.length; | ||
if (!_isArray(list)) return 0; | ||
return list.filter(x => predicate(x)).length; | ||
} | ||
while (index < len) { | ||
acc = reducer(acc, list[index], index, list); | ||
index++; | ||
function countBy(fn, list) { | ||
if (arguments.length === 1) { | ||
return _list => countBy(fn, _list); | ||
} | ||
return acc; | ||
} | ||
const willReturn = {}; | ||
list.forEach(item => { | ||
const key = fn(item); | ||
const reduce = curry(reduceFn); | ||
function converge(fn, transformers) { | ||
if (arguments.length === 1) return _transformers => converge(fn, _transformers); | ||
const highestArity = reduce((a, b) => max(a, b.length), 0, transformers); | ||
return curryN(highestArity, function () { | ||
return fn.apply(this, map(g => g.apply(this, arguments), transformers)); | ||
if (!willReturn[key]) { | ||
willReturn[key] = 1; | ||
} else { | ||
willReturn[key]++; | ||
} | ||
}); | ||
return willReturn; | ||
} | ||
@@ -530,3 +615,3 @@ | ||
const typeResult = Object.prototype.toString.call(input).slice(8, -1); | ||
return typeResult === 'AsyncFunction' ? 'Async' : typeResult; | ||
return typeResult === 'AsyncFunction' ? 'Promise' : typeResult; | ||
} | ||
@@ -1125,3 +1210,3 @@ | ||
throw new Error("R.flip doesn't work with arity > 4"); | ||
throw new Error('R.flip doesn\'t work with arity > 4'); | ||
}; | ||
@@ -1229,2 +1314,6 @@ } | ||
function createPath(path, delimiter = '.') { | ||
return typeof path === 'string' ? path.split(delimiter) : path; | ||
} | ||
function path(pathInput, obj) { | ||
@@ -1239,3 +1328,3 @@ if (arguments.length === 1) return _obj => path(pathInput, _obj); | ||
let counter = 0; | ||
const pathArrValue = typeof pathInput === 'string' ? pathInput.split('.') : pathInput; | ||
const pathArrValue = createPath(pathInput); | ||
@@ -1419,2 +1508,6 @@ while (counter < pathArrValue.length) { | ||
function juxt(listOfFunctions) { | ||
return (...args) => listOfFunctions.map(fn => fn(...args)); | ||
} | ||
function keys(x) { | ||
@@ -1454,6 +1547,6 @@ return Object.keys(x); | ||
function nth(index, list) { | ||
if (arguments.length === 1) return _list => nth(index, _list); | ||
const idx = index < 0 ? list.length + index : index; | ||
return Object.prototype.toString.call(list) === '[object String]' ? list.charAt(idx) : list[idx]; | ||
function nth(index, input) { | ||
if (arguments.length === 1) return _input => nth(index, _input); | ||
const idx = index < 0 ? input.length + index : index; | ||
return Object.prototype.toString.call(input) === '[object String]' ? input.charAt(idx) : input[idx]; | ||
} | ||
@@ -1517,4 +1610,4 @@ | ||
function merge(target, newProps) { | ||
if (arguments.length === 1) return _newProps => merge(target, _newProps); | ||
function mergeRight(target, newProps) { | ||
if (arguments.length === 1) return _newProps => mergeRight(target, _newProps); | ||
return Object.assign({}, target || {}, newProps || {}); | ||
@@ -1526,3 +1619,3 @@ } | ||
map(val => { | ||
willReturn = merge(willReturn, val); | ||
willReturn = mergeRight(willReturn, val); | ||
}, arr); | ||
@@ -1554,5 +1647,28 @@ return willReturn; | ||
if (arguments.length === 1) return _y => mergeLeft(x, _y); | ||
return merge(y, x); | ||
return mergeRight(y, x); | ||
} | ||
function mergeWithFn(mergeFn, a, b) { | ||
const willReturn = {}; | ||
Object.keys(a).forEach(key => { | ||
if (b[key] === undefined) { | ||
willReturn[key] = a[key]; | ||
} else { | ||
willReturn[key] = mergeFn(a[key], b[key]); | ||
} | ||
}); | ||
Object.keys(b).forEach(key => { | ||
if (willReturn[key] !== undefined) return; | ||
if (a[key] === undefined) { | ||
willReturn[key] = b[key]; | ||
} else { | ||
willReturn[key] = mergeFn(a[key], b[key]); | ||
} | ||
}); | ||
return willReturn; | ||
} | ||
const mergeWith = curry(mergeWithFn); | ||
function min(x, y) { | ||
@@ -1631,3 +1747,3 @@ if (arguments.length === 1) return _y => min(x, _y); | ||
const propsToOmitValue = typeof propsToOmit === 'string' ? propsToOmit.split(',') : propsToOmit; | ||
const propsToOmitValue = createPath(propsToOmit, ','); | ||
const willReturn = {}; | ||
@@ -1644,2 +1760,14 @@ | ||
function on(binaryFn, unaryFn, a, b) { | ||
if (arguments.length === 3) { | ||
return _b => on(binaryFn, unaryFn, a, _b); | ||
} | ||
if (arguments.length === 2) { | ||
return (_a, _b) => on(binaryFn, unaryFn, _a, _b); | ||
} | ||
return binaryFn(unaryFn(a), unaryFn(b)); | ||
} | ||
function onceFn(fn, context) { | ||
@@ -1693,2 +1821,14 @@ let result; | ||
function partialObject(fn, input) { | ||
return rest => { | ||
if (type(fn) === 'Async') { | ||
return new Promise((resolve, reject) => { | ||
fn(mergeDeepRight(rest, input)).then(resolve).catch(reject); | ||
}); | ||
} | ||
return fn(mergeDeepRight(rest, input)); | ||
}; | ||
} | ||
function partitionObject(predicate, iterable) { | ||
@@ -1757,3 +1897,3 @@ const yes = {}; | ||
const keys = typeof propsToPick === 'string' ? propsToPick.split(',') : propsToPick; | ||
const keys = createPath(propsToPick, ','); | ||
const willReturn = {}; | ||
@@ -1780,3 +1920,3 @@ let counter = 0; | ||
const keysValue = typeof propsToPick === 'string' ? propsToPick.split(',') : propsToPick; | ||
const keysValue = createPath(propsToPick, ','); | ||
const willReturn = {}; | ||
@@ -1798,20 +1938,2 @@ let counter = 0; | ||
function pipe(...fns) { | ||
if (fns.length === 0) throw new Error('pipe requires at least one argument'); | ||
return (...args) => { | ||
const list = fns.slice(); | ||
if (list.length > 0) { | ||
const fn = list.shift(); | ||
let result = fn(...args); | ||
while (list.length > 0) { | ||
result = list.shift()(result); | ||
} | ||
return result; | ||
} | ||
}; | ||
} | ||
function pluck(property, list) { | ||
@@ -1856,2 +1978,8 @@ if (arguments.length === 1) return _list => pluck(property, _list); | ||
function propSatisfiesFn(predicate, property, obj) { | ||
return predicate(prop(property, obj)); | ||
} | ||
const propSatisfies = curry(propSatisfiesFn); | ||
function props(propsToPick, obj) { | ||
@@ -2162,5 +2290,3 @@ if (arguments.length === 1) { | ||
function isFunction(fn) { | ||
return ['Async', 'Function'].includes(type(fn)); | ||
} | ||
const isFunction = x => ['Promise', 'Function'].includes(type(x)); | ||
@@ -2236,2 +2362,54 @@ function tryCatch(fn, fallback) { | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
enumerableOnly && (symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
})), keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _objectSpread2(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = null != arguments[i] ? arguments[i] : {}; | ||
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
return target; | ||
} | ||
function _defineProperty(obj, key, value) { | ||
if (key in obj) { | ||
Object.defineProperty(obj, key, { | ||
value: value, | ||
enumerable: true, | ||
configurable: true, | ||
writable: true | ||
}); | ||
} else { | ||
obj[key] = value; | ||
} | ||
return obj; | ||
} | ||
function unwind(property, obj) { | ||
if (arguments.length === 1) { | ||
return _obj => unwind(property, _obj); | ||
} | ||
if (!_isArray(obj[property])) return [obj]; | ||
return mapArray(x => _objectSpread2(_objectSpread2({}, obj), {}, { | ||
[property]: x | ||
}), obj[property]); | ||
} | ||
function values(obj) { | ||
@@ -2277,2 +2455,16 @@ if (type(obj) !== 'Object') return []; | ||
function whereAny(conditions, input) { | ||
if (input === undefined) { | ||
return _input => whereAny(conditions, _input); | ||
} | ||
for (const prop in conditions) { | ||
if (conditions[prop](input[prop])) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
function whereEq(condition, input) { | ||
@@ -2328,4 +2520,7 @@ if (arguments.length === 1) { | ||
exports.T = T; | ||
exports.__findHighestArity = __findHighestArity; | ||
exports._arity = _arity; | ||
exports._indexOf = _indexOf; | ||
exports._lastIndexOf = _lastIndexOf; | ||
exports._pipe = _pipe; | ||
exports.add = add; | ||
@@ -2354,2 +2549,4 @@ exports.adjust = adjust; | ||
exports.converge = converge; | ||
exports.count = count; | ||
exports.countBy = countBy; | ||
exports.curry = curry; | ||
@@ -2405,2 +2602,3 @@ exports.curryN = curryN; | ||
exports.join = join; | ||
exports.juxt = juxt; | ||
exports.keys = keys; | ||
@@ -2425,6 +2623,8 @@ exports.last = last; | ||
exports.median = median; | ||
exports.merge = merge; | ||
exports.merge = mergeRight; | ||
exports.mergeAll = mergeAll; | ||
exports.mergeDeepRight = mergeDeepRight; | ||
exports.mergeLeft = mergeLeft; | ||
exports.mergeRight = mergeRight; | ||
exports.mergeWith = mergeWith; | ||
exports.min = min; | ||
@@ -2443,2 +2643,3 @@ exports.minBy = minBy; | ||
exports.omit = omit; | ||
exports.on = on; | ||
exports.once = once; | ||
@@ -2448,2 +2649,3 @@ exports.or = or; | ||
exports.partial = partial; | ||
exports.partialObject = partialObject; | ||
exports.partition = partition; | ||
@@ -2466,5 +2668,7 @@ exports.partitionArray = partitionArray; | ||
exports.propOr = propOr; | ||
exports.propSatisfies = propSatisfies; | ||
exports.props = props; | ||
exports.range = range; | ||
exports.reduce = reduce; | ||
exports.reduceFn = reduceFn; | ||
exports.reject = reject; | ||
@@ -2507,2 +2711,3 @@ exports.repeat = repeat; | ||
exports.unless = unless; | ||
exports.unwind = unwind; | ||
exports.update = update; | ||
@@ -2513,2 +2718,3 @@ exports.values = values; | ||
exports.where = where; | ||
exports.whereAny = whereAny; | ||
exports.whereEq = whereEq; | ||
@@ -2515,0 +2721,0 @@ exports.without = without; |
@@ -1,1 +0,1 @@ | ||
!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((n="undefined"!=typeof globalThis?globalThis:n||self).R={})}(this,function(n){"use strict";function l(n){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}function u(n,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(n,e.key,e)}}function e(n,r,t){return r in n?Object.defineProperty(n,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[r]=t,n}function i(n,r){return function(n){if(Array.isArray(n))return n}(n)||function(n,r){var t=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=t){var e,u,i=[],o=!0,f=!1;try{for(t=t.call(n);!(o=(e=t.next()).done)&&(i.push(e.value),!r||i.length!==r);o=!0);}catch(n){f=!0,u=n}finally{try{o||null==t.return||t.return()}finally{if(f)throw u}}return i}}(n,r)||t(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(n){return function(n){if(Array.isArray(n))return o(n)}(n)||function(n){if("undefined"!=typeof Symbol&&null!=n[Symbol.iterator]||null!=n["@@iterator"])return Array.from(n)}(n)||t(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function t(n,r){if(n){if("string"==typeof n)return o(n,r);var t=Object.prototype.toString.call(n).slice(8,-1);return"Map"===(t="Object"===t&&n.constructor?n.constructor.name:t)||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?o(n,r):void 0}}function o(n,r){for(var t=0,e=Array(r=null==r||r>n.length?n.length:r);t<r;t++)e[t]=n[t];return e}function f(u){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[];return function(){for(var n,r=arguments.length,t=Array(r),e=0;e<r;e++)t[e]=arguments[e];return(n=[].concat(h(i),t)).length<u.length?f(u,n):u.apply(void 0,h(n))}}function a(n){return Array.prototype.slice.call(n)}var r=f(function(n,r,t){var e=n<0?t.length+n:n;return t.length<=n||e<0||((t=a(t))[e]=r(t[e])),t});function c(n){return function(){return n}}var s=Array.isArray;function p(){for(var n=[],r=0,t=arguments.length;r<t&&void 0!==arguments[r];)n[r]=arguments[r],r++;return n}var g=f(function(n,r,t){return Object.assign({},t,e({},n,r))});function v(n){return n<<0===n}var y=Number.isInteger||v;var d=f(function n(r,t,e){var u="string"==typeof r?r.split(".").map(function(n){return v(+(""+n))?+(""+n):n}):r;if(0===u.length)return t;r=u[0];if(1<u.length&&(i="object"===l(e)&&null!==e&&e.hasOwnProperty(r)?e[r]:v(u[1])?[]:{},t=n(Array.prototype.slice.call(u,1),t,i)),v(r)&&s(e)){var i=a(e);return i[r]=t,i}return g(r,t,e)});function m(n,l){switch(n){case 0:return function(){return l.apply(this,arguments)};case 1:return function(n){return l.apply(this,arguments)};case 2:return function(n,r){return l.apply(this,arguments)};case 3:return function(n,r,t){return l.apply(this,arguments)};case 4:return function(n,r,t,e){return l.apply(this,arguments)};case 5:return function(n,r,t,e,u){return l.apply(this,arguments)};case 6:return function(n,r,t,e,u,i){return l.apply(this,arguments)};case 7:return function(n,r,t,e,u,i,o){return l.apply(this,arguments)};case 8:return function(n,r,t,e,u,i,o,f){return l.apply(this,arguments)};case 9:return function(n,r,t,e,u,i,o,f,c){return l.apply(this,arguments)};default:return function(n,r,t,e,u,i,o,f,c,a){return l.apply(this,arguments)}}}function b(r,n){if(1===arguments.length)return function(n){return b(r,n)};if(10<r)throw Error("First argument to _arity must be a non-negative integer no greater than ten");return m(r,function i(o,f,c){return function(){for(var n=0,r=0,t=f.length,e=arguments.length,u=Array(t+e);n<t;)u[n]=f[n],n++;for(;r<e;)u[t+r]=arguments[r],r++;return u.length<o?m(o-u.length,i(o,u,c)):c.apply(this,u)}}(r,[],n))}var w=f(function(n,r,t){if(r<n)throw Error("min must not be greater than max in clamp(min, max, value)");return t<n||r<t?r<t?r:t<n?n:void 0:t});function j(r,n){return 1===arguments.length?function(n){return j(r,n)}:"string"==typeof r?"".concat(r).concat(n):[].concat(h(r),h(n))}var O=Object.keys;function E(n,r){for(var t=2<arguments.length&&void 0!==arguments[2]&&arguments[2],e=0,u=Array(r.length);e<r.length;)u[e]=t?n(r[e],e):n(r[e]),e++;return u}function A(n,r){for(var t=0,e=O(r),u=e.length,i={};t<u;){var o=e[t];i[o]=n(r[o],o,r),t++}return i}var N=A;function x(r,n){if(1===arguments.length)return function(n){return x(r,n)};if(!n)throw Error("Incorrect iterable input");return(s(n)?E:A)(r,n)}function S(r,n){return 1===arguments.length?function(n){return S(r,n)}:r<n?n:r}var T=f(function(n,r,t){if(!s(t))throw new TypeError("reduce: list must be array or iterable");for(var e=0,u=t.length;e<u;)r=n(r,t[e],e,t),e++;return r});function k(r,n){return 1===arguments.length?function(n){return k(r,n)}:null==(t=n)||!0===Number.isNaN(t)?r:n;var t}function I(n){if(null===n)return"Null";if(void 0===n)return"Undefined";if(Number.isNaN(n))return"NaN";n=Object.prototype.toString.call(n).slice(8,-1);return"AsyncFunction"===n?"Async":n}function P(n,r){if(!s(r))throw Error("Cannot read property 'indexOf' of ".concat(r));var t=I(n);if(!["Object","Array","NaN","RegExp"].includes(t))return r.lastIndexOf(n);for(var e=r.length,u=-1;-1<--e&&-1===u;)B(r[e],n)&&(u=e);return u}function F(n,r){if(!s(r))throw Error("Cannot read property 'indexOf' of ".concat(r));var t=I(n);if(!["Object","Array","NaN","RegExp"].includes(t))return r.indexOf(n);for(var e=-1,u=-1,i=r.length;++e<i&&-1===u;)B(r[e],n)&&(u=e);return u}function W(n){for(var r,t=[];!(r=n.next()).done;)t.push(r.value);return t}function q(n){var r=""+n.__proto__;return["Error","TypeError"].includes(r)?[r,n.message]:[]}function R(n){return n.toDateString?[!0,n.getTime()]:[!1]}function C(n){return n.constructor!==RegExp?[!1]:[!0,""+n]}function B(t,e){if(1===arguments.length)return function(n){return B(t,n)};var n=I(t);if(n!==I(e))return!1;if("Function"===n)return void 0!==t.name&&t.name===e.name;if(["NaN","Undefined","Null"].includes(n))return!0;if("Number"===n)return Object.is(-0,t)===Object.is(-0,e)&&""+t==""+e;if(["String","Boolean"].includes(n))return""+t==""+e;if("Array"===n){var r=Array.from(t),u=Array.from(e);if(""+r!=""+u)return!1;var i=!0;return r.forEach(function(n,r){i&&(n===u[r]||B(n,u[r])||(i=!1))}),i}var o=C(t),r=C(e);if(o[0])return!!r[0]&&o[1]===r[1];if(r[0])return!1;o=R(t),r=R(e);if(o[0])return!!r[0]&&o[1]===r[1];if(r[0])return!1;o=q(t),r=q(e);if(o[0])return!!r[0]&&(o[0]===r[0]&&o[1]===r[1]);if("Set"===n)return function(n,r){if(n.size!==r.size)return!1;var n=W(n.values()),t=W(r.values());return 0===n.filter(function(n){return-1===F(n,t)}).length}(t,e);if("Object"!==n)return!1;n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;var f=!0;return n.forEach(function(n){var r;f&&((r=t[n])===(n=e[n])||B(r,n)||(f=!1))}),f}function L(r,n){if(1===arguments.length)return function(n){return L(r,n)};if("string"==typeof n)return n.includes(r);if(!n)throw new TypeError("Cannot read property 'indexOf' of ".concat(n));return!!s(n)&&-1<F(r,n)}var U=function(){function n(){!function(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")}(this,n),this.set=new Set,this.items={}}var r,t,e;return r=n,(t=[{key:"checkUniqueness",value:function(n){var r=I(n);if(["Null","Undefined","NaN"].includes(r))return!(r in this.items)&&(this.items[r]=!0);if(["Object","Array"].includes(r))return r in this.items?-1===F(n,this.items[r])&&(this.items[r].push(n),!0):(this.items[r]=[n],!0);r=this.set.size;return this.set.add(n),this.set.size!==r}}])&&u(r.prototype,t),e&&u(r,e),n}();function _(n){var r=new U,t=[];return n.forEach(function(n){r.checkUniqueness(n)&&t.push(n)}),t}function z(r,n){return 1===arguments.length?function(n){return z(r,n)}:n.slice(0<r?r:0)}function M(r,n){return 1===arguments.length?function(n){return M(r,n)}:n?n[r]:void 0}var D=f(function(n,r,t){return B(M(n,r),M(n,t))});function J(t,n){return E(function(n,r){return"Function"===I(t[r])?t[r](n):n},n,!0)}function $(e,n){return A(function(n,r){if("Object"!==I(n))return"Function"===I(e[r])?e[r](n):n;var t=I(e[r]);return"Function"===t?e[r](n):"Object"===t?G(e[r],n):n},n)}function G(r,n){if(1===arguments.length)return function(n){return G(r,n)};var t=I(r),e=I(n);if(e!==t)throw Error("iterableType !== rulesType");if(!["Object","Array"].includes(t))throw Error("'iterable' and 'rules' are from wrong type ".concat(t));return("Object"===e?$:J)(r,n)}function H(n,r){var t,e={};for(t in r)n(r[t],t,r)&&(e[t]=r[t]);return e}function K(n,r){for(var t=2<arguments.length&&void 0!==arguments[2]&&arguments[2],e=0,u=r.length,i=[];e<u;)(t?n(r[e],e):n(r[e]))&&i.push(r[e]),e++;return i}function Q(r,n){if(1===arguments.length)return function(n){return Q(r,n)};if(!n)throw Error("Incorrect iterable input");return s(n)?K(r,n,!1):H(r,n)}function V(r,n){if(1===arguments.length)return function(n){return V(r,n)};if(null!=n){for(var t=n,e=0,u="string"==typeof r?r.split("."):r;e<u.length;){if(null==t)return;if(null===t[u[e]])return;t=t[u[e]],e++}return t}}var X=Object.is||function(n,r){return n===r?0!==n||1/n==1/r:n!=n&&r!=r};var Y=f(function(n,r,t){return function(){return(!0===("boolean"==typeof n?n:n.apply(void 0,arguments))?r:t).apply(void 0,arguments)}});function Z(n,r,t){var e=-1,u=n.length;(t=u<t?u:t)<0&&(t+=u),u=t<r?0:t-r>>>0,r>>>=0;for(var i=Array(u);++e<u;)i[e]=n[e+r];return i}function nn(r,n){return 1===arguments.length?function(n){return nn(r,n)}:null!=n&&n.constructor===r||n instanceof r}function rn(t,e){return function(n){return function(r){return n(t(r)).map(function(n){return e(n,r)})}}}function tn(r,n){if(1===arguments.length)return function(n){return tn(r,n)};var t=r<0?n.length+r:r;return"[object String]"===Object.prototype.toString.call(n)?n[0|t]||"":n[t]}var en=f(function(n,r,t){return t=a(t),-1===n?t.fill(r,n):t.fill(r,n,n+1)});function un(n,r,t){return n(t)>n(r)?t:r}var on=f(un);function fn(n){return n.reduce(function(n,r){return n+r},0)}function cn(n){return fn(n)/n.length}function an(r,n){return 1===arguments.length?function(n){return an(r,n)}:Object.assign({},r||{},n||{})}function ln(n,r,t){return n(t)<n(r)?t:r}var hn=f(ln);var sn=f(function(n,r,t){if(n<0||r<0)throw Error("Rambda.move does not support negative indexes");if(t.length-1<n||t.length-1<r)return t;var e=a(t);return e[n]=t[r],e[r]=t[n],e});function pn(r,n){return 1===arguments.length?function(n){return pn(r,n)}:r*n}function gn(n,r){var t;return function(){return n&&(t=n.apply(r||this,arguments),n=null),t}}function vn(r){return{x:r,map:function(n){return vn(n(r))}}}var yn=f(function(n,r,t){return n(function(n){return vn(r(n))})(t).x});function dn(e){for(var n=arguments.length,u=Array(1<n?n-1:0),r=1;r<n;r++)u[r-1]=arguments[r];var i=e.length;return function(){for(var n=arguments.length,r=Array(n),t=0;t<n;t++)r[t]=arguments[t];return u.length+r.length<i?dn.apply(void 0,[e].concat([].concat(u,r))):e.apply(void 0,u.concat(r))}}function mn(t,n){var e={},u={};return Object.entries(n).forEach(function(n){var r=i(n,2),n=r[0],r=r[1];t(r,n)?e[n]=r:u[n]=r}),[e,u]}function bn(n,r){for(var t=2<arguments.length&&void 0!==arguments[2]&&arguments[2],e=[],u=[],i=-1;i++<r.length-1;)((t?n(r[i],i):n(r[i]))?e:u).push(r[i]);return[e,u]}var wn=f(function(n,r,t){return B(V(n,t),r)});var jn=f(function(n,r,t){return k(n,V(r,t))});var On=T(pn,1);var En=f(function(n,r,t){return!!t&&t[n]===r});var An=f(function(n,r,t){return nn(n,t[r])});var Nn=f(function(n,r,t){return t?k(n,t[r]):n});function xn(r,n){if(1===arguments.length)return function(n){return xn(r,n)};if(Number.isNaN(+(""+r))||Number.isNaN(+(""+n)))throw new TypeError("Both arguments to range must be numbers");if(n<r)return[];for(var t=n-r,e=Array(t),u=0;u<t;u++)e[u]=r+u;return e}var Sn=f(function(n,r,t){return t.replace(n,r)});var Tn=f(function(n,r,t){return yn(n,c(r),t)});var kn=f(function(n,r,t){return t.slice(n,r)});function In(r,n){return 1===arguments.length?function(n){return In(r,n)}:r<0?n.slice():"string"==typeof n?n.slice(0,r):Z(n,0,r)}function Pn(n){return["Async","Function"].includes(I(n))}function Fn(r){return{x:r,map:function(n){return Fn(r)}}}var Wn=f(function(n,r,t){return n(t)?r(t):t});var qn=f(function(t,n,e){return In((e.length<n.length?e:n).length,n).map(function(n,r){return t(n,e[r])})});n.F=function(){return!1},n.T=function(){return!0},n._indexOf=F,n._lastIndexOf=P,n.add=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:+(""+t)+ +(""+n)},n.adjust=r,n.all=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};for(var e=0;e<n.length;e++)if(!t(n[e]))return!1;return!0},n.allPass=function(r){return function(){for(var n=0;n<r.length;){if(!r[n].apply(r,arguments))return!1;n++}return!0}},n.always=c,n.and=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:t&&n},n.any=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};for(var e=0;e<n.length;){if(t(n[e],e))return!0;e++}return!1},n.anyPass=function(r){return function(){for(var n=0;n<r.length;){if(r[n].apply(r,arguments))return!0;n++}return!1}},n.append=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if("string"==typeof n)return n.split("").concat(t);n=a(n);return n.push(t),n},n.apply=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:t.apply(this,n)},n.applySpec=function(n){var r=function n(r,t){var e,u=1<arguments.length&&void 0!==t?t:0;for(e in r)0!=r.hasOwnProperty(e)&&"constructor"!==e&&("object"===l(r[e])&&(u=Math.max(u,n(r[e]))),"function"==typeof r[e]&&(u=Math.max(u,r[e].length)));return u}(n);if(0===r)return function(){return{}};for(var t=arguments.length,e=Array(1<t?t-1:0),u=1;u<t;u++)e[u-1]=arguments[u];return function u(i,o,f){var n=o-f.length;if(1==n)return function(n){return u(i,o,p.apply(void 0,h(f).concat([n])))};if(2==n)return function(n,r){return u(i,o,p.apply(void 0,h(f).concat([n,r])))};if(3==n)return function(n,r,t){return u(i,o,p.apply(void 0,h(f).concat([n,r,t])))};if(4==n)return function(n,r,t,e){return u(i,o,p.apply(void 0,h(f).concat([n,r,t,e])))};if(4<n)return function(){for(var n=arguments.length,r=Array(n),t=0;t<n;t++)r[t]=arguments[t];return u(i,o,p.apply(void 0,h(f).concat(r)))};if(s(i)){for(var r=[],t=0,e=i.length;t<e;t++)"object"!==l(i[t])&&!s(i[t])||(r[t]=u(i[t],o,f)),"function"==typeof i[t]&&(r[t]=i[t].apply(i,h(f)));return r}var c,a={};for(c in i)0!=i.hasOwnProperty(c)&&"constructor"!==c&&("object"!==l(i[c])?"function"==typeof i[c]&&(a[c]=i[c].apply(i,h(f))):a[c]=u(i[c],o,f));return a}(n,r,e)},n.assoc=g,n.assocPath=d,n.bind=function r(e,u){return 1===arguments.length?function(n){return r(e,n)}:b(e.length,function(){for(var n=arguments.length,r=Array(n),t=0;t<n;t++)r[t]=arguments[t];return e.apply(u,r)})},n.both=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:function(){return t.apply(void 0,arguments)&&n.apply(void 0,arguments)}},n.chain=function r(t,n){var e;return 1===arguments.length?function(n){return r(t,n)}:(e=[]).concat.apply(e,h(n.map(t)))},n.clamp=w,n.clone=function n(r){var t,e=s(r)?Array(r.length):{};if(r&&r.getTime)return new Date(r.getTime());for(t in r){var u=r[t];e[t]="object"===l(u)&&null!==u?u.getTime?new Date(u.getTime()):n(u):u}return e},n.complement=function(n){return function(){return!n.apply(void 0,arguments)}},n.compose=function(){for(var n=arguments.length,o=Array(n),r=0;r<n;r++)o[r]=arguments[r];if(0===o.length)throw Error("compose requires at least one argument");return function(){var n=o.slice();if(0<n.length){for(var r=n.pop(),t=arguments.length,e=Array(t),u=0;u<t;u++)e[u]=arguments[u];for(var i=r.apply(this,e);0<n.length;)i=n.pop()(i);return i}}},n.concat=j,n.cond=function(n){return function(t){var e,u=!1;return n.forEach(function(n){var r=i(n,2),n=r[0],r=r[1];!u&&n(t)&&(u=!0,e=r(t))}),e}},n.converge=function r(e,n){return 1===arguments.length?function(n){return r(e,n)}:b(T(function(n,r){return S(n,r.length)},0,n),function(){var r=arguments,t=this;return e.apply(this,x(function(n){return n.apply(t,r)},n))})},n.curry=f,n.curryN=b,n.dec=function(n){return n-1},n.defaultTo=k,n.difference=function r(t,e){return 1===arguments.length?function(n){return r(t,n)}:_(t).filter(function(n){return!L(n,e)})},n.dissoc=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if(null==n)return{};var e,u={};for(e in n)u[e]=n[e];return delete u[t],u},n.divide=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:t/n},n.drop=z,n.dropLast=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:0<t?n.slice(0,-t):n.slice()},n.dropLastWhile=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if(0===n.length)return n;var e=s(n);if("function"!=typeof t)throw Error("'predicate' is from wrong type ".concat(l(t)));if(!e&&"string"!=typeof n)throw Error("'iterable' is from wrong type ".concat(l(n)));for(var u=!1,i=[],o=n.length;0<o;)o--,u||!1!==t(n[o])?u&&i.push(n[o]):(u=!0,i.push(n[o]));return e?i.reverse():i.reverse().join("")},n.dropRepeats=function(n){if(!s(n))throw Error("".concat(n," is not a list"));var t=[];return n.reduce(function(n,r){return B(n,r)||t.push(r),r},void 0),t},n.dropRepeatsWith=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if(!s(n))throw Error("".concat(n," is not a list"));var e=[];return n.reduce(function(n,r){return void 0!==n&&t(n,r)||e.push(r),r},void 0),e},n.dropWhile=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};var e=s(n);if(!e&&"string"!=typeof n)throw Error("`iterable` is neither list nor a string");for(var u=!1,i=[],o=-1;o++<n.length-1;)u?i.push(n[o]):t(n[o])||(u=u||!0,i.push(n[o]));return e?i:i.join("")},n.either=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:function(){return!(!t.apply(void 0,arguments)&&!n.apply(void 0,arguments))}},n.endsWith=function r(t,e){if(1===arguments.length)return function(n){return r(t,n)};if("string"==typeof e)return e.endsWith(t);if(!s(t))return!1;var u=e.length-t.length,i=!0;return t.filter(function(n,r){return!!i&&((r=B(n,e[r+u]))||(i=!1),r)}).length===t.length},n.eqProps=D,n.equals=B,n.evolve=G,n.evolveArray=J,n.evolveObject=$,n.filter=Q,n.filterArray=K,n.filterObject=H,n.find=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};for(var e=0,u=n.length;e<u;){var i=n[e];if(t(i))return i;e++}},n.findIndex=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};for(var e=n.length,u=-1;++u<e;)if(t(n[u]))return u;return-1},n.findLast=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};for(var e=n.length;0<=--e;)if(t(n[e]))return n[e]},n.findLastIndex=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};for(var e=n.length;0<=--e;)if(t(n[e]))return e;return-1},n.flatten=function n(r,t){for(var e=void 0===t?[]:t,u=0;u<r.length;u++)s(r[u])?n(r[u],e):e.push(r[u]);return e},n.flip=function(n){return e=n,function(){for(var n=arguments.length,r=Array(n),t=0;t<n;t++)r[t]=arguments[t];if(1===r.length)return function(n){return e(n,r[0])};if(2===r.length)return e(r[1],r[0]);if(3===r.length)return e(r[1],r[0],r[2]);if(4===r.length)return e(r[1],r[0],r[2],r[3]);throw Error("R.flip doesn't work with arity > 4")};var e},n.forEach=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if(void 0!==n){if(s(n))for(var e=0,u=n.length;e<u;)t(n[e]),e++;else for(var i=0,o=O(n),f=o.length;i<f;){var c=o[i];t(n[c],c,n),i++}return n}},n.fromPairs=function(n){var r={};return n.forEach(function(n){n=i(n,2);return r[n[0]]=n[1]}),r},n.groupBy=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};for(var e={},u=0;u<n.length;u++){var i=n[u],o=t(i);e[o]||(e[o]=[]),e[o].push(i)}return e},n.groupWith=function(i,o){if(!s(o))throw new TypeError("list.reduce is not a function");var n=a(o);if(1===o.length)return[n];var f=[],c=[];return n.reduce(function(n,r,t){if(0===t)return r;var e=i(n,r),u=0===c.length,t=t===o.length-1;return e?(u&&c.push(n),c.push(r),t&&f.push(c)):u?(f.push([n]),t&&f.push([r])):(f.push(c),t&&f.push([r]),c=[]),r},void 0),f},n.has=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:!!n&&n.hasOwnProperty(t)},n.hasPath=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:void 0!==V(t,n)},n.head=function(n){return"string"==typeof n?n[0]||"":n[0]},n.identical=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:X(t,n)},n.identity=function(n){return n},n.ifElse=Y,n.inc=function(n){return n+1},n.includes=L,n.indexBy=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if("string"==typeof t)return function(n,r){for(var t={},e=0;e<r.length;e++){var u=r[e];t[V(n,u)]=u}return t}(t,n);for(var e={},u=0;u<n.length;u++){var i=n[u];e[t(i)]=i}return e},n.indexOf=function(r,n){return 1===arguments.length?function(n){return F(r,n)}:F(r,n)},n.init=function(n){return"string"==typeof n?n.slice(0,-1):n.length?Z(n,0,-1):[]},n.intersection=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:Q(function(n){return L(n,t)},n)},n.intersperse=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};for(var e=-1,u=n.length,i=[];++e<u;)e===u-1?i.push(n[e]):i.push(n[e],t);return i},n.is=nn,n.isEmpty=function(n){var r=I(n);return!["Undefined","NaN","Number","Null"].includes(r)&&(!n||("Object"===r?0===Object.keys(n).length:"Array"===r&&0===n.length))},n.isNil=function(n){return null==n},n.join=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:n.join(t)},n.keys=function(n){return Object.keys(n)},n.last=function(n){return"string"==typeof n?n[n.length-1]||"":n[n.length-1]},n.lastIndexOf=function(r,n){return 1===arguments.length?function(n){return P(r,n)}:P(r,n)},n.length=function(n){return s(n)||"string"==typeof n?n.length:NaN},n.lens=rn,n.lensIndex=function(n){return rn(tn(n),en(n))},n.lensPath=function(n){return rn(V(n),d(n))},n.lensProp=function(n){return rn(M(n),g(n))},n.map=x,n.mapArray=E,n.mapObjIndexed=N,n.mapObject=A,n.match=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};n=n.match(t);return null===n?[]:n},n.mathMod=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:y(t)&&y(n)&&1<=n?(t%n+n)%n:NaN},n.max=S,n.maxBy=on,n.maxByFn=un,n.mean=cn,n.median=function(n){if(0===(t=n.length))return NaN;var r=2-t%2,t=(t-r)/2;return cn(Array.prototype.slice.call(n,0).sort(function(n,r){return n===r?0:n<r?-1:1}).slice(t,t+r))},n.merge=an,n.mergeAll=function(n){var r={};return x(function(n){r=an(r,n)},n),r},n.mergeDeepRight=function r(t,e){if(1===arguments.length)return function(n){return r(t,n)};var u=JSON.parse(JSON.stringify(t));return Object.keys(e).forEach(function(n){"Object"===I(e[n])&&"Object"===I(t[n])?u[n]=r(t[n],e[n]):u[n]=e[n]}),u},n.mergeLeft=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:an(n,t)},n.min=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:n<t?n:t},n.minBy=hn,n.minByFn=ln,n.modulo=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:t%n},n.move=sn,n.multiply=pn,n.negate=function(n){return-n},n.none=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};for(var e=0;e<n.length;e++)if(t(n[e]))return!1;return!0},n.not=function(n){return!n},n.nth=tn,n.objOf=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:e({},t,n)},n.of=function(n){return[n]},n.omit=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if(null!=n){var e,u="string"==typeof t?t.split(","):t,i={};for(e in n)u.includes(e)||(i[e]=n[e]);return i}},n.once=function(n,r){return 1!==arguments.length?gn(n,r):f(gn(n,r))},n.or=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:t||n},n.over=yn,n.partial=dn,n.partition=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:(s(n)?bn:mn)(t,n)},n.partitionArray=bn,n.partitionObject=mn,n.path=V,n.pathEq=wn,n.pathOr=jn,n.paths=function r(t,e){return 1===arguments.length?function(n){return r(t,n)}:t.map(function(n){return V(n,e)})},n.pick=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if(null!=n){for(var e="string"==typeof t?t.split(","):t,u={},i=0;i<e.length;)e[i]in n&&(u[e[i]]=n[e[i]]),i++;return u}},n.pickAll=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if(null!=n){for(var e="string"==typeof t?t.split(","):t,u={},i=0;i<e.length;)e[i]in n?u[e[i]]=n[e[i]]:u[e[i]]=void 0,i++;return u}},n.pipe=function(){for(var n=arguments.length,t=Array(n),r=0;r<n;r++)t[r]=arguments[r];if(0===t.length)throw Error("pipe requires at least one argument");return function(){var n=t.slice();if(0<n.length){for(var r=n.shift().apply(void 0,arguments);0<n.length;)r=n.shift()(r);return r}}},n.pluck=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};var e=[];return x(function(n){void 0!==n[t]&&e.push(n[t])},n),e},n.prepend=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:[t].concat("string"==typeof n?n.split(""):n)},n.product=On,n.prop=M,n.propEq=En,n.propIs=An,n.propOr=Nn,n.props=function r(t,e){if(1===arguments.length)return function(n){return r(t,n)};if(!s(t))throw Error("propsToPick is not a list");return E(function(n){return e[n]},t)},n.range=xn,n.reduce=T,n.reject=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:Q(function(n){return!t(n)},n)},n.repeat=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:Array(n).fill(t)},n.replace=Sn,n.reverse=function(n){return"string"==typeof n?n.split("").reverse().join(""):n.slice().reverse()},n.set=Tn,n.slice=kn,n.sort=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:a(n).sort(t)},n.sortBy=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:a(n).sort(function(n,r){return n=t(n),r=t(r),n===r?0:n<r?-1:1})},n.split=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:n.split(t)},n.splitAt=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if(!n)throw new TypeError("Cannot read property 'slice' of ".concat(n));if(!s(n)&&"string"!=typeof n)return[[],[]];var e,u,i=(u=n.length+t<0?0:n.length+t,u=(e=(i=t)<0)&&"Function"===I(u)?u():u,i=e||"Function"!==I(i)?i:i(),e?u:i);return[In(i,n),z(i,n)]},n.splitEvery=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if(t<1)throw Error("First argument to splitEvery must be a positive integer");for(var e=[],u=0;u<n.length;)e.push(n.slice(u,u+=t));return e},n.splitWhen=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if(!n)throw new TypeError("Cannot read property 'length' of ".concat(n));for(var e=[],u=[],i=!1,o=-1;o++<n.length-1;)i?u.push(n[o]):t(n[o])?(u.push(n[o]),i=!0):e.push(n[o]);return[e,u]},n.startsWith=function r(t,e){if(1===arguments.length)return function(n){return r(t,n)};if("string"==typeof e)return e.startsWith(t);if(!s(t))return!1;var u=!0;return t.filter(function(n,r){return!!u&&((r=B(n,e[r]))||(u=!1),r)}).length===t.length},n.subtract=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:t-n},n.sum=fn,n.symmetricDifference=function r(t,e){return 1===arguments.length?function(n){return r(t,n)}:j(Q(function(n){return!L(n,e)},t),Q(function(n){return!L(n,t)},e))},n.tail=function(n){return z(1,n)},n.take=In,n.takeLast=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};var e=n.length;if(t<0)return n.slice();var u=e<t?e:t;return"string"==typeof n?n.slice(e-u):Z(n,u=e-u,e)},n.takeLastWhile=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if(0===n.length)return n;for(var e=!1,u=[],i=n.length;!e||0===i;)!1===t(n[--i])?e=!0:e||u.push(n[i]);return s(n)?u.reverse():u.reverse().join("")},n.takeWhile=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};var e=s(n);if(!e&&"string"!=typeof n)throw Error("`iterable` is neither list nor a string");for(var u=!0,i=[],o=-1;o++<n.length-1;)t(n[o])?u&&i.push(n[o]):u=u&&!1;return e?i:i.join("")},n.tap=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:(t(n),n)},n.test=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if("string"==typeof t)throw new TypeError('‘test’ requires a value of type RegExp as its first argument; received "'.concat(t,'"'));return-1!=n.search(t)},n.times=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if(!Number.isInteger(n)||n<0)throw new RangeError("n must be an integer");return x(t,xn(0,n))},n.toLower=function(n){return n.toLowerCase()},n.toPairs=function(n){return Object.entries(n)},n.toString=function(n){return""+n},n.toUpper=function(n){return n.toUpperCase()},n.transpose=function(n){return n.reduce(function(t,n){return n.forEach(function(n,r){return s(t[r])?t[r].push(n):t.push([n])}),t},[])},n.trim=function(n){return n.trim()},n.tryCatch=function(e,u){if(!Pn(e))throw Error("R.tryCatch | fn '".concat(e,"'"));var i=Pn(u);return function(){for(var n=arguments.length,r=Array(n),t=0;t<n;t++)r[t]=arguments[t];try{return e.apply(void 0,r)}catch(n){return i?u.apply(void 0,[n].concat(r)):u}}},n.type=I,n.unapply=function(e){return function(){for(var n=arguments.length,r=Array(n),t=0;t<n;t++)r[t]=arguments[t];return e.call(this,r)}},n.union=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};var e=a(t);return n.forEach(function(n){L(n,t)||e.push(n)}),e},n.uniq=_,n.uniqWith=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};for(var e=-1,u=[];++e<n.length;){var i=n[e];!function(n,r,t){for(var e=!1,u=-1;++u<t.length&&!e;)n(r,t[u])&&(e=!0);return e}(t,i,u)&&u.push(i)}return u},n.unless=function r(t,e){return 1===arguments.length?function(n){return r(t,n)}:function(n){return t(n)?n:e(n)}},n.update=en,n.values=function(n){return"Object"!==I(n)?[]:Object.values(n)},n.view=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:t(Fn)(n).x},n.when=Wn,n.where=function r(t,n){if(void 0===n)return function(n){return r(t,n)};var e,u=!0;for(e in t){var i=t[e](n[e]);u&&!1===i&&(u=!1)}return u},n.whereEq=function r(t,e){if(1===arguments.length)return function(n){return r(t,n)};var n=Q(function(n,r){return B(n,e[r])},t);return Object.keys(n).length===Object.keys(t).length},n.without=function r(t,n){return void 0===n?function(n){return r(t,n)}:T(function(n,r){return-1<F(r,t)?n:n.concat(r)},[],n)},n.xor=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:!!t&&!n||!!n&&!t},n.zip=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};for(var e=[],u=Math.min(t.length,n.length),i=0;i<u;i++)e[i]=[t[i],n[i]];return e},n.zipObj=function r(t,e){return 1===arguments.length?function(n){return r(t,n)}:In(e.length,t).reduce(function(n,r,t){return n[r]=e[t],n},{})},n.zipWith=qn,Object.defineProperty(n,"__esModule",{value:!0})}); | ||
!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((n="undefined"!=typeof globalThis?globalThis:n||self).R={})}(this,function(n){"use strict";function a(n){return Array.prototype.slice.call(n)}function q(r,n){var t,e=Object.keys(r);return Object.getOwnPropertySymbols&&(t=Object.getOwnPropertySymbols(r),n&&(t=t.filter(function(n){return Object.getOwnPropertyDescriptor(r,n).enumerable})),e.push.apply(e,t)),e}function C(r){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?q(Object(t),!0).forEach(function(n){u(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):q(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function l(n){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}function B(n,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(n,e.key,e)}}function u(n,r,t){return r in n?Object.defineProperty(n,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[r]=t,n}function i(n,r){return function(n){if(Array.isArray(n))return n}(n)||function(n,r){var t=null==n?null:"undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=t){var e,u,i=[],o=!0,f=!1;try{for(t=t.call(n);!(o=(e=t.next()).done)&&(i.push(e.value),!r||i.length!==r);o=!0);}catch(n){f=!0,u=n}finally{try{o||null==t.return||t.return()}finally{if(f)throw u}}return i}}(n,r)||D(n,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(n){return function(n){if(Array.isArray(n))return e(n)}(n)||function(n){if("undefined"!=typeof Symbol&&null!=n[Symbol.iterator]||null!=n["@@iterator"])return Array.from(n)}(n)||D(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function D(n,r){if(n){if("string"==typeof n)return e(n,r);var t=Object.prototype.toString.call(n).slice(8,-1);return"Map"===(t="Object"===t&&n.constructor?n.constructor.name:t)||"Set"===t?Array.from(n):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?e(n,r):void 0}}function e(n,r){for(var t=0,e=Array(r=null!=r&&r<=n.length?r:n.length);t<r;t++)e[t]=n[t];return e}function o(u){var i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:[];return function(){for(var n,r=arguments.length,t=Array(r),e=0;e<r;e++)t[e]=arguments[e];return(n=[].concat(h(i),t)).length<u.length?o(u,n):u.apply(void 0,h(n))}}var L=o(function(n,r,t){var e=n<0?t.length+n:n;return t.length<=n||e<0?t:((n=a(t))[e]=r(n[e]),n)});function U(r){return function(n){return r}}var s=Array.isArray;function f(n){var r,t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:0;for(r in n)!1!=n.hasOwnProperty(r)&&"constructor"!==r&&("object"===l(n[r])&&(t=Math.max(t,f(n[r]))),"function"==typeof n[r]&&(t=Math.max(t,n[r].length)));return t}function p(){for(var n=[],r=0,t=arguments.length;r<t&&void 0!==arguments[r];)n[r]=arguments[r],r++;return n}var c=o(function(n,r,t){return Object.assign({},t,u({},n,r))});function g(n){return n<<0===n}var z=Number.isInteger||g;var M=o(function n(r,t,e){r="string"==typeof r?r.split(".").map(function(n){return g(+(""+n))?+(""+n):n}):r;if(0===r.length)return t;var u,i=r[0];return 1<r.length&&(u="object"===l(e)&&null!==e&&e.hasOwnProperty(i)?e[i]:g(r[1])?[]:{},t=n(Array.prototype.slice.call(r,1),t,u)),g(i)&&s(e)?((r=a(e))[i]=t,r):c(i,t,e)});function J(n,l){switch(n){case 0:return function(){return l.apply(this,arguments)};case 1:return function(n){return l.apply(this,arguments)};case 2:return function(n,r){return l.apply(this,arguments)};case 3:return function(n,r,t){return l.apply(this,arguments)};case 4:return function(n,r,t,e){return l.apply(this,arguments)};case 5:return function(n,r,t,e,u){return l.apply(this,arguments)};case 6:return function(n,r,t,e,u,i){return l.apply(this,arguments)};case 7:return function(n,r,t,e,u,i,o){return l.apply(this,arguments)};case 8:return function(n,r,t,e,u,i,o,f){return l.apply(this,arguments)};case 9:return function(n,r,t,e,u,i,o,f,c){return l.apply(this,arguments)};default:return function(n,r,t,e,u,i,o,f,c,a){return l.apply(this,arguments)}}}function t(r,n){if(1===arguments.length)return function(n){return t(r,n)};if(10<r)throw Error("First argument to _arity must be a non-negative integer no greater than ten");return J(r,function i(o,f,c){return function(){for(var n=0,r=0,t=f.length,e=arguments.length,u=Array(t+e);n<t;)u[n]=f[n],n++;for(;r<e;)u[t+r]=arguments[r],r++;return u.length<o?J(o-u.length,i(o,u,c)):c.apply(this,u)}}(r,[],n))}var H=o(function(n,r,t){if(r<n)throw Error("min must not be greater than max in clamp(min, max, value)");return t<n||r<t?r<t?r:t<n?n:void 0:t});var $=Object.keys;function r(n,r,t){if(!s(t))throw new TypeError("reduce: list must be array or iterable");for(var e=0,u=t.length;e<u;)r=n(r,t[e],e,t),e++;return r}var y=o(r);function G(n,l){switch(n){case 0:return function(){return l.apply(this,arguments)};case 1:return function(n){return l.apply(this,arguments)};case 2:return function(n,r){return l.apply(this,arguments)};case 3:return function(n,r,t){return l.apply(this,arguments)};case 4:return function(n,r,t,e){return l.apply(this,arguments)};case 5:return function(n,r,t,e,u){return l.apply(this,arguments)};case 6:return function(n,r,t,e,u,i){return l.apply(this,arguments)};case 7:return function(n,r,t,e,u,i,o){return l.apply(this,arguments)};case 8:return function(n,r,t,e,u,i,o,f){return l.apply(this,arguments)};case 9:return function(n,r,t,e,u,i,o,f,c){return l.apply(this,arguments)};case 10:return function(n,r,t,e,u,i,o,f,c,a){return l.apply(this,arguments)};default:throw Error("First argument to _arity must be a non-negative integer no greater than ten")}}function K(n,r){return function(){return r.call(this,n.apply(this,arguments))}}function Q(){if(0===arguments.length)throw Error("pipe requires at least one argument");return G(arguments[0].length,r(K,arguments[0],Array.prototype.slice.call(arguments,1,1/0)))}function v(r,n){return 1===arguments.length?function(n){return v(r,n)}:"string"==typeof r?"".concat(r).concat(n):[].concat(h(r),h(n))}function d(n,r){for(var t=2<arguments.length&&void 0!==arguments[2]&&arguments[2],e=0,u=Array(r.length);e<r.length;)u[e]=t?n(r[e],e):n(r[e]),e++;return u}function m(n,r){for(var t=0,e=$(r),u=e.length,i={};t<u;){var o=e[t];i[o]=n(r[o],o,r),t++}return i}var V=m;function b(r,n){if(1===arguments.length)return function(n){return b(r,n)};if(n)return(s(n)?d:m)(r,n);throw Error("Incorrect iterable input")}function w(r,n){return 1===arguments.length?function(n){return w(r,n)}:r<n?n:r}function O(r,n){return 1===arguments.length?function(n){return O(r,n)}:null==(t=n)||!0===Number.isNaN(t)?r:n;var t}function j(n){if(null===n)return"Null";if(void 0===n)return"Undefined";if(Number.isNaN(n))return"NaN";n=Object.prototype.toString.call(n).slice(8,-1);return"AsyncFunction"===n?"Promise":n}function E(n,r){if(!s(r))throw Error("Cannot read property 'indexOf' of ".concat(r));var t=j(n);if(!["Object","Array","NaN","RegExp"].includes(t))return r.lastIndexOf(n);for(var e=r.length,u=-1;-1<--e&&-1===u;)N(r[e],n)&&(u=e);return u}function A(n,r){if(!s(r))throw Error("Cannot read property 'indexOf' of ".concat(r));var t=j(n);if(!["Object","Array","NaN","RegExp"].includes(t))return r.indexOf(n);for(var e=-1,u=-1,i=r.length;++e<i&&-1===u;)N(r[e],n)&&(u=e);return u}function X(n){for(var r,t=[];!(r=n.next()).done;)t.push(r.value);return t}function Y(n){var r=""+n.__proto__;return["Error","TypeError"].includes(r)?[r,n.message]:[]}function Z(n){return n.toDateString?[!0,n.getTime()]:[!1]}function nn(n){return n.constructor!==RegExp?[!1]:[!0,""+n]}function N(t,e){if(1===arguments.length)return function(n){return N(t,n)};var n=j(t);if(n!==j(e))return!1;if("Function"===n)return void 0!==t.name&&t.name===e.name;if(["NaN","Undefined","Null"].includes(n))return!0;if("Number"===n)return Object.is(-0,t)===Object.is(-0,e)&&""+t==""+e;if(["String","Boolean"].includes(n))return""+t==""+e;if("Array"===n){var r=Array.from(t),u=Array.from(e);if(""+r!=""+u)return!1;var i=!0;return r.forEach(function(n,r){!i||n===u[r]||N(n,u[r])||(i=!1)}),i}var r=nn(t),o=nn(e);if(r[0])return!!o[0]&&r[1]===o[1];if(o[0])return!1;r=Z(t),o=Z(e);if(r[0])return!!o[0]&&r[1]===o[1];if(o[0])return!1;r=Y(t),o=Y(e);if(r[0])return!!o[0]&&(r[0]===o[0]&&r[1]===o[1]);if("Set"===n){r=t,o=e;if(r.size!==o.size)return!1;var r=X(r.values()),f=X(o.values());return 0===r.filter(function(n){return-1===A(n,f)}).length}if("Object"!==n)return!1;o=Object.keys(t);if(o.length!==Object.keys(e).length)return!1;var c=!0;return o.forEach(function(n){var r;c&&(r=t[n])!==(n=e[n])&&!N(r,n)&&(c=!1)}),c}function x(r,n){if(1===arguments.length)return function(n){return x(r,n)};if("string"==typeof n)return n.includes(r);if(n)return!!s(n)&&-1<A(r,n);throw new TypeError("Cannot read property 'indexOf' of ".concat(n))}var rn=function(){function n(){if(!(this instanceof n))throw new TypeError("Cannot call a class as a function");this.set=new Set,this.items={}}var r,t,e;return r=n,(t=[{key:"checkUniqueness",value:function(n){var r=j(n);return["Null","Undefined","NaN"].includes(r)?!(r in this.items)&&(this.items[r]=!0):["Object","Array"].includes(r)?r in this.items?-1===A(n,this.items[r])&&(this.items[r].push(n),!0):(this.items[r]=[n],!0):(r=this.set.size,this.set.add(n),this.set.size!==r)}}])&&B(r.prototype,t),e&&B(r,e),Object.defineProperty(r,"prototype",{writable:!1}),n}();function tn(n){var r=new rn,t=[];return n.forEach(function(n){r.checkUniqueness(n)&&t.push(n)}),t}function P(r,n){return 1===arguments.length?function(n){return P(r,n)}:n.slice(0<r?r:0)}function S(r,n){return 1===arguments.length?function(n){return S(r,n)}:n?n[r]:void 0}var en=o(function(n,r,t){return N(S(n,r),S(n,t))});function un(t,n){return d(function(n,r){return"Function"===j(t[r])?t[r](n):n},n,!0)}function on(e,n){return m(function(n,r){var t;return"Object"===j(n)?"Function"===(t=j(e[r]))?e[r](n):"Object"===t?fn(e[r],n):n:"Function"===j(e[r])?e[r](n):n},n)}function fn(r,n){if(1===arguments.length)return function(n){return fn(r,n)};var t=j(r),e=j(n);if(e!==t)throw Error("iterableType !== rulesType");if(["Object","Array"].includes(t))return("Object"===e?on:un)(r,n);throw Error("'iterable' and 'rules' are from wrong type ".concat(t))}function cn(n,r){var t,e={};for(t in r)n(r[t],t,r)&&(e[t]=r[t]);return e}function an(n,r){for(var t=2<arguments.length&&void 0!==arguments[2]&&arguments[2],e=0,u=r.length,i=[];e<u;)(t?n(r[e],e):n(r[e]))&&i.push(r[e]),e++;return i}function k(r,n){if(1===arguments.length)return function(n){return k(r,n)};if(n)return s(n)?an(r,n,!1):cn(r,n);throw Error("Incorrect iterable input")}function T(n,r){return"string"==typeof n?n.split(1<arguments.length&&void 0!==r?r:"."):n}function I(r,n){if(1===arguments.length)return function(n){return I(r,n)};if(null!=n){for(var t=n,e=0,u=T(r);e<u.length;){if(null==t)return;if(null===t[u[e]])return;t=t[u[e]],e++}return t}}var ln=Object.is||function(n,r){return n===r?0!==n||1/n==1/r:n!=n&&r!=r};var hn=o(function(n,r,t){return function(){return(!0===("boolean"==typeof n?n:n.apply(void 0,arguments))?r:t).apply(void 0,arguments)}});function sn(n,r,t){for(var e=-1,u=n.length,i=((t=u<t?u:t)<0&&(t+=u),u=t<r?0:t-r>>>0,r>>>=0,Array(u));++e<u;)i[e]=n[e+r];return i}function pn(r,n){return 1===arguments.length?function(n){return pn(r,n)}:null!=n&&n.constructor===r||n instanceof r}function F(t,e){return function(n){return function(r){return n(t(r)).map(function(n){return e(n,r)})}}}function gn(r,n){if(1===arguments.length)return function(n){return gn(r,n)};var t=r<0?n.length+r:r;return"[object String]"===Object.prototype.toString.call(n)?n[0|t]||"":n[t]}var yn=o(function(n,r,t){return t=a(t),-1===n?t.fill(r,n):t.fill(r,n,n+1)});function vn(n,r,t){return n(t)>n(r)?t:r}var dn=o(vn);function mn(n){return n.reduce(function(n,r){return n+r},0)}function bn(n){return mn(n)/n.length}function W(r,n){return 1===arguments.length?function(n){return W(r,n)}:Object.assign({},r||{},n||{})}function _(r,t){if(1===arguments.length)return function(n){return _(r,n)};var e=JSON.parse(JSON.stringify(r));return Object.keys(t).forEach(function(n){"Object"===j(t[n])&&"Object"===j(r[n])?e[n]=_(r[n],t[n]):e[n]=t[n]}),e}var wn=o(function(r,t,e){var u={};return Object.keys(t).forEach(function(n){u[n]=void 0===e[n]?t[n]:r(t[n],e[n])}),Object.keys(e).forEach(function(n){void 0===u[n]&&(u[n]=void 0===t[n]?e[n]:r(t[n],e[n]))}),u});function On(n,r,t){return n(t)<n(r)?t:r}var jn=o(On);var En=o(function(n,r,t){if(n<0||r<0)throw Error("Rambda.move does not support negative indexes");if(t.length-1<n||t.length-1<r)return t;var e=a(t);return e[n]=t[r],e[r]=t[n],e});function An(r,n){return 1===arguments.length?function(n){return An(r,n)}:r*n}function Nn(n,r){var t;return function(){return n&&(t=n.apply(r||this,arguments),n=null),t}}function xn(r){return{x:r,map:function(n){return xn(n(r))}}}var Pn=o(function(n,r,t){return n(function(n){return xn(r(n))})(t).x});function Sn(e){for(var n=arguments.length,u=Array(1<n?n-1:0),r=1;r<n;r++)u[r-1]=arguments[r];var i=e.length;return function(){for(var n=arguments.length,r=Array(n),t=0;t<n;t++)r[t]=arguments[t];return u.length+r.length<i?Sn.apply(void 0,[e].concat([].concat(u,r))):e.apply(void 0,u.concat(r))}}function kn(t,n){var e={},u={};return Object.entries(n).forEach(function(n){var n=i(n,2),r=n[0],n=n[1];t(n,r)?e[r]=n:u[r]=n}),[e,u]}function Tn(n,r){for(var t=2<arguments.length&&void 0!==arguments[2]&&arguments[2],e=[],u=[],i=-1;i++<r.length-1;)((t?n(r[i],i):n(r[i]))?e:u).push(r[i]);return[e,u]}var In=o(function(n,r,t){return N(I(n,t),r)});var Fn=o(function(n,r,t){return O(n,I(r,t))});var Wn=y(An,1);var _n=o(function(n,r,t){return!!t&&t[n]===r});var Rn=o(function(n,r,t){return pn(n,t[r])});var qn=o(function(n,r,t){return t?O(n,t[r]):n});var Cn=o(function(n,r,t){return n(S(r,t))});function Bn(r,n){if(1===arguments.length)return function(n){return Bn(r,n)};if(Number.isNaN(+(""+r))||Number.isNaN(+(""+n)))throw new TypeError("Both arguments to range must be numbers");if(n<r)return[];for(var t=n-r,e=Array(t),u=0;u<t;u++)e[u]=r+u;return e}var Dn=o(function(n,r,t){return t.replace(n,r)});var Ln=o(function(n,r,t){return Pn(n,U(r),t)});var Un=o(function(n,r,t){return t.slice(n,r)});function R(r,n){return 1===arguments.length?function(n){return R(r,n)}:r<0?n.slice():"string"==typeof n?n.slice(0,r):sn(n,0,r)}function zn(n){return["Promise","Function"].includes(j(n))}function Mn(r){return{x:r,map:function(n){return Mn(r)}}}var Jn=o(function(n,r,t){return n(t)?r(t):t});var Hn=o(function(t,n,e){return R((e.length<n.length?e:n).length,n).map(function(n,r){return t(n,e[r])})});n.F=function(){return!1},n.T=function(){return!0},n.__findHighestArity=f,n._arity=G,n._indexOf=A,n._lastIndexOf=E,n._pipe=K,n.add=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:+(""+t)+ +(""+n)},n.adjust=L,n.all=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};for(var e=0;e<n.length;e++)if(!t(n[e]))return!1;return!0},n.allPass=function(r){return function(){for(var n=0;n<r.length;){if(!r[n].apply(r,arguments))return!1;n++}return!0}},n.always=U,n.and=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:t&&n},n.any=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};for(var e=0;e<n.length;){if(t(n[e],e))return!0;e++}return!1},n.anyPass=function(r){return function(){for(var n=0;n<r.length;){if(r[n].apply(r,arguments))return!0;n++}return!1}},n.append=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if("string"==typeof n)return n.split("").concat(t);n=a(n);return n.push(t),n},n.apply=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:t.apply(this,n)},n.applySpec=function(n){var r=f(n);if(0===r)return function(){return{}};for(var t=arguments.length,e=Array(1<t?t-1:0),u=1;u<t;u++)e[u-1]=arguments[u];return function u(i,o,f){var n=o-f.length;if(1==n)return function(n){return u(i,o,p.apply(void 0,h(f).concat([n])))};if(2==n)return function(n,r){return u(i,o,p.apply(void 0,h(f).concat([n,r])))};if(3==n)return function(n,r,t){return u(i,o,p.apply(void 0,h(f).concat([n,r,t])))};if(4==n)return function(n,r,t,e){return u(i,o,p.apply(void 0,h(f).concat([n,r,t,e])))};if(4<n)return function(){for(var n=arguments.length,r=Array(n),t=0;t<n;t++)r[t]=arguments[t];return u(i,o,p.apply(void 0,h(f).concat(r)))};if(s(i)){for(var r=[],t=0,e=i.length;t<e;t++)"object"!==l(i[t])&&!s(i[t])||(r[t]=u(i[t],o,f)),"function"==typeof i[t]&&(r[t]=i[t].apply(i,h(f)));return r}var c,a={};for(c in i)0!=i.hasOwnProperty(c)&&"constructor"!==c&&("object"===l(i[c])?a[c]=u(i[c],o,f):"function"==typeof i[c]&&(a[c]=i[c].apply(i,h(f))));return a}(n,r,e)},n.assoc=c,n.assocPath=M,n.bind=function r(e,u){return 1===arguments.length?function(n){return r(e,n)}:t(e.length,function(){for(var n=arguments.length,r=Array(n),t=0;t<n;t++)r[t]=arguments[t];return e.apply(u,r)})},n.both=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:function(){return t.apply(void 0,arguments)&&n.apply(void 0,arguments)}},n.chain=function r(t,n){var e;return 1===arguments.length?function(n){return r(t,n)}:(e=[]).concat.apply(e,h(n.map(t)))},n.clamp=H,n.clone=function n(r){var t,e=s(r)?Array(r.length):{};if(r&&r.getTime)return new Date(r.getTime());for(t in r){var u=r[t];e[t]="object"===l(u)&&null!==u?u.getTime?new Date(u.getTime()):n(u):u}return e},n.complement=function(n){return function(){return!n.apply(void 0,arguments)}},n.compose=function(){if(0===arguments.length)throw Error("compose requires at least one argument");return Q.apply(this,Array.prototype.slice.call(arguments,0).reverse())},n.concat=v,n.cond=function(n){return function(t){var e,u=!1;return n.forEach(function(n){var n=i(n,2),r=n[0],n=n[1];!u&&r(t)&&(u=!0,e=n(t))}),e}},n.converge=function r(e,n){return 1===arguments.length?function(n){return r(e,n)}:t(y(function(n,r){return w(n,r.length)},0,n),function(){var r=arguments,t=this;return e.apply(this,b(function(n){return n.apply(t,r)},n))})},n.count=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:s(n)?n.filter(function(n){return t(n)}).length:0},n.countBy=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};var e={};return n.forEach(function(n){n=t(n),e[n]?e[n]++:e[n]=1}),e},n.curry=o,n.curryN=t,n.dec=function(n){return n-1},n.defaultTo=O,n.difference=function r(t,e){return 1===arguments.length?function(n){return r(t,n)}:tn(t).filter(function(n){return!x(n,e)})},n.dissoc=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if(null==n)return{};var e,u={};for(e in n)u[e]=n[e];return delete u[t],u},n.divide=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:t/n},n.drop=P,n.dropLast=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:0<t?n.slice(0,-t):n.slice()},n.dropLastWhile=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if(0===n.length)return n;var e=s(n);if("function"!=typeof t)throw Error("'predicate' is from wrong type ".concat(l(t)));if(!e&&"string"!=typeof n)throw Error("'iterable' is from wrong type ".concat(l(n)));for(var u=!1,i=[],o=n.length;0<o;)o--,u||!1!==t(n[o])?u&&i.push(n[o]):(u=!0,i.push(n[o]));return e?i.reverse():i.reverse().join("")},n.dropRepeats=function(n){if(!s(n))throw Error("".concat(n," is not a list"));var t=[];return n.reduce(function(n,r){return N(n,r)||t.push(r),r},void 0),t},n.dropRepeatsWith=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if(!s(n))throw Error("".concat(n," is not a list"));var e=[];return n.reduce(function(n,r){return void 0!==n&&t(n,r)||e.push(r),r},void 0),e},n.dropWhile=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};var e=s(n);if(!e&&"string"!=typeof n)throw Error("`iterable` is neither list nor a string");for(var u=!1,i=[],o=-1;o++<n.length-1;)u?i.push(n[o]):t(n[o])||(u=u||!0,i.push(n[o]));return e?i:i.join("")},n.either=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:function(){return!(!t.apply(void 0,arguments)&&!n.apply(void 0,arguments))}},n.endsWith=function r(t,e){if(1===arguments.length)return function(n){return r(t,n)};if("string"==typeof e)return e.endsWith(t);if(!s(t))return!1;var u=e.length-t.length,i=!0;return t.filter(function(n,r){return!!i&&((n=N(n,e[r+u]))||(i=!1),n)}).length===t.length},n.eqProps=en,n.equals=N,n.evolve=fn,n.evolveArray=un,n.evolveObject=on,n.filter=k,n.filterArray=an,n.filterObject=cn,n.find=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};for(var e=0,u=n.length;e<u;){var i=n[e];if(t(i))return i;e++}},n.findIndex=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};for(var e=n.length,u=-1;++u<e;)if(t(n[u]))return u;return-1},n.findLast=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};for(var e=n.length;0<=--e;)if(t(n[e]))return n[e]},n.findLastIndex=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};for(var e=n.length;0<=--e;)if(t(n[e]))return e;return-1},n.flatten=function n(r,t){for(var e=void 0===t?[]:t,u=0;u<r.length;u++)s(r[u])?n(r[u],e):e.push(r[u]);return e},n.flip=function(n){return e=n,function(){for(var n=arguments.length,r=Array(n),t=0;t<n;t++)r[t]=arguments[t];if(1===r.length)return function(n){return e(n,r[0])};if(2===r.length)return e(r[1],r[0]);if(3===r.length)return e(r[1],r[0],r[2]);if(4===r.length)return e(r[1],r[0],r[2],r[3]);throw Error("R.flip doesn't work with arity > 4")};var e},n.forEach=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if(void 0!==n){if(s(n))for(var e=0,u=n.length;e<u;)t(n[e]),e++;else for(var i=0,o=$(n),f=o.length;i<f;){var c=o[i];t(n[c],c,n),i++}return n}},n.fromPairs=function(n){var r={};return n.forEach(function(n){n=i(n,2);return r[n[0]]=n[1]}),r},n.groupBy=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};for(var e={},u=0;u<n.length;u++){var i=n[u],o=t(i);e[o]||(e[o]=[]),e[o].push(i)}return e},n.groupWith=function(i,o){if(!s(o))throw new TypeError("list.reduce is not a function");var n=a(o);if(1===o.length)return[n];var f=[],c=[];return n.reduce(function(n,r,t){if(0===t)return r;var e=i(n,r),u=0===c.length,t=t===o.length-1;return e?(u&&c.push(n),c.push(r),t&&f.push(c)):u?(f.push([n]),t&&f.push([r])):(f.push(c),t&&f.push([r]),c=[]),r},void 0),f},n.has=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:!!n&&n.hasOwnProperty(t)},n.hasPath=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:void 0!==I(t,n)},n.head=function(n){return"string"==typeof n?n[0]||"":n[0]},n.identical=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:ln(t,n)},n.identity=function(n){return n},n.ifElse=hn,n.inc=function(n){return n+1},n.includes=x,n.indexBy=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if("string"==typeof t){for(var e=t,u=n,i={},o=0;o<u.length;o++){var f=u[o];i[I(e,f)]=f}return i}for(var c={},a=0;a<n.length;a++){var l=n[a];c[t(l)]=l}return c},n.indexOf=function(r,n){return 1===arguments.length?function(n){return A(r,n)}:A(r,n)},n.init=function(n){return"string"==typeof n?n.slice(0,-1):n.length?sn(n,0,-1):[]},n.intersection=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:k(function(n){return x(n,t)},n)},n.intersperse=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};for(var e=-1,u=n.length,i=[];++e<u;)e===u-1?i.push(n[e]):i.push(n[e],t);return i},n.is=pn,n.isEmpty=function(n){var r=j(n);return!["Undefined","NaN","Number","Null"].includes(r)&&(!n||("Object"===r?0===Object.keys(n).length:"Array"===r&&0===n.length))},n.isNil=function(n){return null==n},n.join=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:n.join(t)},n.juxt=function(e){return function(){for(var n=arguments.length,r=Array(n),t=0;t<n;t++)r[t]=arguments[t];return e.map(function(n){return n.apply(void 0,r)})}},n.keys=function(n){return Object.keys(n)},n.last=function(n){return"string"==typeof n?n[n.length-1]||"":n[n.length-1]},n.lastIndexOf=function(r,n){return 1===arguments.length?function(n){return E(r,n)}:E(r,n)},n.length=function(n){return s(n)||"string"==typeof n?n.length:NaN},n.lens=F,n.lensIndex=function(n){return F(gn(n),yn(n))},n.lensPath=function(n){return F(I(n),M(n))},n.lensProp=function(n){return F(S(n),c(n))},n.map=b,n.mapArray=d,n.mapObjIndexed=V,n.mapObject=m,n.match=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};n=n.match(t);return null===n?[]:n},n.mathMod=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:z(t)&&z(n)&&1<=n?(t%n+n)%n:NaN},n.max=w,n.maxBy=dn,n.maxByFn=vn,n.mean=bn,n.median=function(n){if(0===(t=n.length))return NaN;var r=2-t%2,t=(t-r)/2;return bn(Array.prototype.slice.call(n,0).sort(function(n,r){return n===r?0:n<r?-1:1}).slice(t,t+r))},n.merge=W,n.mergeAll=function(n){var r={};return b(function(n){r=W(r,n)},n),r},n.mergeDeepRight=_,n.mergeLeft=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:W(n,t)},n.mergeRight=W,n.mergeWith=wn,n.min=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:n<t?n:t},n.minBy=jn,n.minByFn=On,n.modulo=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:t%n},n.move=En,n.multiply=An,n.negate=function(n){return-n},n.none=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};for(var e=0;e<n.length;e++)if(t(n[e]))return!1;return!0},n.not=function(n){return!n},n.nth=gn,n.objOf=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:u({},t,n)},n.of=function(n){return[n]},n.omit=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if(null!=n){var e,u=T(t,","),i={};for(e in n)u.includes(e)||(i[e]=n[e]);return i}},n.on=function t(e,u,r,n){return 3===arguments.length?function(n){return t(e,u,r,n)}:2===arguments.length?function(n,r){return t(e,u,n,r)}:e(u(r),u(n))},n.once=function(n,r){return 1===arguments.length?o(Nn(n,r)):Nn(n,r)},n.or=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:t||n},n.over=Pn,n.partial=Sn,n.partialObject=function(e,u){return function(t){return"Async"===j(e)?new Promise(function(n,r){e(_(t,u)).then(n).catch(r)}):e(_(t,u))}},n.partition=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:(s(n)?Tn:kn)(t,n)},n.partitionArray=Tn,n.partitionObject=kn,n.path=I,n.pathEq=In,n.pathOr=Fn,n.paths=function r(t,e){return 1===arguments.length?function(n){return r(t,n)}:t.map(function(n){return I(n,e)})},n.pick=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if(null!=n){for(var e=T(t,","),u={},i=0;i<e.length;)e[i]in n&&(u[e[i]]=n[e[i]]),i++;return u}},n.pickAll=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if(null!=n){for(var e=T(t,","),u={},i=0;i<e.length;)e[i]in n?u[e[i]]=n[e[i]]:u[e[i]]=void 0,i++;return u}},n.pipe=Q,n.pluck=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};var e=[];return b(function(n){void 0!==n[t]&&e.push(n[t])},n),e},n.prepend=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:[t].concat("string"==typeof n?n.split(""):n)},n.product=Wn,n.prop=S,n.propEq=_n,n.propIs=Rn,n.propOr=qn,n.propSatisfies=Cn,n.props=function r(t,e){if(1===arguments.length)return function(n){return r(t,n)};if(s(t))return d(function(n){return e[n]},t);throw Error("propsToPick is not a list")},n.range=Bn,n.reduce=y,n.reduceFn=r,n.reject=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:k(function(n){return!t(n)},n)},n.repeat=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:Array(n).fill(t)},n.replace=Dn,n.reverse=function(n){return"string"==typeof n?n.split("").reverse().join(""):n.slice().reverse()},n.set=Ln,n.slice=Un,n.sort=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:a(n).sort(t)},n.sortBy=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:a(n).sort(function(n,r){return n=t(n),r=t(r),n===r?0:n<r?-1:1})},n.split=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:n.split(t)},n.splitAt=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if(!n)throw new TypeError("Cannot read property 'slice' of ".concat(n));if(!s(n)&&"string"!=typeof n)return[[],[]];e=n.length+t<0?0:n.length+t,e=(i=(u=t)<0)&&"Function"===j(e)?e():e,u=i||"Function"!==j(u)?u:u();var e,u,i=i?e:u;return[R(i,n),P(i,n)]},n.splitEvery=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if(t<1)throw Error("First argument to splitEvery must be a positive integer");for(var e=[],u=0;u<n.length;)e.push(n.slice(u,u+=t));return e},n.splitWhen=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if(!n)throw new TypeError("Cannot read property 'length' of ".concat(n));for(var e=[],u=[],i=!1,o=-1;o++<n.length-1;)i?u.push(n[o]):t(n[o])?(u.push(n[o]),i=!0):e.push(n[o]);return[e,u]},n.startsWith=function r(t,e){if(1===arguments.length)return function(n){return r(t,n)};if("string"==typeof e)return e.startsWith(t);if(!s(t))return!1;var u=!0;return t.filter(function(n,r){return!!u&&((n=N(n,e[r]))||(u=!1),n)}).length===t.length},n.subtract=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:t-n},n.sum=mn,n.symmetricDifference=function r(t,e){return 1===arguments.length?function(n){return r(t,n)}:v(k(function(n){return!x(n,e)},t),k(function(n){return!x(n,t)},e))},n.tail=function(n){return P(1,n)},n.take=R,n.takeLast=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};var e=n.length;if(t<0)return n.slice();var u=e<t?e:t;return"string"==typeof n?n.slice(e-u):sn(n,u=e-u,e)},n.takeLastWhile=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if(0===n.length)return n;for(var e=!1,u=[],i=n.length;!e||0===i;)!1===t(n[--i])?e=!0:e||u.push(n[i]);return s(n)?u.reverse():u.reverse().join("")},n.takeWhile=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};var e=s(n);if(!e&&"string"!=typeof n)throw Error("`iterable` is neither list nor a string");for(var u=!0,i=[],o=-1;o++<n.length-1;)t(n[o])?u&&i.push(n[o]):u=u&&!1;return e?i:i.join("")},n.tap=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:(t(n),n)},n.test=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if("string"==typeof t)throw new TypeError('‘test’ requires a value of type RegExp as its first argument; received "'.concat(t,'"'));return-1!=n.search(t)},n.times=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};if(!Number.isInteger(n)||n<0)throw new RangeError("n must be an integer");return b(t,Bn(0,n))},n.toLower=function(n){return n.toLowerCase()},n.toPairs=function(n){return Object.entries(n)},n.toString=function(n){return""+n},n.toUpper=function(n){return n.toUpperCase()},n.transpose=function(n){return n.reduce(function(t,n){return n.forEach(function(n,r){return s(t[r])?t[r].push(n):t.push([n])}),t},[])},n.trim=function(n){return n.trim()},n.tryCatch=function(e,u){if(!zn(e))throw Error("R.tryCatch | fn '".concat(e,"'"));var i=zn(u);return function(){for(var n=arguments.length,r=Array(n),t=0;t<n;t++)r[t]=arguments[t];try{return e.apply(void 0,r)}catch(n){return i?u.apply(void 0,[n].concat(r)):u}}},n.type=j,n.unapply=function(e){return function(){for(var n=arguments.length,r=Array(n),t=0;t<n;t++)r[t]=arguments[t];return e.call(this,r)}},n.union=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};var e=a(t);return n.forEach(function(n){x(n,t)||e.push(n)}),e},n.uniq=tn,n.uniqWith=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};for(var e=-1,u=[];++e<n.length;){var i=n[e];!function(n,r,t){for(var e=!1,u=-1;++u<t.length&&!e;)n(r,t[u])&&(e=!0);return e}(t,i,u)&&u.push(i)}return u},n.unless=function r(t,e){return 1===arguments.length?function(n){return r(t,n)}:function(n){return t(n)?n:e(n)}},n.unwind=function r(t,e){return 1===arguments.length?function(n){return r(t,n)}:s(e[t])?d(function(n){return C(C({},e),{},u({},t,n))},e[t]):[e]},n.update=yn,n.values=function(n){return"Object"!==j(n)?[]:Object.values(n)},n.view=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:t(Mn)(n).x},n.when=Jn,n.where=function r(t,n){if(void 0===n)return function(n){return r(t,n)};var e,u=!0;for(e in t){var i=t[e](n[e]);u&&!1===i&&(u=!1)}return u},n.whereAny=function r(t,n){if(void 0===n)return function(n){return r(t,n)};for(var e in t)if(t[e](n[e]))return!0;return!1},n.whereEq=function r(t,e){if(1===arguments.length)return function(n){return r(t,n)};var n=k(function(n,r){return N(n,e[r])},t);return Object.keys(n).length===Object.keys(t).length},n.without=function r(t,n){return void 0===n?function(n){return r(t,n)}:y(function(n,r){return-1<A(r,t)?n:n.concat(r)},[],n)},n.xor=function r(t,n){return 1===arguments.length?function(n){return r(t,n)}:!!t&&!n||!!n&&!t},n.zip=function r(t,n){if(1===arguments.length)return function(n){return r(t,n)};for(var e=[],u=Math.min(t.length,n.length),i=0;i<u;i++)e[i]=[t[i],n[i]];return e},n.zipObj=function r(t,e){return 1===arguments.length?function(n){return r(t,n)}:R(e.length,t).reduce(function(n,r,t){return n[r]=e[t],n},{})},n.zipWith=Hn,Object.defineProperty(n,"__esModule",{value:!0})}); |
101
index.d.ts
@@ -1,2 +0,2 @@ | ||
export type RambdaTypes = "Object" | "Number" | "Boolean" | "String" | "Null" | "Array" | "RegExp" | "NaN" | "Function" | "Undefined" | "Async" | "Promise" | "Symbol" | "Set" | "Error"; | ||
export type RambdaTypes = "Object" | "Number" | "Boolean" | "String" | "Null" | "Array" | "RegExp" | "NaN" | "Function" | "Undefined" | "Async" | "Promise" | "Symbol" | "Set" | "Error" | "Map" | "WeakMap" | "Generator" | "GeneratorFunction" | "BigInt" | "ArrayBuffer"; | ||
@@ -592,3 +592,3 @@ export type IndexedIterator<T, U> = (x: T, i: number) => U; | ||
*/ | ||
export function init<T>(input: T[]): T[]; | ||
export function init<T extends unknown[]>(input: T): T extends readonly [...infer U, any] ? U : [...T]; | ||
export function init(input: string): string; | ||
@@ -767,3 +767,3 @@ | ||
/** | ||
* It creates a copy of `target` object with overidden `newProps` properties. | ||
* Same as `R.mergeRight`. | ||
*/ | ||
@@ -774,2 +774,8 @@ export function merge<A, B>(target: A, newProps: B): A & B | ||
/** | ||
* It creates a copy of `target` object with overidden `newProps` properties. Previously known as `R.merge` but renamed after Ramda did the same. | ||
*/ | ||
export function mergeRight<A, B>(target: A, newProps: B): A & B | ||
export function mergeRight<Output>(target: any): (newProps: any) => Output; | ||
/** | ||
* It merges all objects of `list` array sequentially and returns the result. | ||
@@ -844,6 +850,10 @@ */ | ||
/** | ||
* Curried version of `list[index]`. | ||
* Curried version of `input[index]`. | ||
*/ | ||
export function nth<T>(index: number, list: T[]): T | undefined; | ||
export function nth(index: number): <T>(list: T[]) => T | undefined; | ||
export function nth(index: number, input: string): string; | ||
export function nth<T>(index: number, input: T[]): T | undefined; | ||
export function nth(n: number): { | ||
<T>(input: T[]): T | undefined; | ||
(input: string): string; | ||
}; | ||
@@ -925,3 +935,3 @@ /** | ||
/** | ||
* It loops over members of `pathsToSearch` as `singlePath` and returns the array produced by `R.path(singlePath, obj)`. | ||
* It loops over members of `pathsToSearch` as `singlePath` and returns the array produced by `R.path(singlePath, Record<string, unknown>)`. | ||
* | ||
@@ -936,3 +946,3 @@ * Because it calls `R.path`, then `singlePath` can be either string or a list. | ||
/** | ||
* It reads `obj` input and returns either `R.path(pathToSearch, obj)` result or `defaultValue` input. | ||
* It reads `obj` input and returns either `R.path(pathToSearch, Record<string, unknown>)` result or `defaultValue` input. | ||
*/ | ||
@@ -1087,2 +1097,8 @@ export function pathOr<T>(defaultValue: T, pathToSearch: Path, obj: any): T; | ||
/** | ||
* It returns `true` if the object property satisfies a given predicate. | ||
*/ | ||
export function propSatisfies<T>(predicate: Predicate<T>, property: string, obj: Record<string, T>): boolean; | ||
export function propSatisfies<T>(predicate: Predicate<T>, property: string): (obj: Record<string, T>) => boolean; | ||
/** | ||
* It returns list of numbers between `startInclusive` to `endExclusive` markers. | ||
@@ -1192,3 +1208,3 @@ */ | ||
*/ | ||
export function tail<T>(input: T[]): T[]; | ||
export function tail<T extends unknown[]>(input: T): T extends [any, ...infer U] ? U : [...T]; | ||
export function tail(input: string): string; | ||
@@ -1323,3 +1339,3 @@ | ||
/** | ||
* With correct input, this is nothing more than `Object.values(obj)`. If `obj` is not an object, then it returns an empty array. | ||
* With correct input, this is nothing more than `Object.values(Record<string, unknown>)`. If `obj` is not an object, then it returns an empty array. | ||
*/ | ||
@@ -1470,1 +1486,66 @@ export function values<T extends object, K extends keyof T>(obj: T): T[K][]; | ||
export function bind<F extends (...args: any[]) => any, T>(fn: F): (thisObj: T) => (...args: Parameters<F>) => ReturnType<F>; | ||
/** | ||
* It takes two objects and a function, which will be used when there is an overlap between the keys. | ||
*/ | ||
export function mergeWith(fn: (x: any, z: any) => any, a: Obj, b: Record<string, unknown>): Obj; | ||
export function mergeWith<Output>(fn: (x: any, z: any) => any, a: Obj, b: Record<string, unknown>): Output; | ||
export function mergeWith(fn: (x: any, z: any) => any, a: Record<string, unknown>): (b: Record<string, unknown>) => Obj; | ||
export function mergeWith<Output>(fn: (x: any, z: any) => any, a: Record<string, unknown>): (b: Record<string, unknown>) => Output; | ||
export function mergeWith(fn: (x: any, z: any) => any): <U, V>(a: U, b: V) => Obj; | ||
export function mergeWith<Output>(fn: (x: any, z: any) => any): <U, V>(a: U, b: V) => Output; | ||
/** | ||
* It applies list of function to a list of inputs. | ||
*/ | ||
export function juxt<A extends any[], R1>(fns: [(...a: A) => R1]): (...a: A) => [R1]; | ||
export function juxt<A extends any[], R1, R2>(fns: [(...a: A) => R1, (...a: A) => R2]): (...a: A) => [R1, R2]; | ||
export function juxt<A extends any[], R1, R2, R3>(fns: [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3]): (...a: A) => [R1, R2, R3]; | ||
export function juxt<A extends any[], R1, R2, R3, R4>(fns: [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3, (...a: A) => R4]): (...a: A) => [R1, R2, R3, R4]; | ||
export function juxt<A extends any[], R1, R2, R3, R4, R5>(fns: [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3, (...a: A) => R4, (...a: A) => R5]): (...a: A) => [R1, R2, R3, R4, R5]; | ||
export function juxt<A extends any[], U>(fns: Array<(...args: A) => U>): (...args: A) => U[]; | ||
/** | ||
* It counts how many times `predicate` function returns `true`, when supplied with iteration of `list`. | ||
*/ | ||
export function count<T>(predicate: (x: T) => boolean, list: T[]): number; | ||
export function count<T>(predicate: (x: T) => boolean): (list: T[]) => number; | ||
/** | ||
* It counts elements in a list after each instance of the input list is passed through `transformFn` function. | ||
*/ | ||
export function countBy<T extends unknown>(transformFn: (x: T) => any, list: T[]): Record<string, number>; | ||
export function countBy<T extends unknown>(transformFn: (x: T) => any): (list: T[]) => Record<string, number>; | ||
export function unwind<T, U>(prop: keyof T, obj: T): U[]; | ||
export function unwind<T, U>(prop: keyof T): (obj: T) => U[]; | ||
/** | ||
* It passes the two inputs through `unaryFn` and then the results are passed as inputs the the `binaryFn` to receive the final result(`binaryFn(unaryFn(FIRST_INPUT), unaryFn(SECOND_INPUT))`). | ||
* | ||
* This method is also known as P combinator. | ||
*/ | ||
export function on<T, U, R>(binaryFn: (a: U, b: U) => R, unaryFn: (value: T) => U, a: T, b: T): R; | ||
export function on<T, U, R>(binaryFn: (a: U, b: U) => R, unaryFn: (value: T) => U, a: T): (b: T) => R; | ||
export function on<T, U, R>(binaryFn: (a: U, b: U) => R, unaryFn: (value: T) => U): { | ||
(a: T, b: T): R; | ||
(a: T): (b: T) => R; | ||
}; | ||
/** | ||
* Same as `R.where`, but it will return `true` if at least one condition check returns `true`. | ||
*/ | ||
export function whereAny<T, U>(conditions: T, input: U): boolean; | ||
export function whereAny<T>(conditions: T): <U>(input: U) => boolean; | ||
export function whereAny<ObjFunc2, U>(conditions: ObjFunc2, input: U): boolean; | ||
export function whereAny<ObjFunc2>(conditions: ObjFunc2): <U>(input: U) => boolean; | ||
/** | ||
* `R.partialObject` is a curry helper designed specifically for functions accepting object as a single argument. | ||
* | ||
* Initially the function knows only a part from the whole input object and then `R.partialObject` helps in preparing the function for the second part, when it receives the rest of the input. | ||
*/ | ||
export function partialObject<Input, PartialInput, Output>( | ||
fn: (input: Input) => Output, | ||
partialInput: PartialInput, | ||
): (input: Pick<Input, Exclude<keyof Input, keyof PartialInput>>) => Output; |
238
package.json
{ | ||
"name": "rambda", | ||
"version": "7.0.3", | ||
"scripts": { | ||
"populatedocs": "cd ../rambda-scripts && yarn populate:docs", | ||
"populatedocs:x": "cd ../rambda-scripts && yarn populate:docs:rambdax", | ||
"populatereadme": "cd ../rambda-scripts && yarn populate:readme", | ||
"populatereadme:x": "cd ../rambda-scripts && yarn populate:readme:rambdax", | ||
"out": "yarn populatedocs && yarn populatereadme && yarn immutable && yarn build", | ||
"x": "yarn populatedocs:x && yarn populatereadme:x && yarn immutable:x", | ||
"github": "cd ../rambda-scripts && yarn github", | ||
"fix-docsify": "cd ../rambda-scripts && yarn fix-docsify:rambda", | ||
"immutable": "cd ../rambda-scripts && yarn immutable:rambda", | ||
"immutable:x": "cd ../rambda-scripts && yarn immutable:rambdax", | ||
"usedby": "cd ../rambda-scripts && yarn usedby", | ||
"lint": "cd ../rambda-scripts && yarn lint", | ||
"build": "yarn build:main && yarn build:web", | ||
"build:web": "cross-env NODE_ENV=build rollup -c files/rollup.web.config.js", | ||
"build:main": "cross-env NODE_ENV=build rollup -c files/rollup.config.js", | ||
"docs": "npx docsify-cli init ./docs && yarn fix-docsify", | ||
"new": "cd ../rambda-scripts && yarn new", | ||
"test": "jest source -u --bail=false", | ||
"test:dev": "jest source --watch", | ||
"cover:spec": "jest source --coverage --no-cache -w 1", | ||
"cover": "yarn typings && yarn cover:spec", | ||
"build:step": "yarn populatedocs && yarn populatereadme && yarn build:main", | ||
"benchmark:check:apply": "cd ../rambda-scripts && yarn check-benchmark", | ||
"benchmark:check": "yarn build:step && METHOD=compose yarn benchmark:check:apply", | ||
"benchmark:single": "cd ../rambda-scripts && METHOD=pipe RAMBDA_RUN_ALL=ON RAMBDA_RUN_INDEXES=ON yarn benchmark", | ||
"benchmark:all": "yarn build:step && cd ../rambda-scripts && yarn benchmark:all", | ||
"benchmark": "yarn build:step && yarn benchmark:single", | ||
"typings": "dtslint --localTs ./node_modules/typescript/lib --expectOnly ./source", | ||
"fix": "mkdir $HOME/.dts/perf -p" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@babel/core": "7.16.0", | ||
"@babel/plugin-proposal-object-rest-spread": "7.16.0", | ||
"@babel/preset-env": "7.16.4", | ||
"@rollup/plugin-babel": "5.3.0", | ||
"@rollup/plugin-commonjs": "21.0.1", | ||
"@rollup/plugin-json": "4.1.0", | ||
"@rollup/plugin-node-resolve": "13.0.6", | ||
"@rollup/plugin-replace": "3.0.0", | ||
"@types/jest": "27.0.3", | ||
"@types/ramda": "0.27.58", | ||
"combinate": "1.1.7", | ||
"cross-env": "7.0.3", | ||
"dtslint": "4.2.1", | ||
"helpers-fn": "1.6.0", | ||
"is-ci": "3.0.1", | ||
"jest": "27.4.3", | ||
"jest-extended": "0.11.5", | ||
"lodash": "4.17.21", | ||
"rambdax": "7.4.1", | ||
"ramda": "0.27.1", | ||
"rollup": "2.60.2", | ||
"rollup-plugin-cleanup": "3.2.1", | ||
"rollup-plugin-sourcemaps": "0.6.3", | ||
"rollup-plugin-uglify": "6.0.4", | ||
"typescript": "4.5.2" | ||
}, | ||
"depFn": [ | ||
"jest-extended" | ||
], | ||
"jest": { | ||
"testEnvironment": "node", | ||
"testRegex": ".*\\.spec\\.js$", | ||
"setupFilesAfterEnv": [ | ||
"jest-extended" | ||
], | ||
"collectCoverageFrom": [ | ||
"source/*.js", | ||
"!_internals", | ||
"!benchmarks" | ||
] | ||
}, | ||
"files": [ | ||
"dist", | ||
"src", | ||
"README.md", | ||
"CHANGELOG.md", | ||
"index.d.ts", | ||
"immutable.d.ts", | ||
"immutable.js" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/selfrefactor/rambda.git" | ||
}, | ||
"license": "MIT", | ||
"author": "self_refactor", | ||
"description": "Lightweight and faster alternative to Ramda with included TS definitions", | ||
"sideEffects": false, | ||
"main": "./dist/rambda.js", | ||
"umd": "./dist/rambda.umd.js", | ||
"module": "./dist/rambda.mjs", | ||
"types": "./index.d.ts", | ||
"exports": { | ||
".": { | ||
"import": "./dist/rambda.mjs", | ||
"require": "./dist/rambda.js", | ||
"default": "./dist/rambda.js", | ||
"types": "./index.d.ts" | ||
}, | ||
"./immutable": { | ||
"import": "./immutable.js", | ||
"require": "./immutable.js", | ||
"default": "./immutable.js", | ||
"types": "./immutable.d.ts" | ||
} | ||
}, | ||
"keywords": [ | ||
"ramda", | ||
"fp", | ||
"functional", | ||
"utility", | ||
"lodash" | ||
], | ||
"homepage": "https://github.com/selfrefactor/rambda#readme" | ||
"name": "rambda", | ||
"version": "7.1.0", | ||
"scripts": { | ||
"populatedocs": "cd ../rambda-scripts && yarn populate:docs", | ||
"populatedocs:x": "cd ../rambda-scripts && yarn populate:docs:rambdax", | ||
"populatereadme": "cd ../rambda-scripts && yarn populate:readme", | ||
"populatereadme:x": "cd ../rambda-scripts && yarn populate:readme:rambdax", | ||
"out": "yarn populatedocs && yarn populatereadme && yarn immutable && yarn build", | ||
"x": "yarn populatedocs:x && yarn populatereadme:x && yarn immutable:x", | ||
"github": "cd ../rambda-scripts && yarn github", | ||
"fix-docsify": "cd ../rambda-scripts && yarn fix-docsify:rambda", | ||
"immutable": "cd ../rambda-scripts && yarn immutable:rambda", | ||
"immutable:x": "cd ../rambda-scripts && yarn immutable:rambdax", | ||
"usedby": "cd ../rambda-scripts && yarn usedby", | ||
"lint:all": "cd ../rambda-scripts && yarn lint", | ||
"lint:staged": "cd ../rambda-scripts && yarn lint:staged", | ||
"lint": "yarn git:add && yarn lint:staged && yarn git:add", | ||
"git:add": "git add -A", | ||
"build": "yarn build:main && yarn build:web", | ||
"build:web": "cross-env NODE_ENV=build rollup -c files/rollup.web.config.js", | ||
"build:main": "cross-env NODE_ENV=build rollup -c files/rollup.config.js", | ||
"docs": "npx docsify-cli init ./docs && yarn fix-docsify", | ||
"new": "cd ../rambda-scripts && yarn new", | ||
"test:all": "jest source -u --bail=false", | ||
"test": "jest -o --watch", | ||
"cover:spec": "jest source --coverage --no-cache -w 1", | ||
"cover": "yarn typings && yarn cover:spec", | ||
"build:step": "yarn populatedocs && yarn populatereadme && yarn build:main", | ||
"benchmark:check:apply": "cd ../rambda-scripts && yarn check-benchmark", | ||
"benchmark:check": "yarn build:step && METHOD=compose yarn benchmark:check:apply", | ||
"benchmark:single": "cd ../rambda-scripts && METHOD=pipe RAMBDA_RUN_ALL=ON RAMBDA_RUN_INDEXES=ON yarn benchmark", | ||
"benchmark:all": "yarn build:step && cd ../rambda-scripts && yarn benchmark:all", | ||
"benchmark": "yarn build:step && yarn benchmark:single", | ||
"typings": "dtslint --localTs ./node_modules/typescript/lib --expectOnly ./source", | ||
"fix": "mkdir $HOME/.dts/perf -p" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@babel/core": "7.17.10", | ||
"@babel/plugin-proposal-object-rest-spread": "7.17.3", | ||
"@babel/preset-env": "7.17.10", | ||
"@rollup/plugin-babel": "5.3.1", | ||
"@rollup/plugin-commonjs": "22.0.0", | ||
"@rollup/plugin-json": "4.1.0", | ||
"@rollup/plugin-node-resolve": "13.2.1", | ||
"@rollup/plugin-replace": "4.0.0", | ||
"@types/jest": "27.4.1", | ||
"@types/ramda": "0.28.11", | ||
"combinate": "1.1.11", | ||
"cross-env": "7.0.3", | ||
"dtslint": "4.2.1", | ||
"helpers-fn": "1.6.0", | ||
"is-ci": "3.0.1", | ||
"jest": "28.0.3", | ||
"jest-extended": "2.0.0", | ||
"lodash": "4.17.21", | ||
"rambdax": "8.0.1", | ||
"ramda": "0.28.0", | ||
"rollup": "2.70.2", | ||
"rollup-plugin-cleanup": "3.2.1", | ||
"rollup-plugin-sourcemaps": "0.6.3", | ||
"rollup-plugin-uglify": "6.0.4", | ||
"typescript": "4.6.4" | ||
}, | ||
"jest": { | ||
"testEnvironment": "node", | ||
"testRegex": ".*\\.spec\\.js$", | ||
"setupFilesAfterEnv": [ | ||
"./files/testSetup.js" | ||
], | ||
"collectCoverageFrom": [ | ||
"source/*.js", | ||
"!_internals", | ||
"!benchmarks" | ||
] | ||
}, | ||
"files": [ | ||
"dist", | ||
"src", | ||
"README.md", | ||
"CHANGELOG.md", | ||
"index.d.ts", | ||
"immutable.d.ts", | ||
"immutable.js" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/selfrefactor/rambda.git" | ||
}, | ||
"license": "MIT", | ||
"author": "self_refactor", | ||
"description": "Lightweight and faster alternative to Ramda with included TS definitions", | ||
"sideEffects": false, | ||
"main": "./dist/rambda.js", | ||
"umd": "./dist/rambda.umd.js", | ||
"module": "./dist/rambda.mjs", | ||
"types": "./index.d.ts", | ||
"exports": { | ||
".": { | ||
"import": "./dist/rambda.mjs", | ||
"require": "./dist/rambda.js", | ||
"default": "./dist/rambda.js", | ||
"types": "./index.d.ts" | ||
}, | ||
"./immutable": { | ||
"import": "./immutable.js", | ||
"require": "./immutable.js", | ||
"default": "./immutable.js", | ||
"types": "./immutable.d.ts" | ||
} | ||
}, | ||
"keywords": [ | ||
"ramda", | ||
"fp", | ||
"functional", | ||
"utility", | ||
"lodash" | ||
], | ||
"homepage": "https://github.com/selfrefactor/rambda#readme" | ||
} |
@@ -1,2 +0,2 @@ | ||
export function _isInteger(n) { | ||
export function _isInteger(n){ | ||
return n << 0 === n | ||
@@ -3,0 +3,0 @@ } |
@@ -1,2 +0,1 @@ | ||
// extract for optimization | ||
export const _keys = Object.keys |
@@ -1,11 +0,6 @@ | ||
// @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is | ||
export function _objectIs(a, b) { | ||
// SameValue algorithm | ||
if (a === b) { | ||
// Steps 1-5, 7-10 | ||
// Steps 6.b-6.e: +0 != -0 | ||
export function _objectIs(a, b){ | ||
if (a === b){ | ||
return a !== 0 || 1 / a === 1 / b | ||
} | ||
// Step 6.a: NaN === NaN | ||
return a !== a && b !== b | ||
@@ -12,0 +7,0 @@ } |
@@ -1,10 +0,12 @@ | ||
export default function baseSlice(array, start, end) { | ||
export default function baseSlice( | ||
array, start, end | ||
){ | ||
let index = -1 | ||
let {length} = array | ||
let { length } = array | ||
end = end > length ? length : end | ||
if (end < 0) { | ||
if (end < 0){ | ||
end += length | ||
} | ||
length = start > end ? 0 : (end - start) >>> 0 | ||
length = start > end ? 0 : end - start >>> 0 | ||
start >>>= 0 | ||
@@ -14,4 +16,4 @@ | ||
while (++index < length) { | ||
result[index] = array[index + start] | ||
while (++index < length){ | ||
result[ index ] = array[ index + start ] | ||
} | ||
@@ -18,0 +20,0 @@ |
@@ -1,3 +0,1 @@ | ||
export const cloneList = list => { | ||
return Array.prototype.slice.call(list) | ||
} | ||
export const cloneList = list => Array.prototype.slice.call(list) |
@@ -1,9 +0,9 @@ | ||
import {type} from '../type' | ||
import {_isArray} from './_isArray' | ||
import { type } from '../type.js' | ||
import { _isArray } from './_isArray.js' | ||
export function isFalsy(x) { | ||
if (_isArray(x)) { | ||
export function isFalsy(x){ | ||
if (_isArray(x)){ | ||
return x.length === 0 | ||
} | ||
if (type(x) === 'Object') { | ||
if (type(x) === 'Object'){ | ||
return Object.keys(x).length === 0 | ||
@@ -10,0 +10,0 @@ } |
@@ -1,5 +0,5 @@ | ||
import {type} from '../type' | ||
import { type } from '../type.js' | ||
export function _isObject(input) { | ||
export function _isObject(input){ | ||
return type(input) === 'Object' | ||
} |
@@ -1,9 +0,9 @@ | ||
import {type} from '../type' | ||
import {_isArray} from './_isArray' | ||
import { type } from '../type.js' | ||
import { _isArray } from './_isArray.js' | ||
export function isTruthy(x) { | ||
if (_isArray(x)) { | ||
export function isTruthy(x){ | ||
if (_isArray(x)){ | ||
return x.length > 0 | ||
} | ||
if (type(x) === 'Object') { | ||
if (type(x) === 'Object'){ | ||
return Object.keys(x).length > 0 | ||
@@ -10,0 +10,0 @@ } |
@@ -1,35 +0,41 @@ | ||
import {type as typeMethod} from '../type' | ||
import {_indexOf} from '../equals' | ||
import { _indexOf } from '../equals.js' | ||
import { type as typeMethod } from '../type.js' | ||
export class _Set { | ||
constructor() { | ||
export class _Set{ | ||
constructor(){ | ||
this.set = new Set() | ||
this.items = {} | ||
} | ||
checkUniqueness(item) { | ||
checkUniqueness(item){ | ||
const type = typeMethod(item) | ||
if (['Null', 'Undefined', 'NaN'].includes(type)) { | ||
if (type in this.items) { | ||
if ([ 'Null', 'Undefined', 'NaN' ].includes(type)){ | ||
if (type in this.items){ | ||
return false | ||
} | ||
this.items[type] = true | ||
this.items[ type ] = true | ||
return true | ||
} | ||
if (!['Object', 'Array'].includes(type)) { | ||
if (![ 'Object', 'Array' ].includes(type)){ | ||
const prevSize = this.set.size | ||
this.set.add(item) | ||
return this.set.size !== prevSize | ||
} | ||
if (!(type in this.items)) { | ||
this.items[type] = [item] | ||
if (!(type in this.items)){ | ||
this.items[ type ] = [ item ] | ||
return true | ||
} | ||
if (_indexOf(item, this.items[type]) === -1) { | ||
this.items[type].push(item) | ||
if (_indexOf(item, this.items[ type ]) === -1){ | ||
this.items[ type ].push(item) | ||
return true | ||
} | ||
return false | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
export function add(a, b) { | ||
export function add(a, b){ | ||
if (arguments.length === 1) return _b => add(a, _b) | ||
@@ -3,0 +3,0 @@ |
@@ -1,5 +0,7 @@ | ||
import {curry} from './curry' | ||
import {cloneList} from './_internals/cloneList' | ||
import { cloneList } from './_internals/cloneList.js' | ||
import { curry } from './curry.js' | ||
function adjustFn(index, replaceFn, list) { | ||
function adjustFn( | ||
index, replaceFn, list | ||
){ | ||
const actualIndex = index < 0 ? list.length + index : index | ||
@@ -9,3 +11,3 @@ if (index >= list.length || actualIndex < 0) return list | ||
const clone = cloneList(list) | ||
clone[actualIndex] = replaceFn(clone[actualIndex]) | ||
clone[ actualIndex ] = replaceFn(clone[ actualIndex ]) | ||
@@ -12,0 +14,0 @@ return clone |
@@ -1,6 +0,6 @@ | ||
export function all(predicate, list) { | ||
export function all(predicate, list){ | ||
if (arguments.length === 1) return _list => all(predicate, _list) | ||
for (let i = 0; i < list.length; i++) { | ||
if (!predicate(list[i])) return false | ||
for (let i = 0; i < list.length; i++){ | ||
if (!predicate(list[ i ])) return false | ||
} | ||
@@ -7,0 +7,0 @@ |
@@ -1,6 +0,6 @@ | ||
export function allPass(predicates) { | ||
export function allPass(predicates){ | ||
return (...input) => { | ||
let counter = 0 | ||
while (counter < predicates.length) { | ||
if (!predicates[counter](...input)) { | ||
while (counter < predicates.length){ | ||
if (!predicates[ counter ](...input)){ | ||
return false | ||
@@ -7,0 +7,0 @@ } |
@@ -1,3 +0,3 @@ | ||
export function always(x) { | ||
return () => x | ||
export function always(x){ | ||
return _ => x | ||
} |
@@ -1,2 +0,2 @@ | ||
export function and(a, b) { | ||
export function and(a, b){ | ||
if (arguments.length === 1) return _b => and(a, _b) | ||
@@ -3,0 +3,0 @@ |
@@ -1,7 +0,7 @@ | ||
export function any(predicate, list) { | ||
export function any(predicate, list){ | ||
if (arguments.length === 1) return _list => any(predicate, _list) | ||
let counter = 0 | ||
while (counter < list.length) { | ||
if (predicate(list[counter], counter)) { | ||
while (counter < list.length){ | ||
if (predicate(list[ counter ], counter)){ | ||
return true | ||
@@ -8,0 +8,0 @@ } |
@@ -1,6 +0,6 @@ | ||
export function anyPass(predicates) { | ||
export function anyPass(predicates){ | ||
return (...input) => { | ||
let counter = 0 | ||
while (counter < predicates.length) { | ||
if (predicates[counter](...input)) { | ||
while (counter < predicates.length){ | ||
if (predicates[ counter ](...input)){ | ||
return true | ||
@@ -7,0 +7,0 @@ } |
@@ -1,4 +0,4 @@ | ||
import {cloneList} from './_internals/cloneList' | ||
import { cloneList } from './_internals/cloneList.js' | ||
export function append(x, input) { | ||
export function append(x, input){ | ||
if (arguments.length === 1) return _input => append(x, _input) | ||
@@ -5,0 +5,0 @@ |
@@ -1,3 +0,3 @@ | ||
export function apply(fn, args) { | ||
if (arguments.length === 1) { | ||
export function apply(fn, args){ | ||
if (arguments.length === 1){ | ||
return _args => apply(fn, _args) | ||
@@ -4,0 +4,0 @@ } |
@@ -1,14 +0,14 @@ | ||
import {_isArray} from './_internals/_isArray' | ||
import { _isArray } from './_internals/_isArray.js' | ||
// recursively traverse the given spec object to find the highest arity function | ||
function __findHighestArity(spec, max = 0) { | ||
for (const key in spec) { | ||
export function __findHighestArity(spec, max = 0){ | ||
for (const key in spec){ | ||
if (spec.hasOwnProperty(key) === false || key === 'constructor') continue | ||
if (typeof spec[key] === 'object') { | ||
max = Math.max(max, __findHighestArity(spec[key])) | ||
if (typeof spec[ key ] === 'object'){ | ||
max = Math.max(max, __findHighestArity(spec[ key ])) | ||
} | ||
if (typeof spec[key] === 'function') { | ||
max = Math.max(max, spec[key].length) | ||
if (typeof spec[ key ] === 'function'){ | ||
max = Math.max(max, spec[ key ].length) | ||
} | ||
@@ -20,9 +20,9 @@ } | ||
function __filterUndefined() { | ||
function __filterUndefined(){ | ||
const defined = [] | ||
let i = 0 | ||
const l = arguments.length | ||
while (i < l) { | ||
if (typeof arguments[i] === 'undefined') break | ||
defined[i] = arguments[i] | ||
while (i < l){ | ||
if (typeof arguments[ i ] === 'undefined') break | ||
defined[ i ] = arguments[ i ] | ||
i++ | ||
@@ -34,3 +34,5 @@ } | ||
function __applySpecWithArity(spec, arity, cache) { | ||
function __applySpecWithArity( | ||
spec, arity, cache | ||
){ | ||
const remaining = arity - cache.length | ||
@@ -40,33 +42,53 @@ | ||
return x => | ||
__applySpecWithArity(spec, arity, __filterUndefined(...cache, x)) | ||
__applySpecWithArity( | ||
spec, arity, __filterUndefined(...cache, x) | ||
) | ||
if (remaining === 2) | ||
return (x, y) => | ||
__applySpecWithArity(spec, arity, __filterUndefined(...cache, x, y)) | ||
__applySpecWithArity( | ||
spec, arity, __filterUndefined( | ||
...cache, x, y | ||
) | ||
) | ||
if (remaining === 3) | ||
return (x, y, z) => | ||
__applySpecWithArity(spec, arity, __filterUndefined(...cache, x, y, z)) | ||
return ( | ||
x, y, z | ||
) => | ||
__applySpecWithArity( | ||
spec, arity, __filterUndefined( | ||
...cache, x, y, z | ||
) | ||
) | ||
if (remaining === 4) | ||
return (x, y, z, a) => | ||
return ( | ||
x, y, z, a | ||
) => | ||
__applySpecWithArity( | ||
spec, | ||
arity, | ||
__filterUndefined(...cache, x, y, z, a) | ||
__filterUndefined( | ||
...cache, x, y, z, a | ||
) | ||
) | ||
if (remaining > 4) | ||
return (...args) => | ||
__applySpecWithArity(spec, arity, __filterUndefined(...cache, ...args)) | ||
__applySpecWithArity( | ||
spec, arity, __filterUndefined(...cache, ...args) | ||
) | ||
// handle spec as Array | ||
if (_isArray(spec)) { | ||
if (_isArray(spec)){ | ||
const ret = [] | ||
let i = 0 | ||
const l = spec.length | ||
for (; i < l; i++) { | ||
for (; i < l; i++){ | ||
// handle recursive spec inside array | ||
if (typeof spec[i] === 'object' || _isArray(spec[i])) { | ||
ret[i] = __applySpecWithArity(spec[i], arity, cache) | ||
if (typeof spec[ i ] === 'object' || _isArray(spec[ i ])){ | ||
ret[ i ] = __applySpecWithArity( | ||
spec[ i ], arity, cache | ||
) | ||
} | ||
// apply spec to the key | ||
if (typeof spec[i] === 'function') { | ||
ret[i] = spec[i](...cache) | ||
if (typeof spec[ i ] === 'function'){ | ||
ret[ i ] = spec[ i ](...cache) | ||
} | ||
@@ -81,8 +103,10 @@ } | ||
// apply callbacks to each property in the spec object | ||
for (const key in spec) { | ||
for (const key in spec){ | ||
if (spec.hasOwnProperty(key) === false || key === 'constructor') continue | ||
// apply the spec recursively | ||
if (typeof spec[key] === 'object') { | ||
ret[key] = __applySpecWithArity(spec[key], arity, cache) | ||
if (typeof spec[ key ] === 'object'){ | ||
ret[ key ] = __applySpecWithArity( | ||
spec[ key ], arity, cache | ||
) | ||
continue | ||
@@ -92,4 +116,4 @@ } | ||
// apply spec to the key | ||
if (typeof spec[key] === 'function') { | ||
ret[key] = spec[key](...cache) | ||
if (typeof spec[ key ] === 'function'){ | ||
ret[ key ] = spec[ key ](...cache) | ||
} | ||
@@ -101,12 +125,14 @@ } | ||
export function applySpec(spec, ...args) { | ||
export function applySpec(spec, ...args){ | ||
// get the highest arity spec function, cache the result and pass to __applySpecWithArity | ||
const arity = __findHighestArity(spec) | ||
if (arity === 0) { | ||
if (arity === 0){ | ||
return () => ({}) | ||
} | ||
const toReturn = __applySpecWithArity(spec, arity, args) | ||
const toReturn = __applySpecWithArity( | ||
spec, arity, args | ||
) | ||
return toReturn | ||
} |
@@ -1,7 +0,11 @@ | ||
import {curry} from './curry' | ||
import { curry } from './curry.js' | ||
function assocFn(prop, newValue, obj) { | ||
return Object.assign({}, obj, {[prop]: newValue}) | ||
function assocFn( | ||
prop, newValue, obj | ||
){ | ||
return Object.assign( | ||
{}, obj, { [ prop ] : newValue } | ||
) | ||
} | ||
export const assoc = curry(assocFn) |
@@ -1,18 +0,20 @@ | ||
import {_isArray} from './_internals/_isArray' | ||
import {_isInteger} from './_internals/_isInteger' | ||
import {assoc} from './assoc' | ||
import {curry} from './curry' | ||
import {cloneList} from './_internals/cloneList' | ||
import { _isArray } from './_internals/_isArray.js' | ||
import { _isInteger } from './_internals/_isInteger.js' | ||
import { cloneList } from './_internals/cloneList.js' | ||
import { assoc } from './assoc.js' | ||
import { curry } from './curry.js' | ||
function assocPathFn(path, newValue, input) { | ||
function assocPathFn( | ||
path, newValue, input | ||
){ | ||
const pathArrValue = | ||
typeof path === 'string' | ||
? path.split('.').map(x => (_isInteger(Number(x)) ? Number(x) : x)) | ||
: path | ||
if (pathArrValue.length === 0) { | ||
typeof path === 'string' ? | ||
path.split('.').map(x => _isInteger(Number(x)) ? Number(x) : x) : | ||
path | ||
if (pathArrValue.length === 0){ | ||
return newValue | ||
} | ||
const index = pathArrValue[0] | ||
if (pathArrValue.length > 1) { | ||
const index = pathArrValue[ 0 ] | ||
if (pathArrValue.length > 1){ | ||
const condition = | ||
@@ -23,7 +25,7 @@ typeof input !== 'object' || | ||
const nextinput = condition | ||
? _isInteger(pathArrValue[1]) | ||
? [] | ||
: {} | ||
: input[index] | ||
const nextinput = condition ? | ||
_isInteger(pathArrValue[ 1 ]) ? | ||
[] : | ||
{} : | ||
input[ index ] | ||
@@ -37,5 +39,5 @@ newValue = assocPathFn( | ||
if (_isInteger(index) && _isArray(input)) { | ||
if (_isInteger(index) && _isArray(input)){ | ||
const arr = cloneList(input) | ||
arr[index] = newValue | ||
arr[ index ] = newValue | ||
@@ -45,5 +47,7 @@ return arr | ||
return assoc(index, newValue, input) | ||
return assoc( | ||
index, newValue, input | ||
) | ||
} | ||
export const assocPath = curry(assocPathFn) |
@@ -1,5 +0,5 @@ | ||
import {curryN} from './curryN' | ||
import { curryN } from './curryN.js' | ||
export function bind(fn, thisObj) { | ||
if (arguments.length === 1) { | ||
export function bind(fn, thisObj){ | ||
if (arguments.length === 1){ | ||
return _thisObj => bind(fn, _thisObj) | ||
@@ -6,0 +6,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export function both(f, g) { | ||
export function both(f, g){ | ||
if (arguments.length === 1) return _g => both(f, _g) | ||
@@ -3,0 +3,0 @@ |
@@ -1,3 +0,3 @@ | ||
export function chain(fn, list) { | ||
if (arguments.length === 1) { | ||
export function chain(fn, list){ | ||
if (arguments.length === 1){ | ||
return _list => chain(fn, _list) | ||
@@ -4,0 +4,0 @@ } |
@@ -1,8 +0,8 @@ | ||
import {curry} from './curry' | ||
import { curry } from './curry.js' | ||
function clampFn(min, max, input) { | ||
if (min > max) { | ||
throw new Error( | ||
'min must not be greater than max in clamp(min, max, value)' | ||
) | ||
function clampFn( | ||
min, max, input | ||
){ | ||
if (min > max){ | ||
throw new Error('min must not be greater than max in clamp(min, max, value)') | ||
} | ||
@@ -9,0 +9,0 @@ if (input >= min && input <= max) return input |
@@ -1,15 +0,15 @@ | ||
import {_isArray} from './_internals/_isArray' | ||
import { _isArray } from './_internals/_isArray.js' | ||
export function clone(input) { | ||
export function clone(input){ | ||
const out = _isArray(input) ? Array(input.length) : {} | ||
if (input && input.getTime) return new Date(input.getTime()) | ||
for (const key in input) { | ||
const v = input[key] | ||
out[key] = | ||
typeof v === 'object' && v !== null | ||
? v.getTime | ||
? new Date(v.getTime()) | ||
: clone(v) | ||
: v | ||
for (const key in input){ | ||
const v = input[ key ] | ||
out[ key ] = | ||
typeof v === 'object' && v !== null ? | ||
v.getTime ? | ||
new Date(v.getTime()) : | ||
clone(v) : | ||
v | ||
} | ||
@@ -16,0 +16,0 @@ |
@@ -1,3 +0,3 @@ | ||
export function complement(fn) { | ||
export function complement(fn){ | ||
return (...input) => !fn(...input) | ||
} |
@@ -1,18 +0,9 @@ | ||
export function compose(...fns) { | ||
if (fns.length === 0) { | ||
import { pipe } from './pipe.js' | ||
export function compose(){ | ||
if (arguments.length === 0){ | ||
throw new Error('compose requires at least one argument') | ||
} | ||
return function (...args) { | ||
const list = fns.slice() | ||
if (list.length > 0) { | ||
const fn = list.pop() | ||
let result = fn.apply(this, args) | ||
while (list.length > 0) { | ||
result = list.pop()(result) | ||
} | ||
return result | ||
} | ||
} | ||
return pipe.apply(this, Array.prototype.slice.call(arguments, 0).reverse()) | ||
} |
@@ -1,5 +0,5 @@ | ||
export function concat(x, y) { | ||
export function concat(x, y){ | ||
if (arguments.length === 1) return _y => concat(x, _y) | ||
return typeof x === 'string' ? `${x}${y}` : [...x, ...y] | ||
return typeof x === 'string' ? `${ x }${ y }` : [ ...x, ...y ] | ||
} |
@@ -1,7 +0,7 @@ | ||
export function cond(conditions) { | ||
export function cond(conditions){ | ||
return input => { | ||
let done = false | ||
let toReturn | ||
conditions.forEach(([predicate, resultClosure]) => { | ||
if (!done && predicate(input)) { | ||
conditions.forEach(([ predicate, resultClosure ]) => { | ||
if (!done && predicate(input)){ | ||
done = true | ||
@@ -8,0 +8,0 @@ toReturn = resultClosure(input) |
@@ -1,18 +0,18 @@ | ||
import {curryN} from './curryN' | ||
import {map} from './map' | ||
import {max} from './max' | ||
import {reduce} from './reduce' | ||
import { curryN } from './curryN.js' | ||
import { map } from './map.js' | ||
import { max } from './max.js' | ||
import { reduce } from './reduce.js' | ||
export function converge(fn, transformers) { | ||
export function converge(fn, transformers){ | ||
if (arguments.length === 1) | ||
return _transformers => converge(fn, _transformers) | ||
const highestArity = reduce((a, b) => max(a, b.length), 0, transformers) | ||
const highestArity = reduce( | ||
(a, b) => max(a, b.length), 0, transformers | ||
) | ||
return curryN(highestArity, function () { | ||
return fn.apply( | ||
this, | ||
map(g => g.apply(this, arguments), transformers) | ||
) | ||
return curryN(highestArity, function (){ | ||
return fn.apply(this, | ||
map(g => g.apply(this, arguments), transformers)) | ||
}) | ||
} |
@@ -1,4 +0,4 @@ | ||
export function curry(fn, args = []) { | ||
export function curry(fn, args = []){ | ||
return (..._args) => | ||
(rest => (rest.length >= fn.length ? fn(...rest) : curry(fn, rest)))([ | ||
(rest => rest.length >= fn.length ? fn(...rest) : curry(fn, rest))([ | ||
...args, | ||
@@ -5,0 +5,0 @@ ..._args, |
@@ -1,3 +0,5 @@ | ||
function _curryN(n, cache, fn) { | ||
return function () { | ||
function _curryN( | ||
n, cache, fn | ||
){ | ||
return function (){ | ||
let ci = 0 | ||
@@ -8,8 +10,8 @@ let ai = 0 | ||
const args = new Array(cl + al) | ||
while (ci < cl) { | ||
args[ci] = cache[ci] | ||
while (ci < cl){ | ||
args[ ci ] = cache[ ci ] | ||
ci++ | ||
} | ||
while (ai < al) { | ||
args[cl + ai] = arguments[ai] | ||
while (ai < al){ | ||
args[ cl + ai ] = arguments[ ai ] | ||
ai++ | ||
@@ -19,67 +21,85 @@ } | ||
return args.length >= n | ||
? fn.apply(this, args) | ||
: _arity(remaining, _curryN(n, args, fn)) | ||
return args.length >= n ? | ||
fn.apply(this, args) : | ||
_arity(remaining, _curryN( | ||
n, args, fn | ||
)) | ||
} | ||
} | ||
function _arity(n, fn) { | ||
switch (n) { | ||
case 0: | ||
return function () { | ||
return fn.apply(this, arguments) | ||
} | ||
case 1: | ||
return function (_1) { | ||
return fn.apply(this, arguments) | ||
} | ||
case 2: | ||
return function (_1, _2) { | ||
return fn.apply(this, arguments) | ||
} | ||
case 3: | ||
return function (_1, _2, _3) { | ||
return fn.apply(this, arguments) | ||
} | ||
case 4: | ||
return function (_1, _2, _3, _4) { | ||
return fn.apply(this, arguments) | ||
} | ||
case 5: | ||
return function (_1, _2, _3, _4, _5) { | ||
return fn.apply(this, arguments) | ||
} | ||
case 6: | ||
return function (_1, _2, _3, _4, _5, _6) { | ||
return fn.apply(this, arguments) | ||
} | ||
case 7: | ||
return function (_1, _2, _3, _4, _5, _6, _7) { | ||
return fn.apply(this, arguments) | ||
} | ||
case 8: | ||
return function (_1, _2, _3, _4, _5, _6, _7, _8) { | ||
return fn.apply(this, arguments) | ||
} | ||
case 9: | ||
return function (_1, _2, _3, _4, _5, _6, _7, _8, _9) { | ||
return fn.apply(this, arguments) | ||
} | ||
default: | ||
return function (_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) { | ||
return fn.apply(this, arguments) | ||
} | ||
function _arity(n, fn){ | ||
switch (n){ | ||
case 0: | ||
return function (){ | ||
return fn.apply(this, arguments) | ||
} | ||
case 1: | ||
return function (_1){ | ||
return fn.apply(this, arguments) | ||
} | ||
case 2: | ||
return function (_1, _2){ | ||
return fn.apply(this, arguments) | ||
} | ||
case 3: | ||
return function ( | ||
_1, _2, _3 | ||
){ | ||
return fn.apply(this, arguments) | ||
} | ||
case 4: | ||
return function ( | ||
_1, _2, _3, _4 | ||
){ | ||
return fn.apply(this, arguments) | ||
} | ||
case 5: | ||
return function ( | ||
_1, _2, _3, _4, _5 | ||
){ | ||
return fn.apply(this, arguments) | ||
} | ||
case 6: | ||
return function ( | ||
_1, _2, _3, _4, _5, _6 | ||
){ | ||
return fn.apply(this, arguments) | ||
} | ||
case 7: | ||
return function ( | ||
_1, _2, _3, _4, _5, _6, _7 | ||
){ | ||
return fn.apply(this, arguments) | ||
} | ||
case 8: | ||
return function ( | ||
_1, _2, _3, _4, _5, _6, _7, _8 | ||
){ | ||
return fn.apply(this, arguments) | ||
} | ||
case 9: | ||
return function ( | ||
_1, _2, _3, _4, _5, _6, _7, _8, _9 | ||
){ | ||
return fn.apply(this, arguments) | ||
} | ||
default: | ||
return function ( | ||
_1, _2, _3, _4, _5, _6, _7, _8, _9, _10 | ||
){ | ||
return fn.apply(this, arguments) | ||
} | ||
} | ||
} | ||
export function curryN(n, fn) { | ||
export function curryN(n, fn){ | ||
if (arguments.length === 1) return _fn => curryN(n, _fn) | ||
if (n > 10) { | ||
throw new Error( | ||
'First argument to _arity must be a non-negative integer no greater than ten' | ||
) | ||
if (n > 10){ | ||
throw new Error('First argument to _arity must be a non-negative integer no greater than ten') | ||
} | ||
return _arity(n, _curryN(n, [], fn)) | ||
return _arity(n, _curryN( | ||
n, [], fn | ||
)) | ||
} |
@@ -1,2 +0,2 @@ | ||
function isFalsy(input) { | ||
function isFalsy(input){ | ||
return ( | ||
@@ -7,4 +7,4 @@ input === undefined || input === null || Number.isNaN(input) === true | ||
export function defaultTo(defaultArgument, input) { | ||
if (arguments.length === 1) { | ||
export function defaultTo(defaultArgument, input){ | ||
if (arguments.length === 1){ | ||
return _input => defaultTo(defaultArgument, _input) | ||
@@ -11,0 +11,0 @@ } |
@@ -1,5 +0,5 @@ | ||
import {includes} from './includes' | ||
import {uniq} from './uniq' | ||
import { includes } from './includes.js' | ||
import { uniq } from './uniq.js' | ||
export function difference(a, b) { | ||
export function difference(a, b){ | ||
if (arguments.length === 1) return _b => difference(a, _b) | ||
@@ -6,0 +6,0 @@ |
@@ -1,2 +0,2 @@ | ||
export function dissoc(prop, obj) { | ||
export function dissoc(prop, obj){ | ||
if (arguments.length === 1) return _obj => dissoc(prop, _obj) | ||
@@ -7,8 +7,8 @@ | ||
const willReturn = {} | ||
for (const p in obj) { | ||
willReturn[p] = obj[p] | ||
for (const p in obj){ | ||
willReturn[ p ] = obj[ p ] | ||
} | ||
delete willReturn[prop] | ||
delete willReturn[ prop ] | ||
return willReturn | ||
} |
@@ -1,2 +0,2 @@ | ||
export function divide(a, b) { | ||
export function divide(a, b){ | ||
if (arguments.length === 1) return _b => divide(a, _b) | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
export function drop(howManyToDrop, listOrString) { | ||
export function drop(howManyToDrop, listOrString){ | ||
if (arguments.length === 1) return _list => drop(howManyToDrop, _list) | ||
@@ -3,0 +3,0 @@ |
@@ -1,9 +0,9 @@ | ||
export function dropLast(howManyToDrop, listOrString) { | ||
if (arguments.length === 1) { | ||
export function dropLast(howManyToDrop, listOrString){ | ||
if (arguments.length === 1){ | ||
return _listOrString => dropLast(howManyToDrop, _listOrString) | ||
} | ||
return howManyToDrop > 0 | ||
? listOrString.slice(0, -howManyToDrop) | ||
: listOrString.slice() | ||
return howManyToDrop > 0 ? | ||
listOrString.slice(0, -howManyToDrop) : | ||
listOrString.slice() | ||
} |
@@ -1,5 +0,5 @@ | ||
import {_isArray} from './_internals/_isArray' | ||
import { _isArray } from './_internals/_isArray.js' | ||
export function dropLastWhile(predicate, iterable) { | ||
if (arguments.length === 1) { | ||
export function dropLastWhile(predicate, iterable){ | ||
if (arguments.length === 1){ | ||
return _iterable => dropLastWhile(predicate, _iterable) | ||
@@ -10,7 +10,7 @@ } | ||
if (typeof predicate !== 'function') { | ||
throw new Error(`'predicate' is from wrong type ${typeof predicate}`) | ||
if (typeof predicate !== 'function'){ | ||
throw new Error(`'predicate' is from wrong type ${ typeof predicate }`) | ||
} | ||
if (!isArray && typeof iterable !== 'string') { | ||
throw new Error(`'iterable' is from wrong type ${typeof iterable}`) | ||
if (!isArray && typeof iterable !== 'string'){ | ||
throw new Error(`'iterable' is from wrong type ${ typeof iterable }`) | ||
} | ||
@@ -22,9 +22,9 @@ | ||
while (counter > 0) { | ||
while (counter > 0){ | ||
counter-- | ||
if (!found && predicate(iterable[counter]) === false) { | ||
if (!found && predicate(iterable[ counter ]) === false){ | ||
found = true | ||
toReturn.push(iterable[counter]) | ||
} else if (found) { | ||
toReturn.push(iterable[counter]) | ||
toReturn.push(iterable[ counter ]) | ||
} else if (found){ | ||
toReturn.push(iterable[ counter ]) | ||
} | ||
@@ -31,0 +31,0 @@ } |
@@ -1,7 +0,7 @@ | ||
import {_isArray} from './_internals/_isArray' | ||
import {equals} from './equals' | ||
import { _isArray } from './_internals/_isArray.js' | ||
import { equals } from './equals.js' | ||
export function dropRepeats(list) { | ||
if (!_isArray(list)) { | ||
throw new Error(`${list} is not a list`) | ||
export function dropRepeats(list){ | ||
if (!_isArray(list)){ | ||
throw new Error(`${ list } is not a list`) | ||
} | ||
@@ -12,3 +12,3 @@ | ||
list.reduce((prev, current) => { | ||
if (!equals(prev, current)) { | ||
if (!equals(prev, current)){ | ||
toReturn.push(current) | ||
@@ -15,0 +15,0 @@ } |
@@ -1,10 +0,10 @@ | ||
import {_isArray} from './_internals/_isArray' | ||
import { _isArray } from './_internals/_isArray.js' | ||
export function dropRepeatsWith(predicate, list) { | ||
if (arguments.length === 1) { | ||
export function dropRepeatsWith(predicate, list){ | ||
if (arguments.length === 1){ | ||
return _iterable => dropRepeatsWith(predicate, _iterable) | ||
} | ||
if (!_isArray(list)) { | ||
throw new Error(`${list} is not a list`) | ||
if (!_isArray(list)){ | ||
throw new Error(`${ list } is not a list`) | ||
} | ||
@@ -15,3 +15,3 @@ | ||
list.reduce((prev, current) => { | ||
if (prev === undefined) { | ||
if (prev === undefined){ | ||
toReturn.push(current) | ||
@@ -21,3 +21,3 @@ | ||
} | ||
if (!predicate(prev, current)) { | ||
if (!predicate(prev, current)){ | ||
toReturn.push(current) | ||
@@ -24,0 +24,0 @@ } |
@@ -1,9 +0,9 @@ | ||
import {_isArray} from '../src/_internals/_isArray' | ||
import { _isArray } from '../src/_internals/_isArray.js' | ||
export function dropWhile(predicate, iterable) { | ||
if (arguments.length === 1) { | ||
export function dropWhile(predicate, iterable){ | ||
if (arguments.length === 1){ | ||
return _iterable => dropWhile(predicate, _iterable) | ||
} | ||
const isArray = _isArray(iterable) | ||
if (!isArray && typeof iterable !== 'string') { | ||
if (!isArray && typeof iterable !== 'string'){ | ||
throw new Error('`iterable` is neither list nor a string') | ||
@@ -15,9 +15,9 @@ } | ||
while (counter++ < iterable.length - 1) { | ||
if (flag) { | ||
holder.push(iterable[counter]) | ||
} else if (!predicate(iterable[counter])) { | ||
while (counter++ < iterable.length - 1){ | ||
if (flag){ | ||
holder.push(iterable[ counter ]) | ||
} else if (!predicate(iterable[ counter ])){ | ||
if (!flag) flag = true | ||
holder.push(iterable[counter]) | ||
holder.push(iterable[ counter ]) | ||
} | ||
@@ -24,0 +24,0 @@ } |
@@ -1,3 +0,3 @@ | ||
export function either(firstPredicate, secondPredicate) { | ||
if (arguments.length === 1) { | ||
export function either(firstPredicate, secondPredicate){ | ||
if (arguments.length === 1){ | ||
return _secondPredicate => either(firstPredicate, _secondPredicate) | ||
@@ -4,0 +4,0 @@ } |
@@ -1,8 +0,8 @@ | ||
import {equals} from './equals.js' | ||
import {_isArray} from './_internals/_isArray.js' | ||
import { _isArray } from './_internals/_isArray.js' | ||
import { equals } from './equals.js' | ||
export function endsWith(target, iterable) { | ||
export function endsWith(target, iterable){ | ||
if (arguments.length === 1) return _iterable => endsWith(target, _iterable) | ||
if (typeof iterable === 'string') { | ||
if (typeof iterable === 'string'){ | ||
return iterable.endsWith(target) | ||
@@ -16,4 +16,5 @@ } | ||
if (!correct) return false | ||
const result = equals(x, iterable[index + diff]) | ||
const result = equals(x, iterable[ index + diff ]) | ||
if (!result) correct = false | ||
return result | ||
@@ -20,0 +21,0 @@ }) |
@@ -1,6 +0,8 @@ | ||
import {curry} from './curry' | ||
import {equals} from './equals' | ||
import {prop} from './prop' | ||
import { curry } from './curry.js' | ||
import { equals } from './equals.js' | ||
import { prop } from './prop.js' | ||
function eqPropsFn(property, objA, objB) { | ||
function eqPropsFn( | ||
property, objA, objB | ||
){ | ||
return equals(prop(property, objA), prop(property, objB)) | ||
@@ -7,0 +9,0 @@ } |
@@ -1,18 +0,18 @@ | ||
import {type} from './type' | ||
import {_isArray} from './_internals/_isArray' | ||
import { _isArray } from './_internals/_isArray.js' | ||
import { type } from './type.js' | ||
export function _lastIndexOf(valueToFind, list) { | ||
if (!_isArray(list)) { | ||
throw new Error(`Cannot read property 'indexOf' of ${list}`) | ||
export function _lastIndexOf(valueToFind, list){ | ||
if (!_isArray(list)){ | ||
throw new Error(`Cannot read property 'indexOf' of ${ list }`) | ||
} | ||
const typeOfValue = type(valueToFind) | ||
if (!['Object', 'Array', 'NaN', 'RegExp'].includes(typeOfValue)) | ||
if (![ 'Object', 'Array', 'NaN', 'RegExp' ].includes(typeOfValue)) | ||
return list.lastIndexOf(valueToFind) | ||
const {length} = list | ||
const { length } = list | ||
let index = length | ||
let foundIndex = -1 | ||
while (--index > -1 && foundIndex === -1) { | ||
if (equals(list[index], valueToFind)) { | ||
while (--index > -1 && foundIndex === -1){ | ||
if (equals(list[ index ], valueToFind)){ | ||
foundIndex = index | ||
@@ -25,8 +25,8 @@ } | ||
export function _indexOf(valueToFind, list) { | ||
if (!_isArray(list)) { | ||
throw new Error(`Cannot read property 'indexOf' of ${list}`) | ||
export function _indexOf(valueToFind, list){ | ||
if (!_isArray(list)){ | ||
throw new Error(`Cannot read property 'indexOf' of ${ list }`) | ||
} | ||
const typeOfValue = type(valueToFind) | ||
if (!['Object', 'Array', 'NaN', 'RegExp'].includes(typeOfValue)) | ||
if (![ 'Object', 'Array', 'NaN', 'RegExp' ].includes(typeOfValue)) | ||
return list.indexOf(valueToFind) | ||
@@ -36,6 +36,6 @@ | ||
let foundIndex = -1 | ||
const {length} = list | ||
const { length } = list | ||
while (++index < length && foundIndex === -1) { | ||
if (equals(list[index], valueToFind)) { | ||
while (++index < length && foundIndex === -1){ | ||
if (equals(list[ index ], valueToFind)){ | ||
foundIndex = index | ||
@@ -48,13 +48,14 @@ } | ||
function _arrayFromIterator(iter) { | ||
function _arrayFromIterator(iter){ | ||
const list = [] | ||
let next | ||
while (!(next = iter.next()).done) { | ||
while (!(next = iter.next()).done){ | ||
list.push(next.value) | ||
} | ||
return list | ||
} | ||
function _equalsSets(a, b) { | ||
if (a.size !== b.size) { | ||
function _equalsSets(a, b){ | ||
if (a.size !== b.size){ | ||
return false | ||
@@ -65,29 +66,28 @@ } | ||
const filtered = aList.filter( | ||
aInstance => _indexOf(aInstance, bList) === -1 | ||
) | ||
const filtered = aList.filter(aInstance => _indexOf(aInstance, bList) === -1) | ||
return filtered.length === 0 | ||
} | ||
function parseError(maybeError) { | ||
function parseError(maybeError){ | ||
const typeofError = maybeError.__proto__.toString() | ||
if (!['Error', 'TypeError'].includes(typeofError)) return [] | ||
if (![ 'Error', 'TypeError' ].includes(typeofError)) return [] | ||
return [typeofError, maybeError.message] | ||
return [ typeofError, maybeError.message ] | ||
} | ||
function parseDate(maybeDate) { | ||
if (!maybeDate.toDateString) return [false] | ||
function parseDate(maybeDate){ | ||
if (!maybeDate.toDateString) return [ false ] | ||
return [true, maybeDate.getTime()] | ||
return [ true, maybeDate.getTime() ] | ||
} | ||
function parseRegex(maybeRegex) { | ||
if (maybeRegex.constructor !== RegExp) return [false] | ||
function parseRegex(maybeRegex){ | ||
if (maybeRegex.constructor !== RegExp) return [ false ] | ||
return [true, maybeRegex.toString()] | ||
return [ true, maybeRegex.toString() ] | ||
} | ||
function equalsSets(a, b) { | ||
if (a.size !== b.size) { | ||
function equalsSets(a, b){ | ||
if (a.size !== b.size){ | ||
return false | ||
@@ -98,9 +98,8 @@ } | ||
const filtered = aList.filter( | ||
aInstance => _indexOf(aInstance, bList) === -1 | ||
) | ||
const filtered = aList.filter(aInstance => _indexOf(aInstance, bList) === -1) | ||
return filtered.length === 0 | ||
} | ||
export function equals(a, b) { | ||
export function equals(a, b){ | ||
if (arguments.length === 1) return _b => equals(a, _b) | ||
@@ -111,9 +110,9 @@ | ||
if (aType !== type(b)) return false | ||
if (aType === 'Function') { | ||
if (aType === 'Function'){ | ||
return a.name === undefined ? false : a.name === b.name | ||
} | ||
if (['NaN', 'Undefined', 'Null'].includes(aType)) return true | ||
if ([ 'NaN', 'Undefined', 'Null' ].includes(aType)) return true | ||
if (aType === 'Number') { | ||
if (aType === 'Number'){ | ||
if (Object.is(-0, a) !== Object.is(-0, b)) return false | ||
@@ -124,11 +123,11 @@ | ||
if (['String', 'Boolean'].includes(aType)) { | ||
if ([ 'String', 'Boolean' ].includes(aType)){ | ||
return a.toString() === b.toString() | ||
} | ||
if (aType === 'Array') { | ||
if (aType === 'Array'){ | ||
const aClone = Array.from(a) | ||
const bClone = Array.from(b) | ||
if (aClone.toString() !== bClone.toString()) { | ||
if (aClone.toString() !== bClone.toString()){ | ||
return false | ||
@@ -139,7 +138,7 @@ } | ||
aClone.forEach((aCloneInstance, aCloneIndex) => { | ||
if (loopArrayFlag) { | ||
if (loopArrayFlag){ | ||
if ( | ||
aCloneInstance !== bClone[aCloneIndex] && | ||
!equals(aCloneInstance, bClone[aCloneIndex]) | ||
) { | ||
aCloneInstance !== bClone[ aCloneIndex ] && | ||
!equals(aCloneInstance, bClone[ aCloneIndex ]) | ||
){ | ||
loopArrayFlag = false | ||
@@ -156,5 +155,5 @@ } | ||
if (aRegex[0]) { | ||
return bRegex[0] ? aRegex[1] === bRegex[1] : false | ||
} else if (bRegex[0]) return false | ||
if (aRegex[ 0 ]){ | ||
return bRegex[ 0 ] ? aRegex[ 1 ] === bRegex[ 1 ] : false | ||
} else if (bRegex[ 0 ]) return false | ||
@@ -164,5 +163,5 @@ const aDate = parseDate(a) | ||
if (aDate[0]) { | ||
return bDate[0] ? aDate[1] === bDate[1] : false | ||
} else if (bDate[0]) return false | ||
if (aDate[ 0 ]){ | ||
return bDate[ 0 ] ? aDate[ 1 ] === bDate[ 1 ] : false | ||
} else if (bDate[ 0 ]) return false | ||
@@ -172,14 +171,14 @@ const aError = parseError(a) | ||
if (aError[0]) { | ||
return bError[0] | ||
? aError[0] === bError[0] && aError[1] === bError[1] | ||
: false | ||
if (aError[ 0 ]){ | ||
return bError[ 0 ] ? | ||
aError[ 0 ] === bError[ 0 ] && aError[ 1 ] === bError[ 1 ] : | ||
false | ||
} | ||
if (aType === 'Set') { | ||
if (aType === 'Set'){ | ||
return _equalsSets(a, b) | ||
} | ||
if (aType === 'Object') { | ||
if (aType === 'Object'){ | ||
const aKeys = Object.keys(a) | ||
if (aKeys.length !== Object.keys(b).length) { | ||
if (aKeys.length !== Object.keys(b).length){ | ||
return false | ||
@@ -190,7 +189,7 @@ } | ||
aKeys.forEach(aKeyInstance => { | ||
if (loopObjectFlag) { | ||
const aValue = a[aKeyInstance] | ||
const bValue = b[aKeyInstance] | ||
if (loopObjectFlag){ | ||
const aValue = a[ aKeyInstance ] | ||
const bValue = b[ aKeyInstance ] | ||
if (aValue !== bValue && !equals(aValue, bValue)) { | ||
if (aValue !== bValue && !equals(aValue, bValue)){ | ||
loopObjectFlag = false | ||
@@ -197,0 +196,0 @@ } |
@@ -1,10 +0,10 @@ | ||
import {_isArray} from './_internals/_isArray' | ||
import {mapArray, mapObject} from './map' | ||
import {type} from './type' | ||
import { _isArray } from './_internals/_isArray.js' | ||
import { mapArray, mapObject } from './map.js' | ||
import { type } from './type.js' | ||
export function evolveArray(rules, list) { | ||
export function evolveArray(rules, list){ | ||
return mapArray( | ||
(x, i) => { | ||
if (type(rules[i]) === 'Function') { | ||
return rules[i](x) | ||
if (type(rules[ i ]) === 'Function'){ | ||
return rules[ i ](x) | ||
} | ||
@@ -19,11 +19,11 @@ | ||
export function evolveObject(rules, iterable) { | ||
export function evolveObject(rules, iterable){ | ||
return mapObject((x, prop) => { | ||
if (type(x) === 'Object') { | ||
const typeRule = type(rules[prop]) | ||
if (typeRule === 'Function') { | ||
return rules[prop](x) | ||
if (type(x) === 'Object'){ | ||
const typeRule = type(rules[ prop ]) | ||
if (typeRule === 'Function'){ | ||
return rules[ prop ](x) | ||
} | ||
if (typeRule === 'Object') { | ||
return evolve(rules[prop], x) | ||
if (typeRule === 'Object'){ | ||
return evolve(rules[ prop ], x) | ||
} | ||
@@ -33,4 +33,4 @@ | ||
} | ||
if (type(rules[prop]) === 'Function') { | ||
return rules[prop](x) | ||
if (type(rules[ prop ]) === 'Function'){ | ||
return rules[ prop ](x) | ||
} | ||
@@ -42,4 +42,4 @@ | ||
export function evolve(rules, iterable) { | ||
if (arguments.length === 1) { | ||
export function evolve(rules, iterable){ | ||
if (arguments.length === 1){ | ||
return _iterable => evolve(rules, _iterable) | ||
@@ -50,13 +50,11 @@ } | ||
if (iterableType !== rulesType) { | ||
if (iterableType !== rulesType){ | ||
throw new Error('iterableType !== rulesType') | ||
} | ||
if (!['Object', 'Array'].includes(rulesType)) { | ||
throw new Error( | ||
`'iterable' and 'rules' are from wrong type ${rulesType}` | ||
) | ||
if (![ 'Object', 'Array' ].includes(rulesType)){ | ||
throw new Error(`'iterable' and 'rules' are from wrong type ${ rulesType }`) | ||
} | ||
if (iterableType === 'Object') { | ||
if (iterableType === 'Object'){ | ||
return evolveObject(rules, iterable) | ||
@@ -63,0 +61,0 @@ } |
@@ -1,3 +0,3 @@ | ||
export function F() { | ||
export function F(){ | ||
return false | ||
} |
@@ -1,9 +0,11 @@ | ||
import {_isArray} from './_internals/_isArray' | ||
import { _isArray } from './_internals/_isArray.js' | ||
export function filterObject(predicate, obj) { | ||
export function filterObject(predicate, obj){ | ||
const willReturn = {} | ||
for (const prop in obj) { | ||
if (predicate(obj[prop], prop, obj)) { | ||
willReturn[prop] = obj[prop] | ||
for (const prop in obj){ | ||
if (predicate( | ||
obj[ prop ], prop, obj | ||
)){ | ||
willReturn[ prop ] = obj[ prop ] | ||
} | ||
@@ -15,3 +17,5 @@ } | ||
export function filterArray(predicate, list, indexed = false) { | ||
export function filterArray( | ||
predicate, list, indexed = false | ||
){ | ||
let index = 0 | ||
@@ -21,8 +25,8 @@ const len = list.length | ||
while (index < len) { | ||
const predicateResult = indexed | ||
? predicate(list[index], index) | ||
: predicate(list[index]) | ||
if (predicateResult) { | ||
willReturn.push(list[index]) | ||
while (index < len){ | ||
const predicateResult = indexed ? | ||
predicate(list[ index ], index) : | ||
predicate(list[ index ]) | ||
if (predicateResult){ | ||
willReturn.push(list[ index ]) | ||
} | ||
@@ -36,12 +40,14 @@ | ||
export function filter(predicate, iterable) { | ||
export function filter(predicate, iterable){ | ||
if (arguments.length === 1) | ||
return _iterable => filter(predicate, _iterable) | ||
if (!iterable) { | ||
if (!iterable){ | ||
throw new Error('Incorrect iterable input') | ||
} | ||
if (_isArray(iterable)) return filterArray(predicate, iterable, false) | ||
if (_isArray(iterable)) return filterArray( | ||
predicate, iterable, false | ||
) | ||
return filterObject(predicate, iterable) | ||
} |
@@ -1,2 +0,2 @@ | ||
export function find(predicate, list) { | ||
export function find(predicate, list){ | ||
if (arguments.length === 1) return _list => find(predicate, _list) | ||
@@ -7,5 +7,5 @@ | ||
while (index < len) { | ||
const x = list[index] | ||
if (predicate(x)) { | ||
while (index < len){ | ||
const x = list[ index ] | ||
if (predicate(x)){ | ||
return x | ||
@@ -12,0 +12,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export function findIndex(predicate, list) { | ||
export function findIndex(predicate, list){ | ||
if (arguments.length === 1) return _list => findIndex(predicate, _list) | ||
@@ -7,4 +7,4 @@ | ||
while (++index < len) { | ||
if (predicate(list[index])) { | ||
while (++index < len){ | ||
if (predicate(list[ index ])){ | ||
return index | ||
@@ -11,0 +11,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export function findLast(predicate, list) { | ||
export function findLast(predicate, list){ | ||
if (arguments.length === 1) return _list => findLast(predicate, _list) | ||
@@ -6,5 +6,5 @@ | ||
while (--index >= 0) { | ||
if (predicate(list[index])) { | ||
return list[index] | ||
while (--index >= 0){ | ||
if (predicate(list[ index ])){ | ||
return list[ index ] | ||
} | ||
@@ -11,0 +11,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export function findLastIndex(fn, list) { | ||
export function findLastIndex(fn, list){ | ||
if (arguments.length === 1) return _list => findLastIndex(fn, _list) | ||
@@ -6,4 +6,4 @@ | ||
while (--index >= 0) { | ||
if (fn(list[index])) { | ||
while (--index >= 0){ | ||
if (fn(list[ index ])){ | ||
return index | ||
@@ -10,0 +10,0 @@ } |
@@ -1,11 +0,11 @@ | ||
import {_isArray} from './_internals/_isArray' | ||
import { _isArray } from './_internals/_isArray.js' | ||
export function flatten(list, input) { | ||
export function flatten(list, input){ | ||
const willReturn = input === undefined ? [] : input | ||
for (let i = 0; i < list.length; i++) { | ||
if (_isArray(list[i])) { | ||
flatten(list[i], willReturn) | ||
for (let i = 0; i < list.length; i++){ | ||
if (_isArray(list[ i ])){ | ||
flatten(list[ i ], willReturn) | ||
} else { | ||
willReturn.push(list[i]) | ||
willReturn.push(list[ i ]) | ||
} | ||
@@ -12,0 +12,0 @@ } |
@@ -1,19 +0,23 @@ | ||
function flipFn(fn) { | ||
function flipFn(fn){ | ||
return (...input) => { | ||
if (input.length === 1) { | ||
return holder => fn(holder, input[0]) | ||
} else if (input.length === 2) { | ||
return fn(input[1], input[0]) | ||
} else if (input.length === 3) { | ||
return fn(input[1], input[0], input[2]) | ||
} else if (input.length === 4) { | ||
return fn(input[1], input[0], input[2], input[3]) | ||
if (input.length === 1){ | ||
return holder => fn(holder, input[ 0 ]) | ||
} else if (input.length === 2){ | ||
return fn(input[ 1 ], input[ 0 ]) | ||
} else if (input.length === 3){ | ||
return fn( | ||
input[ 1 ], input[ 0 ], input[ 2 ] | ||
) | ||
} else if (input.length === 4){ | ||
return fn( | ||
input[ 1 ], input[ 0 ], input[ 2 ], input[ 3 ] | ||
) | ||
} | ||
throw new Error("R.flip doesn't work with arity > 4") | ||
throw new Error('R.flip doesn\'t work with arity > 4') | ||
} | ||
} | ||
export function flip(fn) { | ||
export function flip(fn){ | ||
return flipFn(fn) | ||
} |
@@ -1,17 +0,17 @@ | ||
import {_isArray} from './_internals/_isArray' | ||
import {_keys} from './_internals/_keys' | ||
import { _isArray } from './_internals/_isArray.js' | ||
import { _keys } from './_internals/_keys.js' | ||
export function forEach(fn, list) { | ||
export function forEach(fn, list){ | ||
if (arguments.length === 1) return _list => forEach(fn, _list) | ||
if (list === undefined) { | ||
if (list === undefined){ | ||
return | ||
} | ||
if (_isArray(list)) { | ||
if (_isArray(list)){ | ||
let index = 0 | ||
const len = list.length | ||
while (index < len) { | ||
fn(list[index]) | ||
while (index < len){ | ||
fn(list[ index ]) | ||
index++ | ||
@@ -24,5 +24,7 @@ } | ||
while (index < len) { | ||
const key = keys[index] | ||
fn(list[key], key, list) | ||
while (index < len){ | ||
const key = keys[ index ] | ||
fn( | ||
list[ key ], key, list | ||
) | ||
index++ | ||
@@ -29,0 +31,0 @@ } |
@@ -1,6 +0,6 @@ | ||
export function fromPairs(listOfPairs) { | ||
export function fromPairs(listOfPairs){ | ||
const toReturn = {} | ||
listOfPairs.forEach(([prop, value]) => (toReturn[prop] = value)) | ||
listOfPairs.forEach(([ prop, value ]) => toReturn[ prop ] = value) | ||
return toReturn | ||
} |
@@ -1,14 +0,14 @@ | ||
export function groupBy(groupFn, list) { | ||
export function groupBy(groupFn, list){ | ||
if (arguments.length === 1) return _list => groupBy(groupFn, _list) | ||
const result = {} | ||
for (let i = 0; i < list.length; i++) { | ||
const item = list[i] | ||
for (let i = 0; i < list.length; i++){ | ||
const item = list[ i ] | ||
const key = groupFn(item) | ||
if (!result[key]) { | ||
result[key] = [] | ||
if (!result[ key ]){ | ||
result[ key ] = [] | ||
} | ||
result[key].push(item) | ||
result[ key ].push(item) | ||
} | ||
@@ -15,0 +15,0 @@ |
@@ -1,5 +0,5 @@ | ||
import {_isArray} from './_internals/_isArray' | ||
import {cloneList} from './_internals/cloneList' | ||
import { _isArray } from './_internals/_isArray.js' | ||
import { cloneList } from './_internals/cloneList.js' | ||
export function groupWith(compareFn, list) { | ||
export function groupWith(compareFn, list){ | ||
if (!_isArray(list)) throw new TypeError('list.reduce is not a function') | ||
@@ -9,3 +9,3 @@ | ||
if (list.length === 1) return [clone] | ||
if (list.length === 1) return [ clone ] | ||
@@ -15,3 +15,5 @@ const toReturn = [] | ||
clone.reduce((prev, current, i) => { | ||
clone.reduce(( | ||
prev, current, i | ||
) => { | ||
if (i === 0) return current | ||
@@ -23,3 +25,3 @@ | ||
if (okCompare) { | ||
if (okCompare){ | ||
if (holderIsEmpty) holder.push(prev) | ||
@@ -32,5 +34,5 @@ holder.push(current) | ||
if (holderIsEmpty) { | ||
toReturn.push([prev]) | ||
if (lastCall) toReturn.push([current]) | ||
if (holderIsEmpty){ | ||
toReturn.push([ prev ]) | ||
if (lastCall) toReturn.push([ current ]) | ||
@@ -41,3 +43,3 @@ return current | ||
toReturn.push(holder) | ||
if (lastCall) toReturn.push([current]) | ||
if (lastCall) toReturn.push([ current ]) | ||
holder = [] | ||
@@ -44,0 +46,0 @@ |
@@ -1,2 +0,2 @@ | ||
export function has(prop, obj) { | ||
export function has(prop, obj){ | ||
if (arguments.length === 1) return _obj => has(prop, _obj) | ||
@@ -3,0 +3,0 @@ |
@@ -1,5 +0,5 @@ | ||
import {path} from './path' | ||
import { path } from './path.js' | ||
export function hasPath(pathInput, obj) { | ||
if (arguments.length === 1) { | ||
export function hasPath(pathInput, obj){ | ||
if (arguments.length === 1){ | ||
return objHolder => hasPath(pathInput, objHolder) | ||
@@ -6,0 +6,0 @@ } |
@@ -1,5 +0,5 @@ | ||
export function head(listOrString) { | ||
if (typeof listOrString === 'string') return listOrString[0] || '' | ||
export function head(listOrString){ | ||
if (typeof listOrString === 'string') return listOrString[ 0 ] || '' | ||
return listOrString[0] | ||
return listOrString[ 0 ] | ||
} |
@@ -1,4 +0,4 @@ | ||
import _objectIs from './_internals/_objectIs' | ||
import _objectIs from './_internals/_objectIs.js' | ||
export function identical(a, b) { | ||
export function identical(a, b){ | ||
if (arguments.length === 1) return _b => identical(a, _b) | ||
@@ -5,0 +5,0 @@ |
@@ -1,3 +0,3 @@ | ||
export function identity(x) { | ||
export function identity(x){ | ||
return x | ||
} |
@@ -1,4 +0,6 @@ | ||
import {curry} from './curry' | ||
import { curry } from './curry.js' | ||
function ifElseFn(condition, onTrue, onFalse) { | ||
function ifElseFn( | ||
condition, onTrue, onFalse | ||
){ | ||
return (...input) => { | ||
@@ -8,3 +10,3 @@ const conditionResult = | ||
if (conditionResult === true) { | ||
if (conditionResult === true){ | ||
return onTrue(...input) | ||
@@ -11,0 +13,0 @@ } |
@@ -1,12 +0,12 @@ | ||
import {_isArray} from './_internals/_isArray' | ||
import {_indexOf} from './equals' | ||
import { _isArray } from './_internals/_isArray.js' | ||
import { _indexOf } from './equals.js' | ||
export function includes(valueToFind, iterable) { | ||
export function includes(valueToFind, iterable){ | ||
if (arguments.length === 1) | ||
return _iterable => includes(valueToFind, _iterable) | ||
if (typeof iterable === 'string') { | ||
if (typeof iterable === 'string'){ | ||
return iterable.includes(valueToFind) | ||
} | ||
if (!iterable) { | ||
throw new TypeError(`Cannot read property \'indexOf\' of ${iterable}`) | ||
if (!iterable){ | ||
throw new TypeError(`Cannot read property \'indexOf\' of ${ iterable }`) | ||
} | ||
@@ -13,0 +13,0 @@ if (!_isArray(iterable)) return false |
@@ -1,8 +0,8 @@ | ||
import {path} from './path' | ||
import { path } from './path.js' | ||
function indexByPath(pathInput, list) { | ||
function indexByPath(pathInput, list){ | ||
const toReturn = {} | ||
for (let i = 0; i < list.length; i++) { | ||
const item = list[i] | ||
toReturn[path(pathInput, item)] = item | ||
for (let i = 0; i < list.length; i++){ | ||
const item = list[ i ] | ||
toReturn[ path(pathInput, item) ] = item | ||
} | ||
@@ -13,8 +13,8 @@ | ||
export function indexBy(condition, list) { | ||
if (arguments.length === 1) { | ||
export function indexBy(condition, list){ | ||
if (arguments.length === 1){ | ||
return _list => indexBy(condition, _list) | ||
} | ||
if (typeof condition === 'string') { | ||
if (typeof condition === 'string'){ | ||
return indexByPath(condition, list) | ||
@@ -24,5 +24,5 @@ } | ||
const toReturn = {} | ||
for (let i = 0; i < list.length; i++) { | ||
const item = list[i] | ||
toReturn[condition(item)] = item | ||
for (let i = 0; i < list.length; i++){ | ||
const item = list[ i ] | ||
toReturn[ condition(item) ] = item | ||
} | ||
@@ -29,0 +29,0 @@ |
@@ -1,5 +0,5 @@ | ||
import {_indexOf} from './equals' | ||
import { _indexOf } from './equals.js' | ||
export function indexOf(valueToFind, list) { | ||
if (arguments.length === 1) { | ||
export function indexOf(valueToFind, list){ | ||
if (arguments.length === 1){ | ||
return _list => _indexOf(valueToFind, _list) | ||
@@ -6,0 +6,0 @@ } |
@@ -1,7 +0,11 @@ | ||
import baseSlice from './_internals/baseSlice' | ||
import baseSlice from './_internals/baseSlice.js' | ||
export function init(listOrString) { | ||
export function init(listOrString){ | ||
if (typeof listOrString === 'string') return listOrString.slice(0, -1) | ||
return listOrString.length ? baseSlice(listOrString, 0, -1) : [] | ||
return listOrString.length ? | ||
baseSlice( | ||
listOrString, 0, -1 | ||
) : | ||
[] | ||
} |
@@ -1,5 +0,5 @@ | ||
import {filter} from './filter' | ||
import {includes} from './includes' | ||
import { filter } from './filter.js' | ||
import { includes } from './includes.js' | ||
export function intersection(listA, listB) { | ||
export function intersection(listA, listB){ | ||
if (arguments.length === 1) return _list => intersection(listA, _list) | ||
@@ -6,0 +6,0 @@ |
@@ -1,2 +0,2 @@ | ||
export function intersperse(separator, list) { | ||
export function intersperse(separator, list){ | ||
if (arguments.length === 1) return _list => intersperse(separator, _list) | ||
@@ -8,7 +8,7 @@ | ||
while (++index < len) { | ||
if (index === len - 1) { | ||
willReturn.push(list[index]) | ||
while (++index < len){ | ||
if (index === len - 1){ | ||
willReturn.push(list[ index ]) | ||
} else { | ||
willReturn.push(list[index], separator) | ||
willReturn.push(list[ index ], separator) | ||
} | ||
@@ -15,0 +15,0 @@ } |
@@ -1,8 +0,8 @@ | ||
export function is(targetPrototype, x) { | ||
export function is(targetPrototype, x){ | ||
if (arguments.length === 1) return _x => is(targetPrototype, _x) | ||
return ( | ||
(x != null && x.constructor === targetPrototype) || | ||
x != null && x.constructor === targetPrototype || | ||
x instanceof targetPrototype | ||
) | ||
} |
@@ -1,14 +0,14 @@ | ||
import {type} from './type' | ||
import { type } from './type.js' | ||
export function isEmpty(input) { | ||
export function isEmpty(input){ | ||
const inputType = type(input) | ||
if (['Undefined', 'NaN', 'Number', 'Null'].includes(inputType)) | ||
if ([ 'Undefined', 'NaN', 'Number', 'Null' ].includes(inputType)) | ||
return false | ||
if (!input) return true | ||
if (inputType === 'Object') { | ||
if (inputType === 'Object'){ | ||
return Object.keys(input).length === 0 | ||
} | ||
if (inputType === 'Array') { | ||
if (inputType === 'Array'){ | ||
return input.length === 0 | ||
@@ -15,0 +15,0 @@ } |
@@ -1,3 +0,3 @@ | ||
export function isNil(x) { | ||
export function isNil(x){ | ||
return x === undefined || x === null | ||
} |
@@ -1,5 +0,5 @@ | ||
import {type} from './type' | ||
import { type } from './type.js' | ||
export function isPromise(x) { | ||
return ['Async', 'Promise'].includes(type(x)) | ||
export function isPromise(x){ | ||
return [ 'Async', 'Promise' ].includes(type(x)) | ||
} |
@@ -1,2 +0,2 @@ | ||
export function join(glue, list) { | ||
export function join(glue, list){ | ||
if (arguments.length === 1) return _list => join(glue, _list) | ||
@@ -3,0 +3,0 @@ |
@@ -1,3 +0,3 @@ | ||
export function keys(x) { | ||
export function keys(x){ | ||
return Object.keys(x) | ||
} |
@@ -1,7 +0,7 @@ | ||
export function last(listOrString) { | ||
if (typeof listOrString === 'string') { | ||
return listOrString[listOrString.length - 1] || '' | ||
export function last(listOrString){ | ||
if (typeof listOrString === 'string'){ | ||
return listOrString[ listOrString.length - 1 ] || '' | ||
} | ||
return listOrString[listOrString.length - 1] | ||
return listOrString[ listOrString.length - 1 ] | ||
} |
@@ -1,5 +0,5 @@ | ||
import {_lastIndexOf} from './equals' | ||
import { _lastIndexOf } from './equals.js' | ||
export function lastIndexOf(valueToFind, list) { | ||
if (arguments.length === 1) { | ||
export function lastIndexOf(valueToFind, list){ | ||
if (arguments.length === 1){ | ||
return _list => _lastIndexOf(valueToFind, _list) | ||
@@ -6,0 +6,0 @@ } |
@@ -1,4 +0,4 @@ | ||
import {_isArray} from './_internals/_isArray' | ||
import { _isArray } from './_internals/_isArray.js' | ||
export function length(x) { | ||
export function length(x){ | ||
if (_isArray(x)) return x.length | ||
@@ -5,0 +5,0 @@ if (typeof x === 'string') return x.length |
@@ -1,4 +0,4 @@ | ||
export function lens(getter, setter) { | ||
return function (functor) { | ||
return function (target) { | ||
export function lens(getter, setter){ | ||
return function (functor){ | ||
return function (target){ | ||
return functor(getter(target)).map(focus => setter(focus, target)) | ||
@@ -5,0 +5,0 @@ } |
@@ -1,7 +0,7 @@ | ||
import {lens} from './lens' | ||
import {nth} from './nth' | ||
import {update} from './update' | ||
import { lens } from './lens.js' | ||
import { nth } from './nth.js' | ||
import { update } from './update.js' | ||
export function lensIndex(index) { | ||
export function lensIndex(index){ | ||
return lens(nth(index), update(index)) | ||
} |
@@ -1,7 +0,7 @@ | ||
import {assocPath} from './assocPath' | ||
import {lens} from './lens' | ||
import {path} from './path' | ||
import { assocPath } from './assocPath.js' | ||
import { lens } from './lens.js' | ||
import { path } from './path.js' | ||
export function lensPath(key) { | ||
export function lensPath(key){ | ||
return lens(path(key), assocPath(key)) | ||
} |
@@ -1,7 +0,7 @@ | ||
import {assoc} from './assoc' | ||
import {lens} from './lens' | ||
import {prop} from './prop' | ||
import { assoc } from './assoc.js' | ||
import { lens } from './lens.js' | ||
import { prop } from './prop.js' | ||
export function lensProp(key) { | ||
export function lensProp(key){ | ||
return lens(prop(key), assoc(key)) | ||
} |
@@ -1,10 +0,12 @@ | ||
import {_isArray} from './_internals/_isArray' | ||
import {_keys} from './_internals/_keys' | ||
import { _isArray } from './_internals/_isArray.js' | ||
import { _keys } from './_internals/_keys.js' | ||
export function mapArray(fn, list, isIndexed = false) { | ||
export function mapArray( | ||
fn, list, isIndexed = false | ||
){ | ||
let index = 0 | ||
const willReturn = Array(list.length) | ||
while (index < list.length) { | ||
willReturn[index] = isIndexed ? fn(list[index], index) : fn(list[index]) | ||
while (index < list.length){ | ||
willReturn[ index ] = isIndexed ? fn(list[ index ], index) : fn(list[ index ]) | ||
@@ -17,3 +19,3 @@ index++ | ||
export function mapObject(fn, obj) { | ||
export function mapObject(fn, obj){ | ||
let index = 0 | ||
@@ -24,5 +26,7 @@ const keys = _keys(obj) | ||
while (index < len) { | ||
const key = keys[index] | ||
willReturn[key] = fn(obj[key], key, obj) | ||
while (index < len){ | ||
const key = keys[ index ] | ||
willReturn[ key ] = fn( | ||
obj[ key ], key, obj | ||
) | ||
index++ | ||
@@ -36,5 +40,5 @@ } | ||
export function map(fn, iterable) { | ||
export function map(fn, iterable){ | ||
if (arguments.length === 1) return _iterable => map(fn, _iterable) | ||
if (!iterable) { | ||
if (!iterable){ | ||
throw new Error('Incorrect iterable input') | ||
@@ -41,0 +45,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export function match(pattern, input) { | ||
export function match(pattern, input){ | ||
if (arguments.length === 1) return _input => match(pattern, _input) | ||
@@ -3,0 +3,0 @@ |
@@ -1,8 +0,8 @@ | ||
import _isInteger from './_internals/_isInteger' | ||
import _isInteger from './_internals/_isInteger.js' | ||
export function mathMod(x, y) { | ||
export function mathMod(x, y){ | ||
if (arguments.length === 1) return _y => mathMod(x, _y) | ||
if (!_isInteger(x) || !_isInteger(y) || y < 1) return NaN | ||
return ((x % y) + y) % y | ||
return (x % y + y) % y | ||
} |
@@ -1,2 +0,2 @@ | ||
export function max(x, y) { | ||
export function max(x, y){ | ||
if (arguments.length === 1) return _y => max(x, _y) | ||
@@ -3,0 +3,0 @@ |
@@ -1,4 +0,6 @@ | ||
import {curry} from './curry' | ||
import { curry } from './curry.js' | ||
export function maxByFn(compareFn, x, y) { | ||
export function maxByFn( | ||
compareFn, x, y | ||
){ | ||
return compareFn(y) > compareFn(x) ? y : x | ||
@@ -5,0 +7,0 @@ } |
@@ -1,4 +0,6 @@ | ||
import {type} from './type' | ||
import { type } from './type.js' | ||
export function maybe(ifRule, whenIf, whenElse) { | ||
export function maybe( | ||
ifRule, whenIf, whenElse | ||
){ | ||
const whenIfInput = | ||
@@ -5,0 +7,0 @@ ifRule && type(whenIf) === 'Function' ? whenIf() : whenIf |
@@ -1,5 +0,5 @@ | ||
import {sum} from './sum' | ||
import { sum } from './sum.js' | ||
export function mean(list) { | ||
export function mean(list){ | ||
return sum(list) / list.length | ||
} |
@@ -1,19 +0,17 @@ | ||
import {mean} from './mean' | ||
import { mean } from './mean.js' | ||
export function median(list) { | ||
export function median(list){ | ||
const len = list.length | ||
if (len === 0) return NaN | ||
const width = 2 - (len % 2) | ||
const width = 2 - len % 2 | ||
const idx = (len - width) / 2 | ||
return mean( | ||
Array.prototype.slice | ||
.call(list, 0) | ||
.sort((a, b) => { | ||
if (a === b) return 0 | ||
return mean(Array.prototype.slice | ||
.call(list, 0) | ||
.sort((a, b) => { | ||
if (a === b) return 0 | ||
return a < b ? -1 : 1 | ||
}) | ||
.slice(idx, idx + width) | ||
) | ||
return a < b ? -1 : 1 | ||
}) | ||
.slice(idx, idx + width)) | ||
} |
@@ -1,5 +0,1 @@ | ||
export function merge(target, newProps) { | ||
if (arguments.length === 1) return _newProps => merge(target, _newProps) | ||
return Object.assign({}, target || {}, newProps || {}) | ||
} | ||
export {mergeRight as merge} from './mergeRight' |
@@ -1,8 +0,8 @@ | ||
import {map} from './map' | ||
import {merge} from './merge' | ||
import { map } from './map.js' | ||
import { mergeRight } from './mergeRight.js' | ||
export function mergeAll(arr) { | ||
export function mergeAll(arr){ | ||
let willReturn = {} | ||
map(val => { | ||
willReturn = merge(willReturn, val) | ||
willReturn = mergeRight(willReturn, val) | ||
}, arr) | ||
@@ -9,0 +9,0 @@ |
@@ -1,5 +0,5 @@ | ||
import {type} from './type' | ||
import { type } from './type.js' | ||
export function mergeDeepRight(target, source) { | ||
if (arguments.length === 1) { | ||
export function mergeDeepRight(target, source){ | ||
if (arguments.length === 1){ | ||
return sourceHolder => mergeDeepRight(target, sourceHolder) | ||
@@ -11,10 +11,10 @@ } | ||
Object.keys(source).forEach(key => { | ||
if (type(source[key]) === 'Object') { | ||
if (type(target[key]) === 'Object') { | ||
willReturn[key] = mergeDeepRight(target[key], source[key]) | ||
if (type(source[ key ]) === 'Object'){ | ||
if (type(target[ key ]) === 'Object'){ | ||
willReturn[ key ] = mergeDeepRight(target[ key ], source[ key ]) | ||
} else { | ||
willReturn[key] = source[key] | ||
willReturn[ key ] = source[ key ] | ||
} | ||
} else { | ||
willReturn[key] = source[key] | ||
willReturn[ key ] = source[ key ] | ||
} | ||
@@ -21,0 +21,0 @@ }) |
@@ -1,7 +0,7 @@ | ||
import {merge} from './merge' | ||
import { mergeRight } from './mergeRight.js' | ||
export function mergeLeft(x, y) { | ||
export function mergeLeft(x, y){ | ||
if (arguments.length === 1) return _y => mergeLeft(x, _y) | ||
return merge(y, x) | ||
return mergeRight(y, x) | ||
} |
@@ -1,2 +0,2 @@ | ||
export function min(x, y) { | ||
export function min(x, y){ | ||
if (arguments.length === 1) return _y => min(x, _y) | ||
@@ -3,0 +3,0 @@ |
@@ -1,4 +0,6 @@ | ||
import {curry} from './curry' | ||
import { curry } from './curry.js' | ||
export function minByFn(compareFn, x, y) { | ||
export function minByFn( | ||
compareFn, x, y | ||
){ | ||
return compareFn(y) < compareFn(x) ? y : x | ||
@@ -5,0 +7,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export function modulo(x, y) { | ||
export function modulo(x, y){ | ||
if (arguments.length === 1) return _y => modulo(x, _y) | ||
@@ -3,0 +3,0 @@ |
@@ -1,6 +0,8 @@ | ||
import {curry} from './curry' | ||
import {cloneList} from './_internals/cloneList' | ||
import { cloneList } from './_internals/cloneList.js' | ||
import { curry } from './curry.js' | ||
function moveFn(fromIndex, toIndex, list) { | ||
if (fromIndex < 0 || toIndex < 0) { | ||
function moveFn( | ||
fromIndex, toIndex, list | ||
){ | ||
if (fromIndex < 0 || toIndex < 0){ | ||
throw new Error('Rambda.move does not support negative indexes') | ||
@@ -11,4 +13,4 @@ } | ||
const clone = cloneList(list) | ||
clone[fromIndex] = list[toIndex] | ||
clone[toIndex] = list[fromIndex] | ||
clone[ fromIndex ] = list[ toIndex ] | ||
clone[ toIndex ] = list[ fromIndex ] | ||
@@ -15,0 +17,0 @@ return clone |
@@ -1,2 +0,2 @@ | ||
export function multiply(x, y) { | ||
export function multiply(x, y){ | ||
if (arguments.length === 1) return _y => multiply(x, _y) | ||
@@ -3,0 +3,0 @@ |
@@ -1,3 +0,3 @@ | ||
export function negate(x) { | ||
export function negate(x){ | ||
return -x | ||
} |
@@ -1,6 +0,6 @@ | ||
export function none(predicate, list) { | ||
export function none(predicate, list){ | ||
if (arguments.length === 1) return _list => none(predicate, _list) | ||
for (let i = 0; i < list.length; i++) { | ||
if (predicate(list[i])) return false | ||
for (let i = 0; i < list.length; i++){ | ||
if (predicate(list[ i ])) return false | ||
} | ||
@@ -7,0 +7,0 @@ |
@@ -1,3 +0,3 @@ | ||
export function not(input) { | ||
export function not(input){ | ||
return !input | ||
} |
@@ -1,9 +0,9 @@ | ||
export function nth(index, list) { | ||
if (arguments.length === 1) return _list => nth(index, _list) | ||
export function nth(index, input){ | ||
if (arguments.length === 1) return _input => nth(index, _input) | ||
const idx = index < 0 ? list.length + index : index | ||
const idx = index < 0 ? input.length + index : index | ||
return Object.prototype.toString.call(list) === '[object String]' | ||
? list.charAt(idx) | ||
: list[idx] | ||
return Object.prototype.toString.call(input) === '[object String]' ? | ||
input.charAt(idx) : | ||
input[ idx ] | ||
} |
@@ -1,9 +0,7 @@ | ||
export function objOf(key, value) { | ||
if (arguments.length === 1) { | ||
export function objOf(key, value){ | ||
if (arguments.length === 1){ | ||
return _value => objOf(key, _value) | ||
} | ||
return { | ||
[key]: value, | ||
} | ||
return { [ key ] : value } | ||
} |
@@ -1,3 +0,3 @@ | ||
export function of(value) { | ||
return [value] | ||
export function of(value){ | ||
return [ value ] | ||
} |
@@ -1,16 +0,16 @@ | ||
export function omit(propsToOmit, obj) { | ||
import { createPath } from './_internals/createPath.js' | ||
export function omit(propsToOmit, obj){ | ||
if (arguments.length === 1) return _obj => omit(propsToOmit, _obj) | ||
if (obj === null || obj === undefined) { | ||
if (obj === null || obj === undefined){ | ||
return undefined | ||
} | ||
const propsToOmitValue = | ||
typeof propsToOmit === 'string' ? propsToOmit.split(',') : propsToOmit | ||
const propsToOmitValue = createPath(propsToOmit, ',') | ||
const willReturn = {} | ||
for (const key in obj) { | ||
if (!propsToOmitValue.includes(key)) { | ||
willReturn[key] = obj[key] | ||
for (const key in obj){ | ||
if (!propsToOmitValue.includes(key)){ | ||
willReturn[ key ] = obj[ key ] | ||
} | ||
@@ -17,0 +17,0 @@ } |
@@ -1,8 +0,8 @@ | ||
import {curry} from './curry' | ||
import { curry } from './curry.js' | ||
function onceFn(fn, context) { | ||
function onceFn(fn, context){ | ||
let result | ||
return function () { | ||
if (fn) { | ||
return function (){ | ||
if (fn){ | ||
result = fn.apply(context || this, arguments) | ||
@@ -16,4 +16,4 @@ fn = null | ||
export function once(fn, context) { | ||
if (arguments.length === 1) { | ||
export function once(fn, context){ | ||
if (arguments.length === 1){ | ||
const wrap = onceFn(fn, context) | ||
@@ -20,0 +20,0 @@ |
@@ -1,2 +0,2 @@ | ||
export function or(a, b) { | ||
export function or(a, b){ | ||
if (arguments.length === 1) return _b => or(a, _b) | ||
@@ -3,0 +3,0 @@ |
@@ -1,9 +0,11 @@ | ||
import {curry} from './curry' | ||
import { curry } from './curry.js' | ||
const Identity = x => ({ | ||
x, | ||
map: fn => Identity(fn(x)), | ||
map : fn => Identity(fn(x)), | ||
}) | ||
function overFn(lens, fn, object) { | ||
function overFn( | ||
lens, fn, object | ||
){ | ||
return lens(x => Identity(fn(x)))(object).x | ||
@@ -10,0 +12,0 @@ } |
@@ -1,11 +0,11 @@ | ||
export function partial(fn, ...args) { | ||
export function partial(fn, ...args){ | ||
const len = fn.length | ||
return (...rest) => { | ||
if (args.length + rest.length >= len) { | ||
if (args.length + rest.length >= len){ | ||
return fn(...args, ...rest) | ||
} | ||
return partial(fn, ...[...args, ...rest]) | ||
return partial(fn, ...[ ...args, ...rest ]) | ||
} | ||
} |
@@ -1,18 +0,20 @@ | ||
import {_isArray} from './_internals/_isArray' | ||
import { _isArray } from './_internals/_isArray.js' | ||
export function partitionObject(predicate, iterable) { | ||
export function partitionObject(predicate, iterable){ | ||
const yes = {} | ||
const no = {} | ||
Object.entries(iterable).forEach(([prop, value]) => { | ||
if (predicate(value, prop)) { | ||
yes[prop] = value | ||
Object.entries(iterable).forEach(([ prop, value ]) => { | ||
if (predicate(value, prop)){ | ||
yes[ prop ] = value | ||
} else { | ||
no[prop] = value | ||
no[ prop ] = value | ||
} | ||
}) | ||
return [yes, no] | ||
return [ yes, no ] | ||
} | ||
export function partitionArray(predicate, list, indexed = false) { | ||
export function partitionArray( | ||
predicate, list, indexed = false | ||
){ | ||
const yes = [] | ||
@@ -22,17 +24,17 @@ const no = [] | ||
while (counter++ < list.length - 1) { | ||
while (counter++ < list.length - 1){ | ||
if ( | ||
indexed ? predicate(list[counter], counter) : predicate(list[counter]) | ||
) { | ||
yes.push(list[counter]) | ||
indexed ? predicate(list[ counter ], counter) : predicate(list[ counter ]) | ||
){ | ||
yes.push(list[ counter ]) | ||
} else { | ||
no.push(list[counter]) | ||
no.push(list[ counter ]) | ||
} | ||
} | ||
return [yes, no] | ||
return [ yes, no ] | ||
} | ||
export function partition(predicate, iterable) { | ||
if (arguments.length === 1) { | ||
export function partition(predicate, iterable){ | ||
if (arguments.length === 1){ | ||
return listHolder => partition(predicate, listHolder) | ||
@@ -39,0 +41,0 @@ } |
@@ -1,5 +0,7 @@ | ||
export function path(pathInput, obj) { | ||
import { createPath } from './_internals/createPath.js' | ||
export function path(pathInput, obj){ | ||
if (arguments.length === 1) return _obj => path(pathInput, _obj) | ||
if (obj === null || obj === undefined) { | ||
if (obj === null || obj === undefined){ | ||
return undefined | ||
@@ -10,12 +12,11 @@ } | ||
const pathArrValue = | ||
typeof pathInput === 'string' ? pathInput.split('.') : pathInput | ||
const pathArrValue = createPath(pathInput) | ||
while (counter < pathArrValue.length) { | ||
if (willReturn === null || willReturn === undefined) { | ||
while (counter < pathArrValue.length){ | ||
if (willReturn === null || willReturn === undefined){ | ||
return undefined | ||
} | ||
if (willReturn[pathArrValue[counter]] === null) return undefined | ||
if (willReturn[ pathArrValue[ counter ] ] === null) return undefined | ||
willReturn = willReturn[pathArrValue[counter]] | ||
willReturn = willReturn[ pathArrValue[ counter ] ] | ||
counter++ | ||
@@ -22,0 +23,0 @@ } |
@@ -1,6 +0,8 @@ | ||
import {curry} from './curry' | ||
import {equals} from './equals' | ||
import {path} from './path' | ||
import { curry } from './curry.js' | ||
import { equals } from './equals.js' | ||
import { path } from './path.js' | ||
function pathEqFn(pathToSearch, target, input) { | ||
function pathEqFn( | ||
pathToSearch, target, input | ||
){ | ||
return equals(path(pathToSearch, input), target) | ||
@@ -7,0 +9,0 @@ } |
@@ -1,6 +0,8 @@ | ||
import {curry} from './curry' | ||
import {defaultTo} from './defaultTo' | ||
import {path} from './path' | ||
import { curry } from './curry.js' | ||
import { defaultTo } from './defaultTo.js' | ||
import { path } from './path.js' | ||
function pathOrFn(defaultValue, pathInput, obj) { | ||
function pathOrFn( | ||
defaultValue, pathInput, obj | ||
){ | ||
return defaultTo(defaultValue, path(pathInput, obj)) | ||
@@ -7,0 +9,0 @@ } |
@@ -1,5 +0,5 @@ | ||
import {path} from './path' | ||
import { path } from './path.js' | ||
export function paths(pathsToSearch, obj) { | ||
if (arguments.length === 1) { | ||
export function paths(pathsToSearch, obj){ | ||
if (arguments.length === 1){ | ||
return _obj => paths(pathsToSearch, _obj) | ||
@@ -6,0 +6,0 @@ } |
@@ -1,16 +0,16 @@ | ||
export function pick(propsToPick, input) { | ||
import { createPath } from './_internals/createPath.js' | ||
export function pick(propsToPick, input){ | ||
if (arguments.length === 1) return _input => pick(propsToPick, _input) | ||
if (input === null || input === undefined) { | ||
if (input === null || input === undefined){ | ||
return undefined | ||
} | ||
const keys = | ||
typeof propsToPick === 'string' ? propsToPick.split(',') : propsToPick | ||
const keys = createPath(propsToPick, ',') | ||
const willReturn = {} | ||
let counter = 0 | ||
while (counter < keys.length) { | ||
if (keys[counter] in input) { | ||
willReturn[keys[counter]] = input[keys[counter]] | ||
while (counter < keys.length){ | ||
if (keys[ counter ] in input){ | ||
willReturn[ keys[ counter ] ] = input[ keys[ counter ] ] | ||
} | ||
@@ -17,0 +17,0 @@ counter++ |
@@ -1,18 +0,18 @@ | ||
export function pickAll(propsToPick, obj) { | ||
import { createPath } from './_internals/createPath.js' | ||
export function pickAll(propsToPick, obj){ | ||
if (arguments.length === 1) return _obj => pickAll(propsToPick, _obj) | ||
if (obj === null || obj === undefined) { | ||
if (obj === null || obj === undefined){ | ||
return undefined | ||
} | ||
const keysValue = | ||
typeof propsToPick === 'string' ? propsToPick.split(',') : propsToPick | ||
const keysValue = createPath(propsToPick, ',') | ||
const willReturn = {} | ||
let counter = 0 | ||
while (counter < keysValue.length) { | ||
if (keysValue[counter] in obj) { | ||
willReturn[keysValue[counter]] = obj[keysValue[counter]] | ||
while (counter < keysValue.length){ | ||
if (keysValue[ counter ] in obj){ | ||
willReturn[ keysValue[ counter ] ] = obj[ keysValue[ counter ] ] | ||
} else { | ||
willReturn[keysValue[counter]] = undefined | ||
willReturn[ keysValue[ counter ] ] = undefined | ||
} | ||
@@ -19,0 +19,0 @@ counter++ |
@@ -1,17 +0,89 @@ | ||
export function pipe(...fns) { | ||
if (fns.length === 0) | ||
throw new Error('pipe requires at least one argument') | ||
import { reduceFn } from './reduce.js' | ||
return (...args) => { | ||
const list = fns.slice() | ||
if (list.length > 0) { | ||
const fn = list.shift() | ||
let result = fn(...args) | ||
while (list.length > 0) { | ||
result = list.shift()(result) | ||
} | ||
return result | ||
export function _arity(n, fn){ | ||
switch (n){ | ||
case 0: | ||
return function (){ | ||
return fn.apply(this, arguments) | ||
} | ||
case 1: | ||
return function (a0){ | ||
return fn.apply(this, arguments) | ||
} | ||
case 2: | ||
return function (a0, a1){ | ||
return fn.apply(this, arguments) | ||
} | ||
case 3: | ||
return function ( | ||
a0, a1, a2 | ||
){ | ||
return fn.apply(this, arguments) | ||
} | ||
case 4: | ||
return function ( | ||
a0, a1, a2, a3 | ||
){ | ||
return fn.apply(this, arguments) | ||
} | ||
case 5: | ||
return function ( | ||
a0, a1, a2, a3, a4 | ||
){ | ||
return fn.apply(this, arguments) | ||
} | ||
case 6: | ||
return function ( | ||
a0, a1, a2, a3, a4, a5 | ||
){ | ||
return fn.apply(this, arguments) | ||
} | ||
case 7: | ||
return function ( | ||
a0, a1, a2, a3, a4, a5, a6 | ||
){ | ||
return fn.apply(this, arguments) | ||
} | ||
case 8: | ||
return function ( | ||
a0, a1, a2, a3, a4, a5, a6, a7 | ||
){ | ||
return fn.apply(this, arguments) | ||
} | ||
case 9: | ||
return function ( | ||
a0, a1, a2, a3, a4, a5, a6, a7, a8 | ||
){ | ||
return fn.apply(this, arguments) | ||
} | ||
case 10: | ||
return function ( | ||
a0, a1, a2, a3, a4, a5, a6, a7, a8, a9 | ||
){ | ||
return fn.apply(this, arguments) | ||
} | ||
default: | ||
throw new Error('First argument to _arity must be a non-negative integer no greater than ten') | ||
} | ||
} | ||
export function _pipe(f, g){ | ||
return function (){ | ||
return g.call(this, f.apply(this, arguments)) | ||
} | ||
} | ||
export function pipe(){ | ||
if (arguments.length === 0){ | ||
throw new Error('pipe requires at least one argument') | ||
} | ||
return _arity(arguments[ 0 ].length, | ||
reduceFn( | ||
_pipe, | ||
arguments[ 0 ], | ||
Array.prototype.slice.call( | ||
arguments, 1, Infinity | ||
) | ||
)) | ||
} |
@@ -1,4 +0,4 @@ | ||
import {map} from './map' | ||
import { map } from './map.js' | ||
export function pluck(property, list) { | ||
export function pluck(property, list){ | ||
if (arguments.length === 1) return _list => pluck(property, _list) | ||
@@ -9,4 +9,4 @@ | ||
map(x => { | ||
if (x[property] !== undefined) { | ||
willReturn.push(x[property]) | ||
if (x[ property ] !== undefined){ | ||
willReturn.push(x[ property ]) | ||
} | ||
@@ -13,0 +13,0 @@ }, list) |
@@ -1,7 +0,7 @@ | ||
export function prepend(x, input) { | ||
export function prepend(x, input){ | ||
if (arguments.length === 1) return _input => prepend(x, _input) | ||
if (typeof input === 'string') return [x].concat(input.split('')) | ||
if (typeof input === 'string') return [ x ].concat(input.split('')) | ||
return [x].concat(input) | ||
return [ x ].concat(input) | ||
} |
@@ -1,4 +0,4 @@ | ||
import {multiply} from './multiply' | ||
import {reduce} from './reduce' | ||
import { multiply } from './multiply.js' | ||
import { reduce } from './reduce.js' | ||
export const product = reduce(multiply, 1) |
@@ -1,2 +0,2 @@ | ||
export function prop(propToFind, obj) { | ||
export function prop(propToFind, obj){ | ||
if (arguments.length === 1) return _obj => prop(propToFind, _obj) | ||
@@ -6,3 +6,3 @@ | ||
return obj[propToFind] | ||
return obj[ propToFind ] | ||
} |
@@ -1,9 +0,11 @@ | ||
import {curry} from './curry' | ||
import { curry } from './curry.js' | ||
function propEqFn(propToFind, valueToMatch, obj) { | ||
function propEqFn( | ||
propToFind, valueToMatch, obj | ||
){ | ||
if (!obj) return false | ||
return obj[propToFind] === valueToMatch | ||
return obj[ propToFind ] === valueToMatch | ||
} | ||
export const propEq = curry(propEqFn) |
@@ -1,8 +0,10 @@ | ||
import {curry} from './curry' | ||
import {is} from './is' | ||
import { curry } from './curry.js' | ||
import { is } from './is.js' | ||
function propIsFn(targetPrototype, property, obj) { | ||
return is(targetPrototype, obj[property]) | ||
function propIsFn( | ||
targetPrototype, property, obj | ||
){ | ||
return is(targetPrototype, obj[ property ]) | ||
} | ||
export const propIs = curry(propIsFn) |
@@ -1,10 +0,12 @@ | ||
import {curry} from './curry' | ||
import {defaultTo} from './defaultTo' | ||
import { curry } from './curry.js' | ||
import { defaultTo } from './defaultTo.js' | ||
function propOrFn(defaultValue, property, obj) { | ||
function propOrFn( | ||
defaultValue, property, obj | ||
){ | ||
if (!obj) return defaultValue | ||
return defaultTo(defaultValue, obj[property]) | ||
return defaultTo(defaultValue, obj[ property ]) | ||
} | ||
export const propOr = curry(propOrFn) |
@@ -1,13 +0,13 @@ | ||
import {_isArray} from './_internals/_isArray' | ||
import {mapArray} from './map' | ||
import { _isArray } from './_internals/_isArray.js' | ||
import { mapArray } from './map.js' | ||
export function props(propsToPick, obj) { | ||
if (arguments.length === 1) { | ||
export function props(propsToPick, obj){ | ||
if (arguments.length === 1){ | ||
return _obj => props(propsToPick, _obj) | ||
} | ||
if (!_isArray(propsToPick)) { | ||
if (!_isArray(propsToPick)){ | ||
throw new Error('propsToPick is not a list') | ||
} | ||
return mapArray(prop => obj[prop], propsToPick) | ||
return mapArray(prop => obj[ prop ], propsToPick) | ||
} |
@@ -1,5 +0,5 @@ | ||
export function range(start, end) { | ||
export function range(start, end){ | ||
if (arguments.length === 1) return _end => range(start, _end) | ||
if (Number.isNaN(Number(start)) || Number.isNaN(Number(end))) { | ||
if (Number.isNaN(Number(start)) || Number.isNaN(Number(end))){ | ||
throw new TypeError('Both arguments to range must be numbers') | ||
@@ -13,4 +13,4 @@ } | ||
for (let i = 0; i < len; i++) { | ||
willReturn[i] = start + i | ||
for (let i = 0; i < len; i++){ | ||
willReturn[ i ] = start + i | ||
} | ||
@@ -17,0 +17,0 @@ |
@@ -1,7 +0,9 @@ | ||
import {_isArray} from './_internals/_isArray' | ||
import {_keys} from './_internals/_keys' | ||
import {curry} from './curry' | ||
import { _isArray } from './_internals/_isArray.js' | ||
import { _keys } from './_internals/_keys.js' | ||
import { curry } from './curry.js' | ||
function reduceFn(reducer, acc, list) { | ||
if (!_isArray(list)) { | ||
export function reduceFn( | ||
reducer, acc, list | ||
){ | ||
if (!_isArray(list)){ | ||
throw new TypeError('reduce: list must be array or iterable') | ||
@@ -12,4 +14,6 @@ } | ||
while (index < len) { | ||
acc = reducer(acc, list[index], index, list) | ||
while (index < len){ | ||
acc = reducer( | ||
acc, list[ index ], index, list | ||
) | ||
index++ | ||
@@ -16,0 +20,0 @@ } |
@@ -1,4 +0,4 @@ | ||
import {filter} from './filter' | ||
import { filter } from './filter.js' | ||
export function reject(predicate, list) { | ||
export function reject(predicate, list){ | ||
if (arguments.length === 1) return _list => reject(predicate, _list) | ||
@@ -5,0 +5,0 @@ |
@@ -1,3 +0,3 @@ | ||
export function repeat(x, timesToRepeat) { | ||
if (arguments.length === 1) { | ||
export function repeat(x, timesToRepeat){ | ||
if (arguments.length === 1){ | ||
return _timesToRepeat => repeat(x, _timesToRepeat) | ||
@@ -4,0 +4,0 @@ } |
@@ -1,4 +0,6 @@ | ||
import {curry} from './curry' | ||
import { curry } from './curry.js' | ||
function replaceFn(pattern, replacer, str) { | ||
function replaceFn( | ||
pattern, replacer, str | ||
){ | ||
return str.replace(pattern, replacer) | ||
@@ -5,0 +7,0 @@ } |
@@ -1,4 +0,5 @@ | ||
export function reverse(listOrString) { | ||
if (typeof listOrString === 'string') { | ||
return listOrString.split('').reverse().join('') | ||
export function reverse(listOrString){ | ||
if (typeof listOrString === 'string'){ | ||
return listOrString.split('').reverse() | ||
.join('') | ||
} | ||
@@ -5,0 +6,0 @@ |
@@ -1,9 +0,13 @@ | ||
import {always} from './always' | ||
import {curry} from './curry' | ||
import {over} from './over' | ||
import { always } from './always.js' | ||
import { curry } from './curry.js' | ||
import { over } from './over.js' | ||
function setFn(lens, replacer, x) { | ||
return over(lens, always(replacer), x) | ||
function setFn( | ||
lens, replacer, x | ||
){ | ||
return over( | ||
lens, always(replacer), x | ||
) | ||
} | ||
export const set = curry(setFn) |
@@ -1,4 +0,6 @@ | ||
import {curry} from './curry' | ||
import { curry } from './curry.js' | ||
function sliceFn(from, to, list) { | ||
function sliceFn( | ||
from, to, list | ||
){ | ||
return list.slice(from, to) | ||
@@ -5,0 +7,0 @@ } |
@@ -1,4 +0,4 @@ | ||
import {cloneList} from './_internals/cloneList' | ||
import { cloneList } from './_internals/cloneList.js' | ||
export function sort(sortFn, list) { | ||
export function sort(sortFn, list){ | ||
if (arguments.length === 1) return _list => sort(sortFn, _list) | ||
@@ -5,0 +5,0 @@ |
@@ -1,4 +0,4 @@ | ||
import {cloneList} from './_internals/cloneList' | ||
import { cloneList } from './_internals/cloneList.js' | ||
export function sortBy(sortFn, list) { | ||
export function sortBy(sortFn, list){ | ||
if (arguments.length === 1) return _list => sortBy(sortFn, _list) | ||
@@ -5,0 +5,0 @@ |
@@ -1,2 +0,2 @@ | ||
export function split(separator, str) { | ||
export function split(separator, str){ | ||
if (arguments.length === 1) return _str => split(separator, _str) | ||
@@ -3,0 +3,0 @@ |
@@ -1,13 +0,13 @@ | ||
import {_isArray} from './_internals/_isArray' | ||
import {drop} from './drop' | ||
import {maybe} from './maybe' | ||
import {take} from './take' | ||
import { _isArray } from './_internals/_isArray.js' | ||
import { drop } from './drop.js' | ||
import { maybe } from './maybe.js' | ||
import { take } from './take.js' | ||
export function splitAt(index, input) { | ||
if (arguments.length === 1) { | ||
export function splitAt(index, input){ | ||
if (arguments.length === 1){ | ||
return _list => splitAt(index, _list) | ||
} | ||
if (!input) throw new TypeError(`Cannot read property 'slice' of ${input}`) | ||
if (!input) throw new TypeError(`Cannot read property 'slice' of ${ input }`) | ||
if (!_isArray(input) && typeof input !== 'string') return [[], []] | ||
if (!_isArray(input) && typeof input !== 'string') return [ [], [] ] | ||
@@ -20,3 +20,3 @@ const correctIndex = maybe( | ||
return [take(correctIndex, input), drop(correctIndex, input)] | ||
return [ take(correctIndex, input), drop(correctIndex, input) ] | ||
} |
@@ -1,10 +0,8 @@ | ||
export function splitEvery(sliceLength, listOrString) { | ||
if (arguments.length === 1) { | ||
export function splitEvery(sliceLength, listOrString){ | ||
if (arguments.length === 1){ | ||
return _listOrString => splitEvery(sliceLength, _listOrString) | ||
} | ||
if (sliceLength < 1) { | ||
throw new Error( | ||
'First argument to splitEvery must be a positive integer' | ||
) | ||
if (sliceLength < 1){ | ||
throw new Error('First argument to splitEvery must be a positive integer') | ||
} | ||
@@ -15,4 +13,4 @@ | ||
while (counter < listOrString.length) { | ||
willReturn.push(listOrString.slice(counter, (counter += sliceLength))) | ||
while (counter < listOrString.length){ | ||
willReturn.push(listOrString.slice(counter, counter += sliceLength)) | ||
} | ||
@@ -19,0 +17,0 @@ |
@@ -1,7 +0,7 @@ | ||
export function splitWhen(predicate, input) { | ||
if (arguments.length === 1) { | ||
export function splitWhen(predicate, input){ | ||
if (arguments.length === 1){ | ||
return _input => splitWhen(predicate, _input) | ||
} | ||
if (!input) | ||
throw new TypeError(`Cannot read property 'length' of ${input}`) | ||
throw new TypeError(`Cannot read property 'length' of ${ input }`) | ||
@@ -13,14 +13,14 @@ const preFound = [] | ||
while (counter++ < input.length - 1) { | ||
if (found) { | ||
postFound.push(input[counter]) | ||
} else if (predicate(input[counter])) { | ||
postFound.push(input[counter]) | ||
while (counter++ < input.length - 1){ | ||
if (found){ | ||
postFound.push(input[ counter ]) | ||
} else if (predicate(input[ counter ])){ | ||
postFound.push(input[ counter ]) | ||
found = true | ||
} else { | ||
preFound.push(input[counter]) | ||
preFound.push(input[ counter ]) | ||
} | ||
} | ||
return [preFound, postFound] | ||
return [ preFound, postFound ] | ||
} |
@@ -1,9 +0,9 @@ | ||
import {equals} from './equals.js' | ||
import {_isArray} from './_internals/_isArray.js' | ||
import { _isArray } from './_internals/_isArray.js' | ||
import { equals } from './equals.js' | ||
export function startsWith(target, iterable) { | ||
export function startsWith(target, iterable){ | ||
if (arguments.length === 1) | ||
return _iterable => startsWith(target, _iterable) | ||
if (typeof iterable === 'string') { | ||
if (typeof iterable === 'string'){ | ||
return iterable.startsWith(target) | ||
@@ -16,4 +16,5 @@ } | ||
if (!correct) return false | ||
const result = equals(x, iterable[index]) | ||
const result = equals(x, iterable[ index ]) | ||
if (!result) correct = false | ||
return result | ||
@@ -20,0 +21,0 @@ }) |
@@ -1,2 +0,2 @@ | ||
export function subtract(a, b) { | ||
export function subtract(a, b){ | ||
if (arguments.length === 1) return _b => subtract(a, _b) | ||
@@ -3,0 +3,0 @@ |
@@ -1,3 +0,3 @@ | ||
export function sum(list) { | ||
export function sum(list){ | ||
return list.reduce((prev, current) => prev + current, 0) | ||
} |
@@ -1,14 +0,12 @@ | ||
import {concat} from './concat' | ||
import {filter} from './filter' | ||
import {includes} from './includes' | ||
import { concat } from './concat.js' | ||
import { filter } from './filter.js' | ||
import { includes } from './includes.js' | ||
export function symmetricDifference(x, y) { | ||
if (arguments.length === 1) { | ||
export function symmetricDifference(x, y){ | ||
if (arguments.length === 1){ | ||
return _y => symmetricDifference(x, _y) | ||
} | ||
return concat( | ||
filter(value => !includes(value, y), x), | ||
filter(value => !includes(value, x), y) | ||
) | ||
return concat(filter(value => !includes(value, y), x), | ||
filter(value => !includes(value, x), y)) | ||
} |
@@ -1,3 +0,3 @@ | ||
export function T() { | ||
export function T(){ | ||
return true | ||
} |
@@ -1,5 +0,5 @@ | ||
import {drop} from './drop' | ||
import { drop } from './drop.js' | ||
export function tail(listOrString) { | ||
export function tail(listOrString){ | ||
return drop(1, listOrString) | ||
} |
@@ -1,4 +0,4 @@ | ||
import baseSlice from './_internals/baseSlice' | ||
import baseSlice from './_internals/baseSlice.js' | ||
export function take(howMany, listOrString) { | ||
export function take(howMany, listOrString){ | ||
if (arguments.length === 1) | ||
@@ -9,3 +9,5 @@ return _listOrString => take(howMany, _listOrString) | ||
return baseSlice(listOrString, 0, howMany) | ||
return baseSlice( | ||
listOrString, 0, howMany | ||
) | ||
} |
@@ -1,4 +0,4 @@ | ||
import baseSlice from './_internals/baseSlice' | ||
import baseSlice from './_internals/baseSlice.js' | ||
export function takeLast(howMany, listOrString) { | ||
export function takeLast(howMany, listOrString){ | ||
if (arguments.length === 1) | ||
@@ -16,3 +16,5 @@ return _listOrString => takeLast(howMany, _listOrString) | ||
return baseSlice(listOrString, numValue, len) | ||
return baseSlice( | ||
listOrString, numValue, len | ||
) | ||
} |
@@ -1,5 +0,5 @@ | ||
import {_isArray} from './_internals/_isArray' | ||
import { _isArray } from './_internals/_isArray.js' | ||
export function takeLastWhile(predicate, input) { | ||
if (arguments.length === 1) { | ||
export function takeLastWhile(predicate, input){ | ||
if (arguments.length === 1){ | ||
return _input => takeLastWhile(predicate, _input) | ||
@@ -12,8 +12,8 @@ } | ||
while (!found || counter === 0) { | ||
while (!found || counter === 0){ | ||
counter-- | ||
if (predicate(input[counter]) === false) { | ||
if (predicate(input[ counter ]) === false){ | ||
found = true | ||
} else if (!found) { | ||
toReturn.push(input[counter]) | ||
} else if (!found){ | ||
toReturn.push(input[ counter ]) | ||
} | ||
@@ -20,0 +20,0 @@ } |
@@ -1,9 +0,9 @@ | ||
import {_isArray} from '../src/_internals/_isArray' | ||
import { _isArray } from '../src/_internals/_isArray.js' | ||
export function takeWhile(predicate, iterable) { | ||
if (arguments.length === 1) { | ||
export function takeWhile(predicate, iterable){ | ||
if (arguments.length === 1){ | ||
return _iterable => takeWhile(predicate, _iterable) | ||
} | ||
const isArray = _isArray(iterable) | ||
if (!isArray && typeof iterable !== 'string') { | ||
if (!isArray && typeof iterable !== 'string'){ | ||
throw new Error('`iterable` is neither list nor a string') | ||
@@ -15,7 +15,7 @@ } | ||
while (counter++ < iterable.length - 1) { | ||
if (!predicate(iterable[counter])) { | ||
while (counter++ < iterable.length - 1){ | ||
if (!predicate(iterable[ counter ])){ | ||
if (flag) flag = false | ||
} else if (flag) { | ||
holder.push(iterable[counter]) | ||
} else if (flag){ | ||
holder.push(iterable[ counter ]) | ||
} | ||
@@ -22,0 +22,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export function tap(fn, x) { | ||
export function tap(fn, x){ | ||
if (arguments.length === 1) return _x => tap(fn, _x) | ||
@@ -3,0 +3,0 @@ |
@@ -1,8 +0,6 @@ | ||
export function test(pattern, str) { | ||
export function test(pattern, str){ | ||
if (arguments.length === 1) return _str => test(pattern, _str) | ||
if (typeof pattern === 'string') { | ||
throw new TypeError( | ||
`‘test’ requires a value of type RegExp as its first argument; received "${pattern}"` | ||
) | ||
if (typeof pattern === 'string'){ | ||
throw new TypeError(`‘test’ requires a value of type RegExp as its first argument; received "${ pattern }"`) | ||
} | ||
@@ -9,0 +7,0 @@ |
@@ -1,7 +0,7 @@ | ||
import {map} from './map' | ||
import {range} from './range' | ||
import { map } from './map.js' | ||
import { range } from './range.js' | ||
export function times(fn, howMany) { | ||
export function times(fn, howMany){ | ||
if (arguments.length === 1) return _howMany => times(fn, _howMany) | ||
if (!Number.isInteger(howMany) || howMany < 0) { | ||
if (!Number.isInteger(howMany) || howMany < 0){ | ||
throw new RangeError('n must be an integer') | ||
@@ -8,0 +8,0 @@ } |
@@ -1,3 +0,3 @@ | ||
export function toLower(str) { | ||
export function toLower(str){ | ||
return str.toLowerCase() | ||
} |
@@ -1,3 +0,3 @@ | ||
export function toPairs(obj) { | ||
export function toPairs(obj){ | ||
return Object.entries(obj) | ||
} |
@@ -1,3 +0,3 @@ | ||
export function toString(x) { | ||
export function toString(x){ | ||
return x.toString() | ||
} |
@@ -1,3 +0,3 @@ | ||
export function toUpper(str) { | ||
export function toUpper(str){ | ||
return str.toUpperCase() | ||
} |
@@ -1,8 +0,7 @@ | ||
import {_isArray} from './_internals/_isArray' | ||
import { _isArray } from './_internals/_isArray.js' | ||
export function transpose(array) { | ||
export function transpose(array){ | ||
return array.reduce((acc, el) => { | ||
el.forEach((nestedEl, i) => | ||
_isArray(acc[i]) ? acc[i].push(nestedEl) : acc.push([nestedEl]) | ||
) | ||
_isArray(acc[ i ]) ? acc[ i ].push(nestedEl) : acc.push([ nestedEl ])) | ||
@@ -9,0 +8,0 @@ return acc |
@@ -1,3 +0,3 @@ | ||
export function trim(str) { | ||
export function trim(str){ | ||
return str.trim() | ||
} |
@@ -1,6 +0,8 @@ | ||
import {isFunction} from './isFunction' | ||
import { type } from './type.js' | ||
export function tryCatch(fn, fallback) { | ||
if (!isFunction(fn)) { | ||
throw new Error(`R.tryCatch | fn '${fn}'`) | ||
const isFunction = x => [ 'Promise', 'Function' ].includes(type(x)) | ||
export function tryCatch(fn, fallback){ | ||
if (!isFunction(fn)){ | ||
throw new Error(`R.tryCatch | fn '${ fn }'`) | ||
} | ||
@@ -12,3 +14,3 @@ const passFallback = isFunction(fallback) | ||
return fn(...inputs) | ||
} catch (e) { | ||
} catch (e){ | ||
return passFallback ? fallback(e, ...inputs) : fallback | ||
@@ -15,0 +17,0 @@ } |
@@ -1,7 +0,7 @@ | ||
export function type(input) { | ||
if (input === null) { | ||
export function type(input){ | ||
if (input === null){ | ||
return 'Null' | ||
} else if (input === undefined) { | ||
} else if (input === undefined){ | ||
return 'Undefined' | ||
} else if (Number.isNaN(input)) { | ||
} else if (Number.isNaN(input)){ | ||
return 'NaN' | ||
@@ -11,3 +11,3 @@ } | ||
return typeResult === 'AsyncFunction' ? 'Async' : typeResult | ||
return typeResult === 'AsyncFunction' ? 'Promise' : typeResult | ||
} |
@@ -1,5 +0,5 @@ | ||
export function unapply(fn) { | ||
return function (...args) { | ||
export function unapply(fn){ | ||
return function (...args){ | ||
return fn.call(this, args) | ||
} | ||
} |
@@ -1,5 +0,5 @@ | ||
import {includes} from './includes' | ||
import {cloneList} from './_internals/cloneList' | ||
import { cloneList } from './_internals/cloneList.js' | ||
import { includes } from './includes.js' | ||
export function union(x, y) { | ||
export function union(x, y){ | ||
if (arguments.length === 1) return _y => union(x, _y) | ||
@@ -6,0 +6,0 @@ |
@@ -1,8 +0,8 @@ | ||
import {_Set} from './_internals/set' | ||
import { _Set } from './_internals/set.js' | ||
export function uniq(list) { | ||
export function uniq(list){ | ||
const set = new _Set() | ||
const willReturn = [] | ||
list.forEach(item => { | ||
if (set.checkUniqueness(item)) { | ||
if (set.checkUniqueness(item)){ | ||
willReturn.push(item) | ||
@@ -9,0 +9,0 @@ } |
@@ -1,9 +0,11 @@ | ||
function includesWith(predicate, target, list) { | ||
function includesWith( | ||
predicate, target, list | ||
){ | ||
let willReturn = false | ||
let index = -1 | ||
while (++index < list.length && !willReturn) { | ||
const value = list[index] | ||
while (++index < list.length && !willReturn){ | ||
const value = list[ index ] | ||
if (predicate(target, value)) { | ||
if (predicate(target, value)){ | ||
willReturn = true | ||
@@ -16,3 +18,3 @@ } | ||
export function uniqWith(predicate, list) { | ||
export function uniqWith(predicate, list){ | ||
if (arguments.length === 1) return _list => uniqWith(predicate, _list) | ||
@@ -23,6 +25,8 @@ | ||
while (++index < list.length) { | ||
const value = list[index] | ||
while (++index < list.length){ | ||
const value = list[ index ] | ||
if (!includesWith(predicate, value, willReturn)) { | ||
if (!includesWith( | ||
predicate, value, willReturn | ||
)){ | ||
willReturn.push(value) | ||
@@ -29,0 +33,0 @@ } |
@@ -1,7 +0,7 @@ | ||
export function unless(predicate, whenFalse) { | ||
if (arguments.length === 1) { | ||
export function unless(predicate, whenFalse){ | ||
if (arguments.length === 1){ | ||
return _whenFalse => unless(predicate, _whenFalse) | ||
} | ||
return input => (predicate(input) ? input : whenFalse(input)) | ||
return input => predicate(input) ? input : whenFalse(input) | ||
} |
@@ -1,11 +0,15 @@ | ||
import {curry} from './curry' | ||
import {cloneList} from './_internals/cloneList' | ||
import { cloneList } from './_internals/cloneList.js' | ||
import { curry } from './curry.js' | ||
function updateFn(index, newValue, list) { | ||
function updateFn( | ||
index, newValue, list | ||
){ | ||
const clone = cloneList(list) | ||
if (index === -1) return clone.fill(newValue, index) | ||
return clone.fill(newValue, index, index + 1) | ||
return clone.fill( | ||
newValue, index, index + 1 | ||
) | ||
} | ||
export const update = curry(updateFn) |
@@ -1,4 +0,4 @@ | ||
import {type} from './type' | ||
import { type } from './type.js' | ||
export function values(obj) { | ||
export function values(obj){ | ||
if (type(obj) !== 'Object') return [] | ||
@@ -5,0 +5,0 @@ |
const Const = x => ({ | ||
x, | ||
map: fn => Const(x), | ||
map : fn => Const(x), | ||
}) | ||
export function view(lens, target) { | ||
export function view(lens, target){ | ||
if (arguments.length === 1) return _target => view(lens, _target) | ||
@@ -8,0 +8,0 @@ |
@@ -1,4 +0,6 @@ | ||
import {curry} from './curry' | ||
import { curry } from './curry.js' | ||
function whenFn(predicate, whenTrueFn, input) { | ||
function whenFn( | ||
predicate, whenTrueFn, input | ||
){ | ||
if (!predicate(input)) return input | ||
@@ -5,0 +7,0 @@ |
@@ -1,9 +0,9 @@ | ||
export function where(conditions, input) { | ||
if (input === undefined) { | ||
export function where(conditions, input){ | ||
if (input === undefined){ | ||
return _input => where(conditions, _input) | ||
} | ||
let flag = true | ||
for (const prop in conditions) { | ||
const result = conditions[prop](input[prop]) | ||
if (flag && result === false) { | ||
for (const prop in conditions){ | ||
const result = conditions[ prop ](input[ prop ]) | ||
if (flag && result === false){ | ||
flag = false | ||
@@ -10,0 +10,0 @@ } |
@@ -1,16 +0,14 @@ | ||
import {equals} from './equals' | ||
import {filter} from './filter' | ||
import { equals } from './equals.js' | ||
import { filter } from './filter.js' | ||
export function whereEq(condition, input) { | ||
if (arguments.length === 1) { | ||
export function whereEq(condition, input){ | ||
if (arguments.length === 1){ | ||
return _input => whereEq(condition, _input) | ||
} | ||
const result = filter( | ||
(conditionValue, conditionProp) => | ||
equals(conditionValue, input[conditionProp]), | ||
condition | ||
) | ||
const result = filter((conditionValue, conditionProp) => | ||
equals(conditionValue, input[ conditionProp ]), | ||
condition) | ||
return Object.keys(result).length === Object.keys(condition).length | ||
} |
@@ -1,6 +0,6 @@ | ||
import {reduce} from './reduce' | ||
import {_indexOf} from './equals' | ||
import { _indexOf } from './equals.js' | ||
import { reduce } from './reduce.js' | ||
export function without(matchAgainst, source) { | ||
if (source === undefined) { | ||
export function without(matchAgainst, source){ | ||
if (source === undefined){ | ||
return _source => without(matchAgainst, _source) | ||
@@ -7,0 +7,0 @@ } |
@@ -1,5 +0,5 @@ | ||
export function xor(a, b) { | ||
export function xor(a, b){ | ||
if (arguments.length === 1) return _b => xor(a, _b) | ||
return (Boolean(a) && !b) || (Boolean(b) && !a) | ||
return Boolean(a) && !b || Boolean(b) && !a | ||
} |
@@ -1,2 +0,2 @@ | ||
export function zip(left, right) { | ||
export function zip(left, right){ | ||
if (arguments.length === 1) return _right => zip(left, _right) | ||
@@ -7,4 +7,4 @@ | ||
for (let i = 0; i < length; i++) { | ||
result[i] = [left[i], right[i]] | ||
for (let i = 0; i < length; i++){ | ||
result[ i ] = [ left[ i ], right[ i ] ] | ||
} | ||
@@ -11,0 +11,0 @@ |
@@ -1,8 +0,10 @@ | ||
import {take} from './take' | ||
import { take } from './take.js' | ||
export function zipObj(keys, values) { | ||
export function zipObj(keys, values){ | ||
if (arguments.length === 1) return yHolder => zipObj(keys, yHolder) | ||
return take(values.length, keys).reduce((prev, xInstance, i) => { | ||
prev[xInstance] = values[i] | ||
return take(values.length, keys).reduce(( | ||
prev, xInstance, i | ||
) => { | ||
prev[ xInstance ] = values[ i ] | ||
@@ -9,0 +11,0 @@ return prev |
@@ -1,10 +0,10 @@ | ||
import {curry} from './curry' | ||
import {take} from './take' | ||
import { curry } from './curry.js' | ||
import { take } from './take.js' | ||
function zipWithFn(fn, x, y) { | ||
return take(x.length > y.length ? y.length : x.length, x).map( | ||
(xInstance, i) => fn(xInstance, y[i]) | ||
) | ||
function zipWithFn( | ||
fn, x, y | ||
){ | ||
return take(x.length > y.length ? y.length : x.length, x).map((xInstance, i) => fn(xInstance, y[ i ])) | ||
} | ||
export const zipWith = curry(zipWithFn) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
837775
206
11071
19197