var token = path[index]; if(index == path.length){ tree.s.push(sub); }else{ if(typeof tree.c == "undefined"){ tree.c = {}; } if(typeof tree.c[token] == "undefined"){ tree.c[token] = { c: {}, s: [] }; this._subscribe(tree.c[token], path, index + 1, sub); }else{ this._subscribe( tree.c[token], path, index + 1, sub); } }