Created
September 4, 2015 16:25
-
-
Save mikeon/085545f9d628dd33c38e 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 HelloWorldApp = HelloWorldApp || {}; | |
| HelloWorldApp.namespace = function (nameSpaceAsString) { | |
| var parts = nameSpaceAsString.split('.'), | |
| parent = HelloWorldApp, | |
| i; | |
| if (parts[0] === "HelloWorldApp") { | |
| parts = parts.slice(1); | |
| } | |
| for (i = 0; i < parts.length; i = i + 1) { | |
| if (typeof parent[parts[i]] === 'undefined') { | |
| parent[parts[i]] = {}; | |
| } | |
| parent = parent[parts[i]]; | |
| } | |
| return parent; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment