ncurry
1.0.0 • Public • Published 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})
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})
foo({ a: 1 })({ c: 3 })
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
Inspiration
License
MIT http://gunar.mit-license.org
Package Sidebar
Install
Weekly Downloads