blob: ea0dad18f610c0da17c074c111f736c4269c38f3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
function compareObjects(ref, obj) {
if (!isObject(ref) || !isObject(obj)) {
return ref === obj;
}
for (const key in ref) {
if (!Object.prototype.hasOwnProperty.call(ref, key)) {
continue;
}
if (!Object.prototype.hasOwnProperty.call(obj, key)) {
return false;
}
if (!compareObjects(ref[key], obj[key])) {
return false;
}
}
return true;
}
function isObject(object) {
return object !== null && typeof object === 'object';
}
|