Fix tests

This commit is contained in:
Marcel Mraz 2025-04-29 22:50:15 +02:00
parent eb9b6ac837
commit 09135e827e
No known key found for this signature in database
GPG key ID: 4EBD6E62DC830CD2
11 changed files with 18432 additions and 18201 deletions

View file

@ -1233,27 +1233,3 @@ export const sizeOf = (
? value.size
: Object.keys(value).length;
};
/**
* Deep freeze an object to prevent any modifications to the object or its nested properties.
*/
export const deepFreeze = <T>(obj: T): T => {
// Return if obj is null or not an object
if (obj === null || typeof obj !== "object") {
return obj;
}
// Freeze the object itself
Object.freeze(obj);
// Freeze all properties
Object.getOwnPropertyNames(obj).forEach((prop) => {
const value = (obj as any)[prop];
if (value && typeof value === "object") {
deepFreeze(value);
}
});
return obj;
};