Skip to content

Commit

Permalink
code correction after review
Browse files Browse the repository at this point in the history
  • Loading branch information
kaidohallik committed Jun 28, 2019
1 parent 3f76cc7 commit ce3b47e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/utils/object_utils.js
Expand Up @@ -44,9 +44,17 @@ function merge(object1, object2) {
};
}

function removeEntriesWithUndefinedValue(entity) {
Object.keys(entity).forEach(key => {
if (entity[key] === undefined) {
delete entity[key];
}
});
}

function areEntitiesEqual(firstEntity, secondEntity) {
Object.keys(firstEntity).forEach(key => firstEntity[key] === undefined && delete firstEntity[key]);
Object.keys(secondEntity).forEach(key => secondEntity[key] === undefined && delete secondEntity[key]);
removeEntriesWithUndefinedValue(firstEntity);
removeEntriesWithUndefinedValue(secondEntity);
if (
firstEntity.fields.length !== secondEntity.fields.length ||
firstEntity.relationships.length !== secondEntity.relationships.length ||
Expand Down

0 comments on commit ce3b47e

Please sign in to comment.