This little hack could be also useful: String.prototype.namespace = function(objects, scope){ scope = scope || window; this.split('.').each(function(name){ if (Object.isUndefined(scope[name])) scope[name] = {}; scope = scope[name]; });
if (objects) Object.extent(scope, objects); return scope; }; usage: 'com.mycompany.somepack'.namespace(); 'site.pixeldepo.next.namespace({ someProperty: true }); 'com.mycompany.somepack'.namespace({ someProproperty: true}, some.other.namespace); --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to prototype-core-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~----------~----~----~----~------~----~------~--~---