Comparing version 1.0.0 to 1.0.1
40
curri.js
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
(global.curri = factory()); | ||
}(this, (function () { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
typeof define === 'function' && define.amd ? define(factory) : | ||
(global = global || self, global.curri = factory()); | ||
}(this, function () { 'use strict'; | ||
/** | ||
* Function to curry any javascript method | ||
* @param {Function} fn - the target function we want to curry | ||
* @param {...[args]} acc - initial arguments | ||
* @returns {Function|*} it will return a function until the target function | ||
* will receive all of its arguments | ||
*/ | ||
function curry(fn, ...acc) { | ||
return (...args) => { | ||
args = [...acc, ...args]; | ||
/** | ||
* Function to curry any javascript method | ||
* @param {Function} fn - the target function we want to curry | ||
* @param {...[args]} acc - initial arguments | ||
* @returns {Function|*} it will return a function until the target function | ||
* will receive all of its arguments | ||
*/ | ||
function curry(fn, ...acc) { | ||
return (...args) => { | ||
args = [...acc, ...args]; | ||
return args.length < fn.length ? | ||
curry(fn, ...args) : | ||
fn(...args) | ||
return args.length < fn.length ? | ||
curry(fn, ...args) : | ||
fn(...args) | ||
} | ||
} | ||
} | ||
return curry; | ||
return curry; | ||
}))); | ||
})); |
{ | ||
"name": "curri", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Minimal curry implementation", | ||
@@ -16,3 +16,2 @@ "main": "curri.js", | ||
"files": [ | ||
"index.js", | ||
"index.next.js" | ||
@@ -25,4 +24,5 @@ ], | ||
"keywords": [ | ||
"es6", | ||
"es2015" | ||
"curry", | ||
"currying", | ||
"functional" | ||
], | ||
@@ -36,7 +36,7 @@ "author": "Gianluca Guarini <gianluca.guarini@gmail.com> (http://gianlucaguarini.com)", | ||
"devDependencies": { | ||
"@gianlucaguarini/eslint-config": "^1.0.0", | ||
"eslint": "^4.13.1", | ||
"mocha": "^4.0.1", | ||
"rollup": "^0.52.1" | ||
"@gianlucaguarini/eslint-config": "^2.0.0", | ||
"eslint": "^5.16.0", | ||
"mocha": "^6.0.2", | ||
"rollup": "^1.7.4" | ||
} | ||
} |
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
4933