mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 16:47:49 +00:00
Bump to v4.11.0.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import copyObjectWith from './_copyObjectWith';
|
||||
import assignValue from './_assignValue';
|
||||
|
||||
/**
|
||||
* Copies properties of `source` to `object`.
|
||||
@@ -7,10 +7,25 @@ import copyObjectWith from './_copyObjectWith';
|
||||
* @param {Object} source The object to copy properties from.
|
||||
* @param {Array} props The property identifiers to copy.
|
||||
* @param {Object} [object={}] The object to copy properties to.
|
||||
* @param {Function} [customizer] The function to customize copied values.
|
||||
* @returns {Object} Returns `object`.
|
||||
*/
|
||||
function copyObject(source, props, object) {
|
||||
return copyObjectWith(source, props, object);
|
||||
function copyObject(source, props, object, customizer) {
|
||||
object || (object = {});
|
||||
|
||||
var index = -1,
|
||||
length = props.length;
|
||||
|
||||
while (++index < length) {
|
||||
var key = props[index];
|
||||
|
||||
var newValue = customizer
|
||||
? customizer(object[key], source[key], key, object, source)
|
||||
: source[key];
|
||||
|
||||
assignValue(object, key, newValue);
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
export default copyObject;
|
||||
|
||||
Reference in New Issue
Block a user