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.

18 lines
444 B

4 years ago
  1. 'use strict';
  2. module.exports = function diffKeys(object) {
  3. var objectToDiff = void 0;
  4. if (object instanceof this.constructor) {
  5. objectToDiff = object.all();
  6. } else {
  7. objectToDiff = object;
  8. }
  9. var objectKeys = Object.keys(objectToDiff);
  10. var remainingKeys = Object.keys(this.items).filter(function (item) {
  11. return objectKeys.indexOf(item) === -1;
  12. });
  13. return new this.constructor(this.items).only(remainingKeys);
  14. };