Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function (str, noclobber) {
- var i, a = str.split("."),
- o = window,
- callthrough = false;
- if (/[^a-zA-Z.]/.test(str)) {
- //-debug start
- console.error("@namepace: not a valid namespace identifier");
- //-debug end
- return false;
- }
- for (i = 0; i < a.length; i++) {
- if (!o[a[i]]) {
- o[a[i]] = {};
- callthrough = true;
- }
- o = o[a[i]];
- }
- if ( !! noclobber) {
- return callthrough;
- }
- return true;
- }
Add Comment
Please, Sign In to add comment