API Reference

clone-deep

Recursively clone values including arrays, objects, and regex without shared references.

Official Documentation ↗
CompatibilityThis documentation covers version v5.0.1. Check the official docs for the latest API surface.

Installation

npmnpm install clone-deep
pnpmpnpm add clone-deep

Methods

clone-deep is recursively clone values including arrays, objects, and regex without shared references.

Key Features

Installation

npm install clone-deep

Usage

FAQ

Does clone-deep mutate the input?
No, clone-deep returns new objects. Check docs for in-place variants if you need mutation.
How does clone-deep handle arrays?
By default arrays are merged by index. Pass a custom array merge function for union or overwrite behavior.
Is clone-deep safe for circular references?
Most deep utilities throw on cycles. Pre-check or use structuredClone for cyclic structures.