Simple sauce for functional JavaScript: currying, partial application
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
.npmignore
LICENSE
README.md
package.json

README.md

SimpleCurry

Simple sauce for functional JavaScript: currying, partial application.

Installation

Via npm on Node:

npm install simplecurry

Usage

Reference in your program:

var _ = require('simplecurry');

// Currying a function
var add = _.curry(function (x, y) { return x + y; });

// Apply all arguments
add(1, 2); // 3

// Apply arguments one by one
add(1)(2); // 3

// Partial apply first argument
var add1 = add(1);
add1(2); // 3

// Partial apply to function
function add(x, y) { return x + y; }
var add1 = _.partial(add, 1);
add1(3); // 4

To Do

  • Adapt to browser
  • Partial apply skipping argument using _
  • Test more use cases

Development

git clone git://github.com/ajlopez/SimpleCurry.git
cd SimpleCurry
npm install
npm test

Samples

TBD

References

Versions

  • 0.0.1 Published

License

MIT

Contribution

Feel free to file issues and submit pull requests — contributions are welcome<

If you submit a pull request, please be sure to add or update corresponding test cases, and ensure that npm test continues to pass.