mirror of
https://github.com/cp6/my-idlers.git
synced 2025-04-21 18:48:37 +00:00
19 lines
No EOL
444 B
JavaScript
19 lines
No EOL
444 B
JavaScript
'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);
|
|
}; |