Optimized deepCopy & fixed cache object bugs
All checks were successful
Build / Publish Docs (push) Successful in 35s
Build / Build NPM Project (push) Successful in 49s
Build / Tag Version (push) Successful in 8s

This commit is contained in:
2025-11-18 14:03:17 -05:00
parent 057528b0c5
commit c88d96bcfa
3 changed files with 23 additions and 61 deletions

View File

@@ -82,6 +82,9 @@ export function clean<T>(obj: T, undefinedOnly = false): Partial<T> {
* @returns {T} Type
*/
export function deepCopy<T>(value: T): T {
if(value == null) return value;
const t = typeof value;
if(t === 'string' || t === 'number' || t === 'boolean' || t === 'function') return value;
try {return structuredClone(value); }
catch { return JSON.parse(JSONSanitize(value)); }
}