Created
September 9, 2013 12:48
-
-
Save j3lte/6495129 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
| /** | |
| * j3lte namespace object. | |
| * Creates the j3lte object without overriding previous instances of it. | |
| */ | |
| var j3lte = (j3lte === undefined) ? {} : j3lte; | |
| j3lte.namespace = function () { | |
| var a = arguments, o = null, i, j, d; | |
| for (i = 0; i < a.length; i = i + 1) { | |
| d = ("" + a[i]).split("."); | |
| o = j3lte; | |
| // j3lte is implied, so it is ignored if it is included | |
| for (j = (d[0] === "j3lte") ? 1 : 0; j < d.length; j = j + 1) { | |
| o[d[j]] = o[d[j]] || | |
| {}; | |
| o = o[d[j]]; | |
| } | |
| } | |
| return o; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment