mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 08:57:49 +00:00
Bump to v3.7.0.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import assignWith from '../internal/assignWith';
|
||||
import baseAssign from '../internal/baseAssign';
|
||||
import createAssigner from '../internal/createAssigner';
|
||||
|
||||
@@ -8,13 +9,17 @@ import createAssigner from '../internal/createAssigner';
|
||||
* The `customizer` is bound to `thisArg` and invoked with five arguments:
|
||||
* (objectValue, sourceValue, key, object, source).
|
||||
*
|
||||
* **Note:** This method mutates `object` and is based on
|
||||
* [`Object.assign`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign).
|
||||
*
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @alias extend
|
||||
* @category Object
|
||||
* @param {Object} object The destination object.
|
||||
* @param {...Object} [sources] The source objects.
|
||||
* @param {Function} [customizer] The function to customize assigning values.
|
||||
* @param {Function} [customizer] The function to customize assigned values.
|
||||
* @param {*} [thisArg] The `this` binding of `customizer`.
|
||||
* @returns {Object} Returns `object`.
|
||||
* @example
|
||||
@@ -24,12 +29,16 @@ import createAssigner from '../internal/createAssigner';
|
||||
*
|
||||
* // using a customizer callback
|
||||
* var defaults = _.partialRight(_.assign, function(value, other) {
|
||||
* return typeof value == 'undefined' ? other : value;
|
||||
* return _.isUndefined(value) ? other : value;
|
||||
* });
|
||||
*
|
||||
* defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
|
||||
* // => { 'user': 'barney', 'age': 36 }
|
||||
*/
|
||||
var assign = createAssigner(baseAssign);
|
||||
var assign = createAssigner(function(object, source, customizer) {
|
||||
return customizer
|
||||
? assignWith(object, source, customizer)
|
||||
: baseAssign(object, source);
|
||||
});
|
||||
|
||||
export default assign;
|
||||
|
||||
Reference in New Issue
Block a user