mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-11 11:50:54 +08:00
added _.cloneDeep definitions
This commit is contained in:
@@ -538,6 +538,11 @@ var result = <any>_.clone(stoogesAges, true, function(value) {
|
||||
return _.isElement(value) ? value.cloneNode(false) : undefined;
|
||||
});
|
||||
|
||||
var result = <any>_.cloneDeep(stoogesAges);
|
||||
var result = <any>_.cloneDeep(stoogesAges, function(value) {
|
||||
return _.isElement(value) ? value.cloneNode(false) : undefined;
|
||||
});
|
||||
|
||||
var mergeNames = {
|
||||
'stooges': [
|
||||
{ 'name': 'moe' },
|
||||
@@ -594,9 +599,6 @@ _.omit({ name: 'moe', age: 50, userid: 'moe1' }, ['name', 'age']);
|
||||
var iceCream = { flavor: "chocolate" };
|
||||
_.defaults(iceCream, { flavor: "vanilla", sprinkles: "lots" });
|
||||
|
||||
_.clone({ name: 'moe' });
|
||||
_.clone(['i', 'am', 'an', 'object!']);
|
||||
|
||||
_([1, 2, 3, 4])
|
||||
.chain()
|
||||
.filter((num: number) => {
|
||||
|
||||
Vendored
+19
@@ -2175,6 +2175,25 @@ declare module _ {
|
||||
callback?: (value: any) => any,
|
||||
thisArg?: any): T;
|
||||
|
||||
/**
|
||||
* Creates a deep clone of value. If a callback is provided it will be executed to produce the
|
||||
* cloned values. If the callback returns undefined cloning will be handled by the method instead.
|
||||
* The callback is bound to thisArg and invoked with one argument; (value).
|
||||
*
|
||||
* Note: This method is loosely based on the structured clone algorithm. Functions and DOM nodes
|
||||
* are not cloned. The enumerable properties of arguments objects and objects created by constructors
|
||||
* other than Object are cloned to plain Object objects.
|
||||
* See http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm.
|
||||
* @param value The value to clone.
|
||||
* @param callback The function to customize cloning values.
|
||||
* @param thisArg The this binding of callback.
|
||||
* @return The cloned value.
|
||||
**/
|
||||
export function cloneDeep<T>(
|
||||
value: T,
|
||||
callback?: (value: any) => any,
|
||||
thisArg?: any): T;
|
||||
|
||||
/**
|
||||
* Recursively merges own enumerable properties of the source object(s), that don't resolve
|
||||
* to undefined into the destination object. Subsequent sources will overwrite property
|
||||
|
||||
Reference in New Issue
Block a user