code: function (a, b) {
    if (a) {
      if (Array.isArray(b)) {
        for (var i = 0; i < b.length; i++) {
          if (b[i]) {
            a[i] = extend(a[i], b[i]);
          }
        }
        return a;
      } else if (typeof b === 'object') {
        Object.getOwnPropertyNames(b).forEach(function (key) {
          a[key] = extend(a[key], b[key]);
        });
        return a;
      }
    }
    return b;
  }
docs: Deep recursive merge