UNPKG

codetrix

Version:

A lightweight lodash-style utility library

14 lines (13 loc) 345 B
/** * Creates a deep clone of a value (supports arrays and objects). * * @param value - The value to clone. * @returns A deep cloned copy of the input value. * * @example * const original = { a: 1, b: { c: 2 } }; * const clone = deepClone(original); */ export function deepClone(value) { return JSON.parse(JSON.stringify(value)); }