mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
26 lines
576 B
JavaScript
26 lines
576 B
JavaScript
/**
|
|
* Copies the properties of `source` to `object`.
|
|
*
|
|
* @private
|
|
* @param {Object} source The object to copy properties from.
|
|
* @param {Object} [object={}] The object to copy properties to.
|
|
* @param {Array} props The property names to copy.
|
|
* @returns {Object} Returns `object`.
|
|
*/
|
|
function baseCopy(source, object, props) {
|
|
if (!props) {
|
|
props = object;
|
|
object = {};
|
|
}
|
|
var index = -1,
|
|
length = props.length;
|
|
|
|
while (++index < length) {
|
|
var key = props[index];
|
|
object[key] = source[key];
|
|
}
|
|
return object;
|
|
}
|
|
|
|
export default baseCopy;
|