mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
added _.merge definitions
This commit is contained in:
@@ -502,6 +502,45 @@ var optionsPartialRight = {
|
||||
defaultsDeep(optionsPartialRight, _.templateSettings);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**********
|
||||
* Objects *
|
||||
***********/
|
||||
var mergeNames = {
|
||||
'stooges': [
|
||||
{ 'name': 'moe' },
|
||||
{ 'name': 'larry' }
|
||||
]
|
||||
};
|
||||
|
||||
var mergeAges = {
|
||||
'stooges': [
|
||||
{ 'age': 40 },
|
||||
{ 'age': 50 }
|
||||
]
|
||||
};
|
||||
|
||||
_.merge(mergeNames, mergeAges);
|
||||
// → { 'stooges': [{ 'name': 'moe', 'age': 40 }, { 'name': 'larry', 'age': 50 }] }
|
||||
|
||||
var mergeFood = {
|
||||
'fruits': ['apple'],
|
||||
'vegetables': ['beet']
|
||||
};
|
||||
|
||||
var mergeOtherFood = {
|
||||
'fruits': ['banana'],
|
||||
'vegetables': ['carrot']
|
||||
};
|
||||
|
||||
_.merge(mergeFood, mergeOtherFood, function(a, b) {
|
||||
return _.isArray(a) ? a.concat(b) : undefined;
|
||||
});
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
//WHAT'S LEFT
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Vendored
+113
-1
@@ -1905,7 +1905,119 @@ declare module _ {
|
||||
|
||||
|
||||
|
||||
|
||||
/**********
|
||||
* Objects *
|
||||
***********/
|
||||
|
||||
/**
|
||||
* 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
|
||||
* assignments of previous sources. If a callback is provided it will be executed to produce
|
||||
* the merged values of the destination and source properties. If the callback returns undefined
|
||||
* merging will be handled by the method instead. The callback is bound to thisArg and invoked
|
||||
* with two arguments; (objectValue, sourceValue).
|
||||
* @param object The destination object.
|
||||
* @param s1-8 The source object(s)
|
||||
* @param callback The function to customize merging properties.
|
||||
* @param thisArg The this binding of callback.
|
||||
* @return The destination object.
|
||||
**/
|
||||
export function merge(
|
||||
object: any,
|
||||
s1: any,
|
||||
callback?: (objectValue: any, sourceValue: any) => any,
|
||||
thisArg?: any): any;
|
||||
|
||||
/**
|
||||
* @see _.merge
|
||||
**/
|
||||
export function merge(
|
||||
object: any,
|
||||
s1: any,
|
||||
s2: any,
|
||||
callback?: (objectValue: any, sourceValue: any) => any,
|
||||
thisArg?: any): any;
|
||||
|
||||
/**
|
||||
* @see _.merge
|
||||
**/
|
||||
export function merge(
|
||||
object: any,
|
||||
s1: any,
|
||||
s2: any,
|
||||
s3: any,
|
||||
callback?: (objectValue: any, sourceValue: any) => any,
|
||||
thisArg?: any): any;
|
||||
|
||||
/**
|
||||
* @see _.merge
|
||||
**/
|
||||
export function merge(
|
||||
object: any,
|
||||
s1: any,
|
||||
s2: any,
|
||||
s3: any,
|
||||
s4: any,
|
||||
callback?: (objectValue: any, sourceValue: any) => any,
|
||||
thisArg?: any): any;
|
||||
|
||||
/**
|
||||
* @see _.merge
|
||||
**/
|
||||
export function merge(
|
||||
object: any,
|
||||
s1: any,
|
||||
s2: any,
|
||||
s3: any,
|
||||
s4: any,
|
||||
s5: any,
|
||||
callback?: (objectValue: any, sourceValue: any) => any,
|
||||
thisArg?: any): any;
|
||||
|
||||
/**
|
||||
* @see _.merge
|
||||
**/
|
||||
export function merge(
|
||||
object: any,
|
||||
s1: any,
|
||||
s2: any,
|
||||
s3: any,
|
||||
s4: any,
|
||||
s5: any,
|
||||
s6: any,
|
||||
callback?: (objectValue: any, sourceValue: any) => any,
|
||||
thisArg?: any): any;
|
||||
|
||||
/**
|
||||
* @see _.merge
|
||||
**/
|
||||
export function merge(
|
||||
object: any,
|
||||
s1: any,
|
||||
s2: any,
|
||||
s3: any,
|
||||
s4: any,
|
||||
s5: any,
|
||||
s6: any,
|
||||
s7: any,
|
||||
callback?: (objectValue: any, sourceValue: any) => any,
|
||||
thisArg?: any): any;
|
||||
|
||||
/**
|
||||
* @see _.merge
|
||||
**/
|
||||
export function merge(
|
||||
object: any,
|
||||
s1: any,
|
||||
s2: any,
|
||||
s3: any,
|
||||
s4: any,
|
||||
s5: any,
|
||||
s6: any,
|
||||
s7: any,
|
||||
s8: any,
|
||||
callback?: (objectValue: any, sourceValue: any) => any,
|
||||
thisArg?: any): any;
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user