Skip to content

Instantly share code, notes, and snippets.

@revington
Created December 16, 2012 18:27
Show Gist options
  • Save revington/4310804 to your computer and use it in GitHub Desktop.
Save revington/4310804 to your computer and use it in GitHub Desktop.
module.exports.process = function () {
var f = arguments;
return function (initialContext) {
var ctx = initialContext || {},
i = 0,
walk = function () {
return f[i++] ||
function () {
throw new Error('can not "next()"');
};
},
getNext = function () {
return function () {
walk()(ctx, getNext());
};
};
getNext()();
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment