ncurry
v1.0.0
Published
Curry for named arguments
Downloads
3
Readme
ncurry
Curry for named arguments.
Usage
var curry = require('ncurry')
const foo = curry(
['a', 'b', 'c'],
({a, b, c}) =>
a + b + c)
foo({ a: 1 })({ b: 2, c: 3}) // 6
Accepts optional arguments
var curry = require('ncurry')
const foo = curry(
['a', 'c'],
({a, b, c}) =>
a + b + c)
foo({ a: 1 })({ b: 2, c: 3}) // 6
foo({ a: 1 })({ c: 3 }) // 4
Partial application works too
cont { partial } = require('lodash/fp')
const partiallyApplied = partial(foo)([{ a: 1 }])
const actual = partiallyApplied({ b: 2 })({ c: 4 })
const expected = 7