Posted By

remysharp on 02/04/08


Tagged

textmate namespace


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

adix


JavaScript namespaces


 / Published in: JavaScript
 

  1. String.prototype.namespace = function(separator) {
  2. var ns = this.split(separator || '.'), p = window;
  3. for (i = 0; i < ns.length; i++) {
  4. p = p[ns[i]] = p[ns[i]] || {};
  5. }
  6. };

Report this snippet  

You need to login to post a comment.