Skip to content

Instantly share code, notes, and snippets.

@FLYBYME
Created December 10, 2011 00:15
Show Gist options
  • Select an option

  • Save FLYBYME/1453944 to your computer and use it in GitHub Desktop.

Select an option

Save FLYBYME/1453944 to your computer and use it in GitHub Desktop.
var argsKeys = [];
var argsObjs = [];
for(var i = 0; i < locals.length; i++) {
argsKeys.push(locals[i].key);
argsObjs.push(locals[i].object);
};
argsKeys.push('return (' + block + ')(' + argsKeys.join(',') + ');');
var compiled = Function.apply(Function, argsKeys);
var context = {
block : block,
compiled : compiled,
run : function() {
compiled.apply(compiled, argsObjs);
return context;
}
};
return context;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment