sweet-compose
v2.0.1
Published
Sweet js macro for function composition
Downloads
10
Maintainers
Readme
sweet-compose
Sweet js macro for function composition
Usage
$ npm install --save sweet-compose
$ sjs -m sweet-compose myfile.js
var assert = require('chai').assert
it('should compose two functions', function() {
function add1(x) { return x+1; }
function double(x) { return x*2; }
assert.equal((double +. add1)(2), 6)
})
it('should sequence two functions', function() {
function add1(x) { return x+1; }
function double(x) { return x*2; }
assert.equal((double +| add1)(2), 5)
})
License
ISC © Raine Lourie