Skip to content

Instantly share code, notes, and snippets.

@ashanbh
Last active December 18, 2015 02:29
Show Gist options
  • Save ashanbh/5711288 to your computer and use it in GitHub Desktop.
Save ashanbh/5711288 to your computer and use it in GitHub Desktop.
Yahoo namespace function
YAHOO.namespace = function() {
var a=arguments, o=null, i, j, d;
for (i=0; i<a .length; i=i+1) {
d=a[i].split(".");
o=YAHOO; // YAHOO is implied, so it is ignored if it is included
for (j=(d[0] == "YAHOO") ? 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