35 lines
1.4 KiB
JavaScript
35 lines
1.4 KiB
JavaScript
import { R as isPrimitive } from "./defineComponent-DB6xIcDy.js";
|
|
//#region node_modules/vuetify/lib/util/deepEqual.js
|
|
function updateRecursionCache(a, b, cache, result) {
|
|
if (!cache || isPrimitive(a) || isPrimitive(b)) return;
|
|
const visitedObject = cache.get(a);
|
|
if (visitedObject) visitedObject.set(b, result);
|
|
else {
|
|
const newCacheItem = /* @__PURE__ */ new WeakMap();
|
|
newCacheItem.set(b, result);
|
|
cache.set(a, newCacheItem);
|
|
}
|
|
}
|
|
function findCachedComparison(a, b, cache) {
|
|
if (!cache || isPrimitive(a) || isPrimitive(b)) return null;
|
|
const r1 = cache.get(a)?.get(b);
|
|
if (typeof r1 === "boolean") return r1;
|
|
const r2 = cache.get(b)?.get(a);
|
|
if (typeof r2 === "boolean") return r2;
|
|
return null;
|
|
}
|
|
function deepEqual(a, b, recursionCache = /* @__PURE__ */ new WeakMap()) {
|
|
if (a === b) return true;
|
|
if (a instanceof Date && b instanceof Date && a.getTime() !== b.getTime()) return false;
|
|
if (a !== Object(a) || b !== Object(b)) return false;
|
|
const props = Object.keys(a);
|
|
if (props.length !== Object.keys(b).length) return false;
|
|
const cachedComparisonResult = findCachedComparison(a, b, recursionCache);
|
|
if (cachedComparisonResult) return cachedComparisonResult;
|
|
updateRecursionCache(a, b, recursionCache, true);
|
|
return props.every((p) => deepEqual(a[p], b[p], recursionCache));
|
|
}
|
|
//#endregion
|
|
export { deepEqual as t };
|
|
|
|
//# sourceMappingURL=deepEqual-DDqmGqyF.js.map
|