Skip to content

Instantly share code, notes, and snippets.

@amacdougall
Created April 2, 2014 16:05
Show Gist options
  • Save amacdougall/9937183 to your computer and use it in GitHub Desktop.
Save amacdougall/9937183 to your computer and use it in GitHub Desktop.
// This works, but since it has to take `n, f1, ...` instead of `n, [f1, ...]`,
// we need to do a messy concat/apply at the end.
function pipeline(n) {
var actions = rest(arguments);
if (_.isEmpty(actions)) {
return n;
} else {
return pipeline.apply(null, [first(actions)(n)].concat(rest(actions)));
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment