Guest User

Untitled

a guest
Feb 21st, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. function defaultdict(default) {
  2. this._default = default;
  3. };
  4. defaultdict.prototype = {
  5. get: function(key) {
  6. if (!key in this) { this[key] = this._default(key); }
  7. return this[key];
  8. }
  9. }
  10.  
  11. addrs = defaultdict(function() {
  12. return defaultdict(function() {
  13. return defaultdict(function() {
  14. return [];
  15. });
  16. });
  17. });
  18.  
  19. addrs.get(ip[0]).get(ip[1]).get(ip[2]).push(text);
Add Comment
Please, Sign In to add comment