fup-curry
v1.0.8
Published
Curry function
Downloads
2
Readme
CurryLimit
install
npm i --save fup-curry
Use
const curry = require('fup-curry');```
or es module
import curry from 'fup-curry';
Example
Core
const add = (y, x) => y + x; // function (x);
const addC = curry(addStr); // function (x);
const addA = addC("A"); // function (x);
const AB = addA("B"); // "AB";
const AC = addA("Name"); // "AC";
const ab = addC("a", "b"); // "ab";
More:
Limit
const only2Curry = curry.limit(2); // ((...arguments) => result) => (y, x) => result | (y) => (x) => result
const add = (y, x) => x + y; // (y, x) => x + y
const result = only2Curry(add, 1, 2); // 3
const add1 = only2Curry(add, 1); // (x) => x + 1
const resultAdd1 = add1(3); // 4
const addC = only2Curry(add); // (y, x) => x + y | (y) => (x) => x + y
const add4 = addC(4); // (x) => x + 4
const resultAdd4 = add4(5); // 9
More: