sweet-compose

2.0.1 • Public • Published

sweet-compose

NPM version

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

Package Sidebar

Install

npm i sweet-compose

Weekly Downloads

10

Version

2.0.1

License

ISC

Last publish

Collaborators

  • raine