Skip to content

raineorshine/sweet-compose

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Sweet js macro for function composition

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published