Skip to content

Instantly share code, notes, and snippets.

@WillsonSmith
Created December 20, 2016 22:15
Show Gist options
  • Save WillsonSmith/50a83d943f93b45bc677a0bab69ce85c to your computer and use it in GitHub Desktop.
Save WillsonSmith/50a83d943f93b45bc677a0bab69ce85c to your computer and use it in GitHub Desktop.
compose functions in JS
function compose(...funcs) {
return function (value) {
return funcs.reverse().reduce(function(previous, current) {
return previous.call(this, current(value));
});
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment