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.

20 lines
446 B

4 years ago
  1. 'use strict';
  2. module.exports = function diffAssoc(values) {
  3. var _this = this;
  4. var diffValues = values;
  5. if (values instanceof this.constructor) {
  6. diffValues = values.all();
  7. }
  8. var collection = {};
  9. Object.keys(this.items).forEach(function (key) {
  10. if (diffValues[key] === undefined || diffValues[key] !== _this.items[key]) {
  11. collection[key] = _this.items[key];
  12. }
  13. });
  14. return new this.constructor(collection);
  15. };