Curry a binary function.
yarn add curry2
npm install curry2 --save
You can also use Duo, Bower or download the files manually.
var curry2 = require('curry2')
var add = curry2(function (a, b) {
return a + b
})
add(5, 2)
//=> 7
var add10 = add(10)
add10(5)
//=> 15
[100, 200, 300].map(add10)
//=> [ 110, 210, 310 ]
var orig = add.uncurry()
typeof orig
//=> 'function'
orig.length
//=> 2
- Binary functions...that's it.
- Will always be less than 20 LOC (not including comments).
- No dependencies.
- Will not attempt to curry n-ary functions.
- Will never
eval
your functions.
- You will lose
fn.name
.
fn: (Function)
Binary function to curry.[self]: (Object)
Functionthis
context.
(Function|*)
If partially applied, return unary function, otherwise, return result of full application..
(Function)
returns original function.
SEE: contributing.md