code: function extendMeta(a, b, prepend) {
    var hasOwnProperty = b && b.hasOwnProperty;
    for (var p in b) {
      if (hasOwnProperty && !b.hasOwnProperty(p))
        continue;
      var val = b[p];
      if (!(p in a))
        a[p] = val;
      else if (val instanceof Array && a[p] instanceof Array)
        a[p] = [].concat(prepend ? val : a[p]).concat(prepend ? a[p] : val);
      else if (typeof val == 'object' && val !== null && typeof a[p] == 'object')
        a[p] = extend(extend({}, a[p]), val, prepend);
      else if (!prepend)
        a[p] = val;
    }
  }
docs: meta first-level extends where: array + array appends object + object extends other properties replace