Skip to content

deepClone

@tsed/core

Usage

typescript
import { deepClone } from "@tsed/core";

See /packages/core/src/utils/deepClone.ts.

Overview

ts
const deepClone: (source: any, stack?: WeakMap<WeakKey, any>) => any;

Description

Creates a deep clone of the provided value, preserving prototype chains and handling circular references.

Supports primitives, dates, regular expressions, typed arrays, buffers, maps, sets, and plain objects. Uses a WeakMap to track and handle circular references correctly.

Released under the MIT License.