curry-simple

1.0.2 • Public • Published

curry

Curry a function.

Install

npm install curry-simple

Usage

const curry = require('../index.js');


const multiFn = (a, b, c) => a * b * c
var multi = curry(multiFn);
multi(2)(3)(4)) // => 24

var add = curry(function (a, b) { return a + b });
add(1, 2) // => 3
add1(2) // => 3


var zipAddWith = curry(function (a, b) {
    return a.map(function (val, i) { return val + b[i] });
});

var zipAddWith123 = zipAddWith([1, 2, 3]);

zipAddWith([1, 2, 3], [1, 2, 3]) // => [2, 3, 6]
zipAddWith123([5, 6, 7]) // => [6, 8, 10]

Package Sidebar

Install

npm i curry-simple

Weekly Downloads

3

Version

1.0.2

License

MIT

Unpacked Size

4 kB

Total Files

5

Last publish

Collaborators

  • diliburong