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