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.
19 lines
444 B
19 lines
444 B
'use strict';
|
|
|
|
module.exports = function diffKeys(object) {
|
|
var objectToDiff = void 0;
|
|
|
|
if (object instanceof this.constructor) {
|
|
objectToDiff = object.all();
|
|
} else {
|
|
objectToDiff = object;
|
|
}
|
|
|
|
var objectKeys = Object.keys(objectToDiff);
|
|
|
|
var remainingKeys = Object.keys(this.items).filter(function (item) {
|
|
return objectKeys.indexOf(item) === -1;
|
|
});
|
|
|
|
return new this.constructor(this.items).only(remainingKeys);
|
|
}; |