• Recursively merges own and inherited enumerable properties of source objects into the destination object, skipping source properties that resolve to undefined. Array and plain object properties are merged recursively. Other objects and value types are overridden by assignment. Source objects are applied from left to right. Subsequent sources overwrite property assignments of previous sources.

    Note: This method mutates object.

    Type Parameters

    • TObject
    • TSource

    Parameters

    Returns TObject & TSource

    Returns object.

    var users = {
    'data': [{ 'user': 'barney' }, { 'user': 'fred' }]
    };

    var ages = {
    'data': [{ 'age': 36 }, { 'age': 40 }]
    };

    _.merge(users, ages);
    // => { 'data': [{ 'user': 'barney', 'age': 36 }, { 'user': 'fred', 'age': 40 }] }
  • Type Parameters

    • TObject
    • TSource1
    • TSource2

    Parameters

    Returns TObject & TSource1 & TSource2

    _.merge

  • Type Parameters

    • TObject
    • TSource1
    • TSource2
    • TSource3

    Parameters

    Returns TObject & TSource1 & TSource2 & TSource3

    _.merge

  • Type Parameters

    • TObject
    • TSource1
    • TSource2
    • TSource3
    • TSource4

    Parameters

    Returns TObject & TSource1 & TSource2 & TSource3 & TSource4

    _.merge

  • Parameters

    • object: any
    • Rest...otherArgs: any[]

    Returns any

    _.merge