• This method is like _.assign except that it accepts customizer which is invoked to produce the assigned values. If customizer returns undefined assignment is handled by the method instead. The customizer is invoked with five arguments: (objValue, srcValue, key, object, source).

    Note: This method mutates object.

    Type Parameters

    • TObject
    • TSource

    Parameters

    • object: TObject

      The destination object.

    • source: TSource
    • Optionalcustomizer: AssignCustomizer

      The function to customize assigned values.

    Returns TObject & TSource

    Returns object.

    function customizer(objValue, srcValue) {
    return _.isUndefined(objValue) ? srcValue : objValue;
    }

    var defaults = _.partialRight(_.assignWith, customizer);

    defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
    // => { 'a': 1, 'b': 2 }
  • Type Parameters

    • TObject
    • TSource1
    • TSource2

    Parameters

    Returns TObject & TSource1 & TSource2

    _.assignWith

  • Type Parameters

    • TObject
    • TSource1
    • TSource2
    • TSource3

    Parameters

    Returns TObject & TSource1 & TSource2 & TSource3

    _.assignWith

  • Type Parameters

    • TObject
    • TSource1
    • TSource2
    • TSource3
    • TSource4

    Parameters

    Returns TObject & TSource1 & TSource2 & TSource3 & TSource4

    _.assignWith

  • Type Parameters

    • TObject

    Parameters

    Returns TObject

    _.assignWith

  • Type Parameters

    • TResult

    Parameters

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

    Returns TResult

    _.assignWith