mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 09:47:48 +00:00
Bump to v3.0.0.
This commit is contained in:
35
object/assign.js
Normal file
35
object/assign.js
Normal file
@@ -0,0 +1,35 @@
|
||||
import baseAssign from '../internal/baseAssign';
|
||||
import createAssigner from '../internal/createAssigner';
|
||||
|
||||
/**
|
||||
* Assigns own enumerable properties of source object(s) to the destination
|
||||
* object. Subsequent sources overwrite property assignments of previous sources.
|
||||
* If `customizer` is provided it is invoked to produce the assigned values.
|
||||
* The `customizer` is bound to `thisArg` and invoked with five arguments;
|
||||
* (objectValue, sourceValue, key, object, source).
|
||||
*
|
||||
* @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 {*} [thisArg] The `this` binding of `customizer`.
|
||||
* @returns {Object} Returns `object`.
|
||||
* @example
|
||||
*
|
||||
* _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' });
|
||||
* // => { 'user': 'fred', 'age': 40 }
|
||||
*
|
||||
* // using a customizer callback
|
||||
* var defaults = _.partialRight(_.assign, function(value, other) {
|
||||
* return typeof value == 'undefined' ? other : value;
|
||||
* });
|
||||
*
|
||||
* defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' });
|
||||
* // => { 'user': 'barney', 'age': 36 }
|
||||
*/
|
||||
var assign = createAssigner(baseAssign);
|
||||
|
||||
export default assign;
|
||||
Reference in New Issue
Block a user