Created
April 26, 2013 05:35
-
-
Save reggi/5465234 to your computer and use it in GitHub Desktop.
broken auto define
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
| function autoDefine(name, deps) { | |
| var obj = function(){ | |
| var top_args = arguments; | |
| return function(){ | |
| var simba = {}; | |
| for (var i = deps.length-1; i >= 0; i--) { | |
| simba[deps[i]] = top_args[i]; | |
| } | |
| return simba; | |
| } | |
| } | |
| var func = obj.apply(null, deps); | |
| define(name, deps, func); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment