Last active
November 30, 2017 10:47
-
-
Save MatteoOreficeIT/ac050649ccc512ca3e2c45ad9483b837 to your computer and use it in GitHub Desktop.
Short function to create namespaces in Javascript for recent browsers ( depends on jQuery and Array.prototype.reduce )
This file contains 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
$.each([ | |
'author.package1', | |
'author.package2.subpackage1', | |
'author.package3.subpackage4', | |
'author.package3.subpackage4.subpackage5', | |
],function(i,f){f.split('.').reduce(function(n,c){return n[c]||(n[c]={});},g)}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment