Skip to content

Instantly share code, notes, and snippets.

@srdjan
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save srdjan/5fbe7bbd04e771d6e548 to your computer and use it in GitHub Desktop.
Save srdjan/5fbe7bbd04e771d6e548 to your computer and use it in GitHub Desktop.
function run(ctx) {
var i;
for(i=0; i<stash.length; i++) {
if(logBefore) {
trace(stash[i], ctx);
}
stash[i](ctx);
if(logAfter) {
trace(stash[i], ctx);
}
}
}
// becomes :->
function run(ctx) {
fn.each(function(f) { fn.compose(trace(f, 'before'), f, trace(f, 'after'))(ctx); }, stash);
}
//happy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment