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