fup-curry
TypeScript icon, indicating that this package has built-in type declarations

1.0.8 • Public • Published

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:

Readme

Keywords

Package Sidebar

Install

npm i fup-curry

Weekly Downloads

0

Version

1.0.8

License

MIT

Unpacked Size

2.64 kB

Total Files

4

Last publish

Collaborators

  • dasx10