Skip to content

functional composition util that maintains identity

Notifications You must be signed in to change notification settings

btford/compose-identity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Compose Identity

A functional compose util that maintains the identity of the returned function:

import compose from 'compose-identity';

const x = num => num + 1;
const y = num => num * 2;
const z = compose(x, y); // num => y(x(num))

// compose always returns the same function!
assert(z === compose(x, y));

Installation:

yarn add compose-identity

Or, less ideally:

npm install compose-identity

License

MIT

About

functional composition util that maintains identity

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published