doc.yeswiki.pro/node_modules/@algolia/autocomplete-shared/dist/esm/isEqual.js
2023-05-20 19:38:02 +03:00

31 lines
No EOL
655 B
JavaScript

function isPrimitive(obj) {
return obj !== Object(obj);
}
export function isEqual(first, second) {
if (first === second) {
return true;
}
if (isPrimitive(first) || isPrimitive(second) || typeof first === 'function' || typeof second === 'function') {
return first === second;
}
if (Object.keys(first).length !== Object.keys(second).length) {
return false;
}
for (var _i = 0, _Object$keys = Object.keys(first); _i < _Object$keys.length; _i++) {
var key = _Object$keys[_i];
if (!(key in second)) {
return false;
}
if (!isEqual(first[key], second[key])) {
return false;
}
}
return true;
}