Files
qitech-control/electron/src/lib/objects.ts
T
dependabot[bot] acbeb98f4f Upgrade to zod v4.
To make this work, I lot if typescript types had to be fixed.
In general, they became a little simpler, so the update is worth it.
Also removes zod-adapter and upgrades zod-validation-error to work with zod v4.

From depbot:

Bumps [zod](https://github.com/colinhacks/zod) from 3.25.76 to 4.3.4.
- [Release notes](https://github.com/colinhacks/zod/releases)
- [Commits](https://github.com/colinhacks/zod/compare/v3.25.76...v4.3.4)

---
updated-dependencies:
- dependency-name: zod
  dependency-version: 4.3.4
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-14 21:51:23 +01:00

52 lines
919 B
TypeScript

export function deepEquals(
a: object | undefined,
b: object | undefined,
): boolean {
if (a === b) {
return true;
}
if (!a || typeof a !== "object" || !b || typeof b !== "object") {
return a === b;
}
if (Array.isArray(a) && Array.isArray(b)) {
if (a.length !== b.length) {
return false;
}
for (let i = 0; i < a.length; i++) {
if (!deepEquals(a[i], b[i])) {
return false;
}
}
return true;
}
if (Array.isArray(a) || Array.isArray(b)) {
return false;
}
const aKeys = Object.keys(a);
const bKeys = Object.keys(b);
const aRec = a as Record<string, any>;
const bRec = b as Record<string, any>;
if (aKeys.length !== bKeys.length) {
return false;
}
for (const key of aKeys) {
if (!(key in bRec)) {
return false;
}
if (!deepEquals(aRec[key], bRec[key])) {
return false;
}
}
return true;
}