avo-inspector
Version:
[](https://badge.fury.io/js/avo-inspector)
43 lines (42 loc) • 1.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.deepEquals = exports.isValueEmpty = void 0;
var isValueEmpty = function (value) {
return value === null || value === undefined || value.trim().length == 0;
};
exports.isValueEmpty = isValueEmpty;
function deepEquals(x, y) {
if (x === y) {
return true;
}
if (!(x instanceof Object) || !(y instanceof Object)) {
return false;
}
if (x.constructor !== y.constructor) {
return false;
}
for (var p in x) {
if (!x.hasOwnProperty(p)) {
continue;
}
if (!y.hasOwnProperty(p)) {
return false;
}
if (x[p] === y[p]) {
continue;
}
if (typeof x[p] !== "object") {
return false;
}
if (!deepEquals(x[p], y[p])) {
return false;
}
}
for (p in y) {
if (y.hasOwnProperty(p) && !x.hasOwnProperty(p)) {
return false;
}
}
return true;
}
exports.deepEquals = deepEquals;