Skip to content

g-harel/slurry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

slurry

slurry code style: prettier

automagically curry function arguments

Slurrified functions can be chain-called indefinitely to accumulate the passed arguments.

Calling with no arguments ends the chain, runs the initial function with all the arguments and returns the result.

Install

$ npm install slurry

Usage

const func = (...args) => args;
const s = slurry(func);

s(0)(1)(2)();   //=> [0 1 2]
s(0, 1, 2)();   //=> [0 1 2]
s(0, 1)(2)();   //=> [0 1 2]

let s1 =  s(1);
let s2 = s1(2);
let s3 = s1(3);
s2();           //=> [1, 2]
s3();           //=> [1, 3]

About

automagically curry function arguments

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published