Skip to content

Instantly share code, notes, and snippets.

@srdjan

srdjan/refactor.js

Last active Aug 29, 2015
Embed
What would you like to do?
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
You can’t perform that action at this time.