You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
326 B

4 years ago
  1. 'use strict';
  2. module.exports = function union(object) {
  3. var _this = this;
  4. var collection = JSON.parse(JSON.stringify(this.items));
  5. Object.keys(object).forEach(function (prop) {
  6. if (_this.items[prop] === undefined) {
  7. collection[prop] = object[prop];
  8. }
  9. });
  10. return new this.constructor(collection);
  11. };