@most/prelude
Advanced tools
Comparing version 1.7.3 to 1.8.0
/** @license MIT License (c) copyright 2010-2016 original author or authors */ | ||
// Non-mutating array operations | ||
// cons :: a -> [a] -> [a] | ||
// a with x prepended | ||
/** | ||
* a with x prepended | ||
*/ | ||
function cons(x, a) { | ||
var l = a.length; | ||
var b = new Array(l + 1); | ||
b[0] = x; | ||
for (var i = 0; i < l; ++i) { | ||
b[i + 1] = a[i]; | ||
} | ||
return b; | ||
var l = a.length; | ||
var b = new Array(l + 1); | ||
b[0] = x; | ||
for (var i = 0; i < l; ++i) { | ||
b[i + 1] = a[i]; | ||
} | ||
return b; | ||
} | ||
// append :: a -> [a] -> [a] | ||
// a with x appended | ||
/** | ||
* a with x appended | ||
*/ | ||
function append(x, a) { | ||
var l = a.length; | ||
var b = new Array(l + 1); | ||
for (var i = 0; i < l; ++i) { | ||
b[i] = a[i]; | ||
} | ||
b[l] = x; | ||
return b; | ||
var l = a.length; | ||
var b = new Array(l + 1); | ||
for (var i = 0; i < l; ++i) { | ||
b[i] = a[i]; | ||
} | ||
b[l] = x; | ||
return b; | ||
} | ||
// drop :: Int -> [a] -> [a] | ||
// drop first n elements | ||
/** | ||
* Concats two `ArrayLike`s | ||
*/ | ||
function concat(a, b) { | ||
var al = a.length; | ||
var bl = b.length; | ||
var r = new Array(al + bl); | ||
var i = 0; | ||
for (i = 0; i < al; i++) { | ||
r[i] = a[i]; | ||
} | ||
for (var j = 0; j < bl; j++) { | ||
r[i++] = b[j]; | ||
} | ||
return r; | ||
} | ||
// | ||
/** | ||
* drop first n elements | ||
*/ | ||
function drop(n, a) { | ||
// eslint-disable-line complexity | ||
if (n < 0) { | ||
throw new TypeError('n must be >= 0'); | ||
} | ||
var l = a.length; | ||
if (n === 0 || l === 0) { | ||
return a; | ||
} | ||
if (n >= l) { | ||
return []; | ||
} | ||
return unsafeDrop(n, a, l - n); | ||
if (n < 0) { | ||
throw new TypeError('n must be >= 0'); | ||
} | ||
var l = a.length; | ||
if (n === 0 || l === 0) { | ||
return a; | ||
} | ||
if (n >= l) { | ||
return []; | ||
} | ||
return unsafeDrop(n, a, l - n); | ||
} | ||
// unsafeDrop :: Int -> [a] -> Int -> [a] | ||
// Internal helper for drop | ||
/** | ||
* Internal helper for drop | ||
*/ | ||
function unsafeDrop(n, a, l) { | ||
var b = new Array(l); | ||
for (var i = 0; i < l; ++i) { | ||
b[i] = a[n + i]; | ||
} | ||
return b; | ||
var b = new Array(l); | ||
for (var i = 0; i < l; ++i) { | ||
b[i] = a[n + i]; | ||
} | ||
return b; | ||
} | ||
// tail :: [a] -> [a] | ||
// drop head element | ||
/** | ||
* drop head element | ||
*/ | ||
function tail(a) { | ||
return drop(1, a); | ||
return drop(1, a); | ||
} | ||
// copy :: [a] -> [a] | ||
// duplicate a (shallow duplication) | ||
/** | ||
* duplicate a (shallow duplication) | ||
*/ | ||
function copy(a) { | ||
var l = a.length; | ||
var b = new Array(l); | ||
for (var i = 0; i < l; ++i) { | ||
b[i] = a[i]; | ||
} | ||
return b; | ||
var l = a.length; | ||
var b = new Array(l); | ||
for (var i = 0; i < l; ++i) { | ||
b[i] = a[i]; | ||
} | ||
return b; | ||
} | ||
// map :: (a -> b) -> [a] -> [b] | ||
// transform each element with f | ||
/** | ||
* transform each element with f | ||
*/ | ||
function map(f, a) { | ||
var l = a.length; | ||
var b = new Array(l); | ||
for (var i = 0; i < l; ++i) { | ||
b[i] = f(a[i]); | ||
} | ||
return b; | ||
var l = a.length; | ||
var b = new Array(l); | ||
for (var i = 0; i < l; ++i) { | ||
b[i] = f(a[i]); | ||
} | ||
return b; | ||
} | ||
// reduce :: (a -> b -> a) -> a -> [b] -> a | ||
// accumulate via left-fold | ||
/** | ||
* accumulate via left-fold | ||
*/ | ||
function reduce(f, z, a) { | ||
var r = z; | ||
for (var i = 0, l = a.length; i < l; ++i) { | ||
r = f(r, a[i], i); | ||
} | ||
return r; | ||
var r = z; | ||
for (var i = 0, l = a.length; i < l; ++i) { | ||
r = f(r, a[i], i); | ||
} | ||
return r; | ||
} | ||
// replace :: a -> Int -> [a] | ||
// replace element at index | ||
/** | ||
* replace element at index | ||
*/ | ||
function replace(x, i, a) { | ||
// eslint-disable-line complexity | ||
if (i < 0) { | ||
throw new TypeError('i must be >= 0'); | ||
} | ||
var l = a.length; | ||
var b = new Array(l); | ||
for (var j = 0; j < l; ++j) { | ||
b[j] = i === j ? x : a[j]; | ||
} | ||
return b; | ||
if (i < 0) { | ||
throw new TypeError('i must be >= 0'); | ||
} | ||
var l = a.length; | ||
var b = new Array(l); | ||
for (var j = 0; j < l; ++j) { | ||
b[j] = i === j ? x : a[j]; | ||
} | ||
return b; | ||
} | ||
// remove :: Int -> [a] -> [a] | ||
// remove element at index | ||
/** | ||
* remove element at index | ||
* @throws | ||
*/ | ||
function remove(i, a) { | ||
// eslint-disable-line complexity | ||
if (i < 0) { | ||
throw new TypeError('i must be >= 0'); | ||
} | ||
var l = a.length; | ||
if (l === 0 || i >= l) { | ||
// exit early if index beyond end of array | ||
return a; | ||
} | ||
if (l === 1) { | ||
// exit early if index in bounds and length === 1 | ||
return []; | ||
} | ||
return unsafeRemove(i, a, l - 1); | ||
if (i < 0) { | ||
throw new TypeError('i must be >= 0'); | ||
} | ||
var l = a.length; | ||
if (l === 0 || i >= l) { // exit early if index beyond end of array | ||
return a; | ||
} | ||
if (l === 1) { // exit early if index in bounds and length === 1 | ||
return []; | ||
} | ||
return unsafeRemove(i, a, l - 1); | ||
} | ||
// unsafeRemove :: Int -> [a] -> Int -> [a] | ||
// Internal helper to remove element at index | ||
/** | ||
* Internal helper to remove element at index | ||
*/ | ||
function unsafeRemove(i, a, l) { | ||
var b = new Array(l); | ||
var j = void 0; | ||
for (j = 0; j < i; ++j) { | ||
b[j] = a[j]; | ||
} | ||
for (j = i; j < l; ++j) { | ||
b[j] = a[j + 1]; | ||
} | ||
return b; | ||
var b = new Array(l); | ||
var j; | ||
for (j = 0; j < i; ++j) { | ||
b[j] = a[j]; | ||
} | ||
for (j = i; j < l; ++j) { | ||
b[j] = a[j + 1]; | ||
} | ||
return b; | ||
} | ||
// removeAll :: (a -> boolean) -> [a] -> [a] | ||
// remove all elements matching a predicate | ||
// @deprecated | ||
/** | ||
* remove all elements matching a predicate | ||
* @deprecated | ||
*/ | ||
function removeAll(f, a) { | ||
var l = a.length; | ||
var b = new Array(l); | ||
var j = 0; | ||
for (var x, i = 0; i < l; ++i) { | ||
x = a[i]; | ||
if (!f(x)) { | ||
b[j] = x; | ||
++j; | ||
var l = a.length; | ||
var b = new Array(l); | ||
var j = 0; | ||
for (var x = void 0, i = 0; i < l; ++i) { | ||
x = a[i]; | ||
if (!f(x)) { | ||
b[j] = x; | ||
++j; | ||
} | ||
} | ||
} | ||
b.length = j; | ||
return b; | ||
b.length = j; | ||
return b; | ||
} | ||
// findIndex :: a -> [a] -> Int | ||
// find index of x in a, from the left | ||
/** | ||
* find index of x in a, from the left | ||
*/ | ||
function findIndex(x, a) { | ||
for (var i = 0, l = a.length; i < l; ++i) { | ||
if (x === a[i]) { | ||
return i; | ||
for (var i = 0, l = a.length; i < l; ++i) { | ||
if (x === a[i]) { | ||
return i; | ||
} | ||
} | ||
} | ||
return -1; | ||
return -1; | ||
} | ||
// isArrayLike :: * -> boolean | ||
// Return true iff x is array-like | ||
/** | ||
* Return true iff x is array-like | ||
*/ | ||
function isArrayLike(x) { | ||
return x != null && typeof x.length === 'number' && typeof x !== 'function'; | ||
return x != null && typeof x.length === 'number' && typeof x !== 'function'; | ||
} | ||
/** @license MIT License (c) copyright 2010-2016 original author or authors */ | ||
// id :: a -> a | ||
var id = function id(x) { | ||
return x; | ||
}; | ||
// compose :: (b -> c) -> (a -> b) -> (a -> c) | ||
var compose = function compose(f, g) { | ||
return function (x) { | ||
return f(g(x)); | ||
}; | ||
}; | ||
// apply :: (a -> b) -> a -> b | ||
var apply = function apply(f, x) { | ||
return f(x); | ||
}; | ||
// curry2 :: ((a, b) -> c) -> (a -> b -> c) | ||
var id = function (x) { return x; }; | ||
var compose = function (f, g) { return function (x) { return f(g(x)); }; }; | ||
var apply = function (f, x) { return f(x); }; | ||
function curry2(f) { | ||
function curried(a, b) { | ||
switch (arguments.length) { | ||
case 0: | ||
return curried; | ||
case 1: | ||
return function (b) { | ||
return f(a, b); | ||
}; | ||
default: | ||
return f(a, b); | ||
function curried(a, b) { | ||
switch (arguments.length) { | ||
case 0: return curried; | ||
case 1: return function (b) { return f(a, b); }; | ||
default: return f(a, b); | ||
} | ||
} | ||
} | ||
return curried; | ||
return curried; | ||
} | ||
// curry3 :: ((a, b, c) -> d) -> (a -> b -> c -> d) | ||
function curry3(f) { | ||
function curried(a, b, c) { | ||
// eslint-disable-line complexity | ||
switch (arguments.length) { | ||
case 0: | ||
return curried; | ||
case 1: | ||
return curry2(function (b, c) { | ||
return f(a, b, c); | ||
}); | ||
case 2: | ||
return function (c) { | ||
return f(a, b, c); | ||
}; | ||
default: | ||
return f(a, b, c); | ||
function curried(a, b, c) { | ||
switch (arguments.length) { | ||
case 0: return curried; | ||
case 1: return curry2(function (b, c) { return f(a, b, c); }); | ||
case 2: return function (c) { return f(a, b, c); }; | ||
default: return f(a, b, c); | ||
} | ||
} | ||
} | ||
return curried; | ||
return curried; | ||
} | ||
// curry4 :: ((a, b, c, d) -> e) -> (a -> b -> c -> d -> e) | ||
function curry4(f) { | ||
function curried(a, b, c, d) { | ||
// eslint-disable-line complexity | ||
switch (arguments.length) { | ||
case 0: | ||
return curried; | ||
case 1: | ||
return curry3(function (b, c, d) { | ||
return f(a, b, c, d); | ||
}); | ||
case 2: | ||
return curry2(function (c, d) { | ||
return f(a, b, c, d); | ||
}); | ||
case 3: | ||
return function (d) { | ||
return f(a, b, c, d); | ||
}; | ||
default: | ||
return f(a, b, c, d); | ||
function curried(a, b, c, d) { | ||
switch (arguments.length) { | ||
case 0: return curried; | ||
case 1: return curry3(function (b, c, d) { return f(a, b, c, d); }); | ||
case 2: return curry2(function (c, d) { return f(a, b, c, d); }); | ||
case 3: return function (d) { return f(a, b, c, d); }; | ||
default: return f(a, b, c, d); | ||
} | ||
} | ||
} | ||
return curried; | ||
return curried; | ||
} | ||
/** @license MIT License (c) copyright 2016 original author or authors */ | ||
export { cons, append, drop, tail, copy, map, reduce, replace, remove, removeAll, findIndex, isArrayLike, id, compose, apply, curry2, curry3, curry4 }; | ||
export { append, apply, compose, concat, cons, copy, curry2, curry3, curry4, drop, findIndex, id, isArrayLike, map, reduce, remove, removeAll, replace, tail }; | ||
//# sourceMappingURL=index.es.js.map |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(factory((global.mostPrelude = {}))); | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(global = global || self, factory(global.mostPrelude = {})); | ||
}(this, (function (exports) { 'use strict'; | ||
/** @license MIT License (c) copyright 2010-2016 original author or authors */ | ||
// Non-mutating array operations | ||
// cons :: a -> [a] -> [a] | ||
// a with x prepended | ||
function cons(x, a) { | ||
var l = a.length; | ||
var b = new Array(l + 1); | ||
b[0] = x; | ||
for (var i = 0; i < l; ++i) { | ||
b[i + 1] = a[i]; | ||
/** @license MIT License (c) copyright 2010-2016 original author or authors */ | ||
// Non-mutating array operations | ||
/** | ||
* a with x prepended | ||
*/ | ||
function cons(x, a) { | ||
var l = a.length; | ||
var b = new Array(l + 1); | ||
b[0] = x; | ||
for (var i = 0; i < l; ++i) { | ||
b[i + 1] = a[i]; | ||
} | ||
return b; | ||
} | ||
return b; | ||
} | ||
// append :: a -> [a] -> [a] | ||
// a with x appended | ||
function append(x, a) { | ||
var l = a.length; | ||
var b = new Array(l + 1); | ||
for (var i = 0; i < l; ++i) { | ||
b[i] = a[i]; | ||
/** | ||
* a with x appended | ||
*/ | ||
function append(x, a) { | ||
var l = a.length; | ||
var b = new Array(l + 1); | ||
for (var i = 0; i < l; ++i) { | ||
b[i] = a[i]; | ||
} | ||
b[l] = x; | ||
return b; | ||
} | ||
b[l] = x; | ||
return b; | ||
} | ||
// drop :: Int -> [a] -> [a] | ||
// drop first n elements | ||
function drop(n, a) { | ||
// eslint-disable-line complexity | ||
if (n < 0) { | ||
throw new TypeError('n must be >= 0'); | ||
/** | ||
* Concats two `ArrayLike`s | ||
*/ | ||
function concat(a, b) { | ||
var al = a.length; | ||
var bl = b.length; | ||
var r = new Array(al + bl); | ||
var i = 0; | ||
for (i = 0; i < al; i++) { | ||
r[i] = a[i]; | ||
} | ||
for (var j = 0; j < bl; j++) { | ||
r[i++] = b[j]; | ||
} | ||
return r; | ||
} | ||
var l = a.length; | ||
if (n === 0 || l === 0) { | ||
return a; | ||
// | ||
/** | ||
* drop first n elements | ||
*/ | ||
function drop(n, a) { | ||
if (n < 0) { | ||
throw new TypeError('n must be >= 0'); | ||
} | ||
var l = a.length; | ||
if (n === 0 || l === 0) { | ||
return a; | ||
} | ||
if (n >= l) { | ||
return []; | ||
} | ||
return unsafeDrop(n, a, l - n); | ||
} | ||
if (n >= l) { | ||
return []; | ||
/** | ||
* Internal helper for drop | ||
*/ | ||
function unsafeDrop(n, a, l) { | ||
var b = new Array(l); | ||
for (var i = 0; i < l; ++i) { | ||
b[i] = a[n + i]; | ||
} | ||
return b; | ||
} | ||
return unsafeDrop(n, a, l - n); | ||
} | ||
// unsafeDrop :: Int -> [a] -> Int -> [a] | ||
// Internal helper for drop | ||
function unsafeDrop(n, a, l) { | ||
var b = new Array(l); | ||
for (var i = 0; i < l; ++i) { | ||
b[i] = a[n + i]; | ||
/** | ||
* drop head element | ||
*/ | ||
function tail(a) { | ||
return drop(1, a); | ||
} | ||
return b; | ||
} | ||
// tail :: [a] -> [a] | ||
// drop head element | ||
function tail(a) { | ||
return drop(1, a); | ||
} | ||
// copy :: [a] -> [a] | ||
// duplicate a (shallow duplication) | ||
function copy(a) { | ||
var l = a.length; | ||
var b = new Array(l); | ||
for (var i = 0; i < l; ++i) { | ||
b[i] = a[i]; | ||
/** | ||
* duplicate a (shallow duplication) | ||
*/ | ||
function copy(a) { | ||
var l = a.length; | ||
var b = new Array(l); | ||
for (var i = 0; i < l; ++i) { | ||
b[i] = a[i]; | ||
} | ||
return b; | ||
} | ||
return b; | ||
} | ||
// map :: (a -> b) -> [a] -> [b] | ||
// transform each element with f | ||
function map(f, a) { | ||
var l = a.length; | ||
var b = new Array(l); | ||
for (var i = 0; i < l; ++i) { | ||
b[i] = f(a[i]); | ||
/** | ||
* transform each element with f | ||
*/ | ||
function map(f, a) { | ||
var l = a.length; | ||
var b = new Array(l); | ||
for (var i = 0; i < l; ++i) { | ||
b[i] = f(a[i]); | ||
} | ||
return b; | ||
} | ||
return b; | ||
} | ||
// reduce :: (a -> b -> a) -> a -> [b] -> a | ||
// accumulate via left-fold | ||
function reduce(f, z, a) { | ||
var r = z; | ||
for (var i = 0, l = a.length; i < l; ++i) { | ||
r = f(r, a[i], i); | ||
/** | ||
* accumulate via left-fold | ||
*/ | ||
function reduce(f, z, a) { | ||
var r = z; | ||
for (var i = 0, l = a.length; i < l; ++i) { | ||
r = f(r, a[i], i); | ||
} | ||
return r; | ||
} | ||
return r; | ||
} | ||
// replace :: a -> Int -> [a] | ||
// replace element at index | ||
function replace(x, i, a) { | ||
// eslint-disable-line complexity | ||
if (i < 0) { | ||
throw new TypeError('i must be >= 0'); | ||
/** | ||
* replace element at index | ||
*/ | ||
function replace(x, i, a) { | ||
if (i < 0) { | ||
throw new TypeError('i must be >= 0'); | ||
} | ||
var l = a.length; | ||
var b = new Array(l); | ||
for (var j = 0; j < l; ++j) { | ||
b[j] = i === j ? x : a[j]; | ||
} | ||
return b; | ||
} | ||
var l = a.length; | ||
var b = new Array(l); | ||
for (var j = 0; j < l; ++j) { | ||
b[j] = i === j ? x : a[j]; | ||
/** | ||
* remove element at index | ||
* @throws | ||
*/ | ||
function remove(i, a) { | ||
if (i < 0) { | ||
throw new TypeError('i must be >= 0'); | ||
} | ||
var l = a.length; | ||
if (l === 0 || i >= l) { // exit early if index beyond end of array | ||
return a; | ||
} | ||
if (l === 1) { // exit early if index in bounds and length === 1 | ||
return []; | ||
} | ||
return unsafeRemove(i, a, l - 1); | ||
} | ||
return b; | ||
} | ||
// remove :: Int -> [a] -> [a] | ||
// remove element at index | ||
function remove(i, a) { | ||
// eslint-disable-line complexity | ||
if (i < 0) { | ||
throw new TypeError('i must be >= 0'); | ||
/** | ||
* Internal helper to remove element at index | ||
*/ | ||
function unsafeRemove(i, a, l) { | ||
var b = new Array(l); | ||
var j; | ||
for (j = 0; j < i; ++j) { | ||
b[j] = a[j]; | ||
} | ||
for (j = i; j < l; ++j) { | ||
b[j] = a[j + 1]; | ||
} | ||
return b; | ||
} | ||
var l = a.length; | ||
if (l === 0 || i >= l) { | ||
// exit early if index beyond end of array | ||
return a; | ||
/** | ||
* remove all elements matching a predicate | ||
* @deprecated | ||
*/ | ||
function removeAll(f, a) { | ||
var l = a.length; | ||
var b = new Array(l); | ||
var j = 0; | ||
for (var x = void 0, i = 0; i < l; ++i) { | ||
x = a[i]; | ||
if (!f(x)) { | ||
b[j] = x; | ||
++j; | ||
} | ||
} | ||
b.length = j; | ||
return b; | ||
} | ||
if (l === 1) { | ||
// exit early if index in bounds and length === 1 | ||
return []; | ||
/** | ||
* find index of x in a, from the left | ||
*/ | ||
function findIndex(x, a) { | ||
for (var i = 0, l = a.length; i < l; ++i) { | ||
if (x === a[i]) { | ||
return i; | ||
} | ||
} | ||
return -1; | ||
} | ||
return unsafeRemove(i, a, l - 1); | ||
} | ||
// unsafeRemove :: Int -> [a] -> Int -> [a] | ||
// Internal helper to remove element at index | ||
function unsafeRemove(i, a, l) { | ||
var b = new Array(l); | ||
var j = void 0; | ||
for (j = 0; j < i; ++j) { | ||
b[j] = a[j]; | ||
/** | ||
* Return true iff x is array-like | ||
*/ | ||
function isArrayLike(x) { | ||
return x != null && typeof x.length === 'number' && typeof x !== 'function'; | ||
} | ||
for (j = i; j < l; ++j) { | ||
b[j] = a[j + 1]; | ||
} | ||
return b; | ||
} | ||
// removeAll :: (a -> boolean) -> [a] -> [a] | ||
// remove all elements matching a predicate | ||
// @deprecated | ||
function removeAll(f, a) { | ||
var l = a.length; | ||
var b = new Array(l); | ||
var j = 0; | ||
for (var x, i = 0; i < l; ++i) { | ||
x = a[i]; | ||
if (!f(x)) { | ||
b[j] = x; | ||
++j; | ||
} | ||
/** @license MIT License (c) copyright 2010-2016 original author or authors */ | ||
var id = function (x) { return x; }; | ||
var compose = function (f, g) { return function (x) { return f(g(x)); }; }; | ||
var apply = function (f, x) { return f(x); }; | ||
function curry2(f) { | ||
function curried(a, b) { | ||
switch (arguments.length) { | ||
case 0: return curried; | ||
case 1: return function (b) { return f(a, b); }; | ||
default: return f(a, b); | ||
} | ||
} | ||
return curried; | ||
} | ||
b.length = j; | ||
return b; | ||
} | ||
// findIndex :: a -> [a] -> Int | ||
// find index of x in a, from the left | ||
function findIndex(x, a) { | ||
for (var i = 0, l = a.length; i < l; ++i) { | ||
if (x === a[i]) { | ||
return i; | ||
} | ||
function curry3(f) { | ||
function curried(a, b, c) { | ||
switch (arguments.length) { | ||
case 0: return curried; | ||
case 1: return curry2(function (b, c) { return f(a, b, c); }); | ||
case 2: return function (c) { return f(a, b, c); }; | ||
default: return f(a, b, c); | ||
} | ||
} | ||
return curried; | ||
} | ||
return -1; | ||
} | ||
// isArrayLike :: * -> boolean | ||
// Return true iff x is array-like | ||
function isArrayLike(x) { | ||
return x != null && typeof x.length === 'number' && typeof x !== 'function'; | ||
} | ||
/** @license MIT License (c) copyright 2010-2016 original author or authors */ | ||
// id :: a -> a | ||
var id = function id(x) { | ||
return x; | ||
}; | ||
// compose :: (b -> c) -> (a -> b) -> (a -> c) | ||
var compose = function compose(f, g) { | ||
return function (x) { | ||
return f(g(x)); | ||
}; | ||
}; | ||
// apply :: (a -> b) -> a -> b | ||
var apply = function apply(f, x) { | ||
return f(x); | ||
}; | ||
// curry2 :: ((a, b) -> c) -> (a -> b -> c) | ||
function curry2(f) { | ||
function curried(a, b) { | ||
switch (arguments.length) { | ||
case 0: | ||
return curried; | ||
case 1: | ||
return function (b) { | ||
return f(a, b); | ||
}; | ||
default: | ||
return f(a, b); | ||
} | ||
function curry4(f) { | ||
function curried(a, b, c, d) { | ||
switch (arguments.length) { | ||
case 0: return curried; | ||
case 1: return curry3(function (b, c, d) { return f(a, b, c, d); }); | ||
case 2: return curry2(function (c, d) { return f(a, b, c, d); }); | ||
case 3: return function (d) { return f(a, b, c, d); }; | ||
default: return f(a, b, c, d); | ||
} | ||
} | ||
return curried; | ||
} | ||
return curried; | ||
} | ||
// curry3 :: ((a, b, c) -> d) -> (a -> b -> c -> d) | ||
function curry3(f) { | ||
function curried(a, b, c) { | ||
// eslint-disable-line complexity | ||
switch (arguments.length) { | ||
case 0: | ||
return curried; | ||
case 1: | ||
return curry2(function (b, c) { | ||
return f(a, b, c); | ||
}); | ||
case 2: | ||
return function (c) { | ||
return f(a, b, c); | ||
}; | ||
default: | ||
return f(a, b, c); | ||
} | ||
} | ||
return curried; | ||
} | ||
exports.append = append; | ||
exports.apply = apply; | ||
exports.compose = compose; | ||
exports.concat = concat; | ||
exports.cons = cons; | ||
exports.copy = copy; | ||
exports.curry2 = curry2; | ||
exports.curry3 = curry3; | ||
exports.curry4 = curry4; | ||
exports.drop = drop; | ||
exports.findIndex = findIndex; | ||
exports.id = id; | ||
exports.isArrayLike = isArrayLike; | ||
exports.map = map; | ||
exports.reduce = reduce; | ||
exports.remove = remove; | ||
exports.removeAll = removeAll; | ||
exports.replace = replace; | ||
exports.tail = tail; | ||
// curry4 :: ((a, b, c, d) -> e) -> (a -> b -> c -> d -> e) | ||
function curry4(f) { | ||
function curried(a, b, c, d) { | ||
// eslint-disable-line complexity | ||
switch (arguments.length) { | ||
case 0: | ||
return curried; | ||
case 1: | ||
return curry3(function (b, c, d) { | ||
return f(a, b, c, d); | ||
}); | ||
case 2: | ||
return curry2(function (c, d) { | ||
return f(a, b, c, d); | ||
}); | ||
case 3: | ||
return function (d) { | ||
return f(a, b, c, d); | ||
}; | ||
default: | ||
return f(a, b, c, d); | ||
} | ||
} | ||
return curried; | ||
} | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
/** @license MIT License (c) copyright 2016 original author or authors */ | ||
exports.cons = cons; | ||
exports.append = append; | ||
exports.drop = drop; | ||
exports.tail = tail; | ||
exports.copy = copy; | ||
exports.map = map; | ||
exports.reduce = reduce; | ||
exports.replace = replace; | ||
exports.remove = remove; | ||
exports.removeAll = removeAll; | ||
exports.findIndex = findIndex; | ||
exports.isArrayLike = isArrayLike; | ||
exports.id = id; | ||
exports.compose = compose; | ||
exports.apply = apply; | ||
exports.curry2 = curry2; | ||
exports.curry3 = curry3; | ||
exports.curry4 = curry4; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
}))); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@most/prelude", | ||
"version": "1.7.3", | ||
"version": "1.8.0", | ||
"description": "prelude", | ||
"main": "dist/index.js", | ||
"module": "dist/index.es.js", | ||
"typings": "type-definitions/index.d.ts", | ||
"typings": "dist/index.d.ts", | ||
"files": [ | ||
@@ -17,5 +17,5 @@ "dist", | ||
"prepare": "npm run build", | ||
"test": "npm run test:lint && npm run test:unit && npm run test:flow", | ||
"test:lint": "standard --fix 'src/**/*.js' 'test/**/*.js' --verbose | snazzy", | ||
"test:unit": "cross-env NODE_ENV=test nyc --reporter=text-summary mocha -r babel-register --reporter dot", | ||
"test": "npm run test:lint && npm run test:flow && npm run test:unit", | ||
"test:lint": "eslint --fix 'src/**/*.ts' 'test/**/*.ts'", | ||
"test:unit": "cross-env NODE_ENV=test nyc mocha", | ||
"test:flow": "flow check" | ||
@@ -34,15 +34,23 @@ }, | ||
"devDependencies": { | ||
"babel-core": "^6.26.3", | ||
"babel-plugin-annotate-pure-calls": "^0.2.0", | ||
"babel-plugin-external-helpers": "^6.22.0", | ||
"babel-preset-env": "^1.7.0", | ||
"babel-register": "^6.26.0", | ||
"cpy-cli": "^2.0.0", | ||
"cross-env": "^5.2.0", | ||
"flow-bin": "^0.101.0", | ||
"mocha": "^5.2.0", | ||
"nyc": "^14.1.1", | ||
"rollup": "^0.50.0", | ||
"snazzy": "^8.0.0", | ||
"standard": "^12.0.1" | ||
"@istanbuljs/nyc-config-typescript": "^1.0.0", | ||
"@types/assert": "1.4.6", | ||
"@types/mocha": "^5.2.7", | ||
"@typescript-eslint/eslint-plugin": "^1.11.0", | ||
"@typescript-eslint/parser": "^1.11.0", | ||
"cpy-cli": "^3.0.0", | ||
"cross-env": "^6.0.3", | ||
"eslint": "^6.1.0", | ||
"eslint-config-standard-with-typescript": "^8.0.0", | ||
"eslint-plugin-import": "^2.18.2", | ||
"eslint-plugin-node": "^11.0.0", | ||
"eslint-plugin-promise": "^4.2.1", | ||
"eslint-plugin-standard": "^4.0.0", | ||
"flow-bin": "0.114.0", | ||
"mocha": "^6.1.4", | ||
"nyc": "^15.0.0", | ||
"rollup": "^1.6.0", | ||
"rollup-plugin-typescript2": "^0.25.2", | ||
"source-map-support": "^0.5.12", | ||
"ts-node": "^8.3.0", | ||
"typescript": "^3.5.2" | ||
}, | ||
@@ -53,4 +61,20 @@ "standard": { | ||
"test/flow" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"plugins": [ | ||
"@typescript-eslint/eslint-plugin" | ||
] | ||
} | ||
}, | ||
"nyc": { | ||
"extends": "@istanbuljs/nyc-config-typescript", | ||
"all": true, | ||
"reporter": [ | ||
"text-summary" | ||
], | ||
"exclude": [ | ||
"dist/**", | ||
"coverage/**" | ||
] | ||
}, | ||
"gitHead": "339e6debcbb817a3712df3a2b37c99b85f5f3d09" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
46375
12
560
21
1