es6-simple-curry

1.0.0 • Public • Published

SIMPLE CURRY

A simple curry function.

API

const curry = require('es6-simple-curry')

// Create a curry function as follow:
const add = curry((a, b) => a + b)

// It can be called like:
add(1, 2) // => 3

// you can partially apply it too:
const add1 = add(1)
add1(2) // => 3

// Example taken from the Lodash curry implementation:

const abc = (a, b, c) => [a, b, c]
const curried = curry(abc)

curried(1)(2)(3)
// => [1, 2, 3]

curried(1, 2)(3)
// => [1, 2, 3]

curried(1, 2, 3)
// => [1, 2, 3]

// Curried with placeholders.
curried(1)(null, 3)(2)
// => [1, 2, 3]

Installation

npm install es6-simple-curry

Dependents (0)

Package Sidebar

Install

npm i es6-simple-curry

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • angarsk8