Performs a deep clone of the specified variable and returns the cloned variable.

Parameters:
NameTypeDescription
value*

The value to clone.

Since
  • 3.1.0
Returns:

Returns a deep copy of the specified variable.

Type: 
*
Example
import { cloneDeep } from "@gravityforms/utils";

function Example() {
  const obj = { prop: 'val' };
  const clone = cloneDeep( obj );
}

Methods

(inner) _cloneDeepSafe(value, seen) → {*}

Performs a deep clone of the specified variable and returns the cloned variable.

Parameters:
NameTypeDescription
value*

The value to clone.

seenWeakMap

A WeakMap to handle circular references.

Since
  • 3.1.0
Returns:

Returns a deep copy of the specified variable.

Type: 
*