/curry-n

Curry a function with specified arity

Primary LanguageJavaScriptMIT LicenseMIT

curry-n

Travis Build NPM Version Bithound Status License

Curry a function with specified arity

Install

npm i -S curry-n

Usage

const curryN = require('curry-n')

const curried = curryN(3, function(...args) {
    console.log(...args)
})

curried(1, 2, 3)
curried(1)(2)(3)

const curriedThis = curryN(3, function(...args) {
    console.log(this, ...args)
})

curriedThis.call({some: 'this arg'})(1)(2, 3)
curriedThis(1, 2).call('some this arg')(3)

Dev

git clone https://github.com/nhz-io/curry-n
cd curry-n
npm i
npm start

Coverage

npm run coverage
npm run report

License

MIT