Data Structures

lodash.cloneDeep

Replacing Lodash _.cloneDeep()

Vanilla JavaScript
const cloneDeep = (obj) => structuredClone(obj);

// Usage:
// const snapshot = cloneDeep(state);

Why Use This?

Historically, deep cloning objects in JS was notoriously difficult, requiring either heavy Lodash imports or hacky `JSON.parse(JSON.stringify(obj))` workarounds (which failed on Date and recursion). `structuredClone` is now globally available in modern runtimes!