added _.assign/_.extend definitions

This commit is contained in:
Brian Zengel
2013-10-20 11:35:01 -04:00
parent ad3b58c6e7
commit 125e033185
2 changed files with 219 additions and 1 deletions
+11 -1
View File
@@ -518,9 +518,20 @@ helloWrap2();
/**********
* Objects *
***********/
_.assign({ 'name': 'moe' }, { 'age': 40 });
_.assign({ 'name': 'moe' }, { 'age': 40 }, function(a, b) {
return typeof a == 'undefined' ? b : a;
});
_.extend({ 'name': 'moe' }, { 'age': 40 });
_.extend({ 'name': 'moe' }, { 'age': 40 }, function(a, b) {
return typeof a == 'undefined' ? b : a;
});
var mergeNames = {
'stooges': [
{ 'name': 'moe' },
@@ -536,7 +547,6 @@ var mergeAges = {
};
_.merge(mergeNames, mergeAges);
// → { 'stooges': [{ 'name': 'moe', 'age': 40 }, { 'name': 'larry', 'age': 50 }] }
var mergeFood = {
'fruits': ['apple'],
+208
View File
@@ -1950,6 +1950,214 @@ declare module _ {
/**********
* Objects *
***********/
/**
* Assigns own enumerable properties of source object(s) to the destination object. Subsequent
* sources will overwrite property assignments of previous sources. If a callback is provided
* it will be executed to produce the assigned values. 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 assign(
object: any,
s1: any,
callback?: (objectValue: any, sourceValue: any) => any,
thisArg?: any): any;
/**
* @see _.assign
**/
export function assign(
object: any,
s1: any,
s2: any,
callback?: (objectValue: any, sourceValue: any) => any,
thisArg?: any): any;
/**
* @see _.assign
**/
export function assign(
object: any,
s1: any,
s2: any,
s3: any,
callback?: (objectValue: any, sourceValue: any) => any,
thisArg?: any): any;
/**
* @see _.assign
**/
export function assign(
object: any,
s1: any,
s2: any,
s3: any,
s4: any,
callback?: (objectValue: any, sourceValue: any) => any,
thisArg?: any): any;
/**
* @see _.assign
**/
export function assign(
object: any,
s1: any,
s2: any,
s3: any,
s4: any,
s5: any,
callback?: (objectValue: any, sourceValue: any) => any,
thisArg?: any): any;
/**
* @see _.assign
**/
export function assign(
object: any,
s1: any,
s2: any,
s3: any,
s4: any,
s5: any,
s6: any,
callback?: (objectValue: any, sourceValue: any) => any,
thisArg?: any): any;
/**
* @see _.assign
**/
export function assign(
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 _.assign
**/
export function assign(
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;
/**
* @see _.extend
**/
export function extend(
object: any,
s1: any,
callback?: (objectValue: any, sourceValue: any) => any,
thisArg?: any): any;
/**
* @see _.extend
**/
export function extend(
object: any,
s1: any,
s2: any,
callback?: (objectValue: any, sourceValue: any) => any,
thisArg?: any): any;
/**
* @see _.extend
**/
export function extend(
object: any,
s1: any,
s2: any,
s3: any,
callback?: (objectValue: any, sourceValue: any) => any,
thisArg?: any): any;
/**
* @see _.extend
**/
export function extend(
object: any,
s1: any,
s2: any,
s3: any,
s4: any,
callback?: (objectValue: any, sourceValue: any) => any,
thisArg?: any): any;
/**
* @see _.extend
**/
export function extend(
object: any,
s1: any,
s2: any,
s3: any,
s4: any,
s5: any,
callback?: (objectValue: any, sourceValue: any) => any,
thisArg?: any): any;
/**
* @see _.extend
**/
export function extend(
object: any,
s1: any,
s2: any,
s3: any,
s4: any,
s5: any,
s6: any,
callback?: (objectValue: any, sourceValue: any) => any,
thisArg?: any): any;
/**
* @see _.extend
**/
export function extend(
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 _.extend
**/
export function extend(
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;
/**
* Recursively merges own enumerable properties of the source object(s), that don't resolve