Skip to content

tobie/fncmp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fncmp

fncmp provides function composition in JavaScript.

This lets you write very expressive code, combining simple functions into more complex ones.

For example, instead of writing:

array.map(doStuff).map(moreStuff).map(yetMore);

or the more performant, but uglier:

array.map(function(item) {
    item = doStuff(item);
    item = moreStuff(item);
    item = yetMore(item);
    return item;
});

Just use function composition:

var compose = require("fncmp");
array.map(compose(yetMore, moreStuff, doStuff));
// Notice how functions are composed from right to left.

License

MIT

About

Just function composition for JavaScript.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages