2.0.1 • Published 9 years ago

sweet-compose v2.0.1

Weekly downloads
4
License
ISC
Repository
github
Last release
9 years ago

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