Skip to main content
Module

x/lodash_es/mod.ts>cloneWith

lodash for deno use
Latest
function cloneWith
import { cloneWith } from "https://deno.land/x/lodash_es@v0.0.2/mod.ts";

This method is like _.clone except that it accepts customizer which is invoked to produce the cloned value. If customizer returns undefined, cloning is handled by the method instead. The customizer is invoked with up to four arguments; (value [, index|key, object, stack]).

Examples

function customizer(value) { if (_.isElement(value)) { return value.cloneNode(false); } }

var el = _.cloneWith(document.body, customizer);

console.log(el === document.body); // => false console.log(el.nodeName); // => 'BODY' console.log(el.childNodes.length); // => 0

Parameters

value

The value to clone.

customizer