Created
June 10, 2014 14:12
-
-
Save chriscorwin/8d84e94b199e1b09d24f 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
| /** | |
| * Executes a function by name. | |
| */ | |
| var executeFunctionByName = function executeFunctionByName(functionName, context /*, args */ ) { | |
| var args = Array.prototype.slice.call(arguments, 2); | |
| var namespaces = functionName.split("."); | |
| var func = namespaces.pop(); | |
| for (var i = 0; i < namespaces.length; i++) { | |
| context = context[namespaces[i]]; | |
| } | |
| return context[func].apply(context, args); | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment