clone-deep-with

v4.17.15arrow_drop_down
v4.17.15
v4.17.11
STATUS
Passing
DOWNLOADS
140
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
4 years ago
SIZE
N/A
This method is like `_.cloneWith` except that it recursively clones `value`.
2 contributors
Install clone-deep-with as a package?
Copied
npm i @bit/lodash.lodash.clone-deep-with
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.cloud
Component Example
React
React
Vue
Angular
React Native
Add dependency... help_outline
Just
import
any of the 1 million components
and packages in Bit or NPM to the example.
import Button from '@bit/grommet.grommet.button';
import Lodash from 'lodash';
toggle layout
No preview available
modifieddraft
chevron_left
chevron_right
cloneDeepWith (
value:*,
customizer:Function?
) : *

This method is like cloneWith except that it recursively clones value. The customizer is invoked with up to four arguments (value [, index|key, object, stack]).

Example
function customizer(value) {
  if (isElement(value)) {
    return value.cloneNode(true)
  }
}

const el = cloneDeepWith(document.body, customizer)

console.log(el === document.body)
// => false
console.log(el.nodeName)
// => 'BODY'
console.log(el.childNodes.length)
// => 20
Arguments
value: *

The value to recursively clone.

customizer: Function?

The function to customize cloning.

Returns
*

Returns the deep cloned value.

Help and resources