feat: Utils to do bindLan and have ipv4 and ipv6 if need be

This commit is contained in:
BluJ
2023-04-27 11:22:42 -06:00
parent 353692bf55
commit c7d38fc7ce
79 changed files with 1754 additions and 1744 deletions

View File

@@ -1,19 +1,19 @@
import { object } from "ts-matches";
import { object } from "ts-matches"
export function deepEqual(...args: unknown[]) {
if (!object.test(args[args.length - 1])) return args[args.length - 1];
const objects = args.filter(object.test);
if (!object.test(args[args.length - 1])) return args[args.length - 1]
const objects = args.filter(object.test)
if (objects.length === 0) {
for (const x of args) if (x !== args[0]) return false;
return true;
for (const x of args) if (x !== args[0]) return false
return true
}
if (objects.length !== args.length) return false;
const allKeys = new Set(objects.flatMap((x) => Object.keys(x)));
if (objects.length !== args.length) return false
const allKeys = new Set(objects.flatMap((x) => Object.keys(x)))
for (const key of allKeys) {
for (const x of objects) {
if (!(key in x)) return false;
if (!deepEqual((objects[0] as any)[key], (x as any)[key])) return false;
if (!(key in x)) return false
if (!deepEqual((objects[0] as any)[key], (x as any)[key])) return false
}
}
return true;
return true
}