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}) // 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

Inspiration

License

MIT http://gunar.mit-license.org

Readme

Keywords

Package Sidebar

Install

npm i ncurry

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • gunar