Created
December 10, 2011 00:15
-
-
Save FLYBYME/1453944 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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