saffron
An implementation of function currying in JavaScript.
Why
This was written mainly as a learning exercise.
Usage
'use strict'; var saffron = ; var { return { return x + y + z; };};console; //=> 6console; //=> 6console; //=> 6console; //=> 6
fn
can return a function, which in turn returns a function, which in turn returns another function, and so on…- There aren’t any restrictions on how the curried function receives its arguments. As above, arguments could be supplied all at a time, some at a time, or even one at a time.
API
var saffron = ;
saffron(fn [, context])
Returns a curried version of fn
.
fn
— Throws if not a function.context
— The context (ie.this
) forfn
. The context is propagated to all functions possibly “nested” infn
.
Installation
Install via npm:
$ npm i --save saffron
Changelog
- 0.1.0
- Initial release