I have the following 2 objects in TypeScript and would like them to be considered as equal:
const obj = { 'id': 5, 'name': null };
const other = { 'id': 5 };
So the properties with 'null', 'undefined' values and not explicitly declared should be ignored. I tried Lodash _.isEqualWith but this seems not working (or I do not use it correctly):
customizer(objValue, othValue) {
if (!objValue && !othValue) {
return true;
}
return undefined;
}
_.isEqualWith(obj, other, customizer);
Any suggestions would be appreciated.