1 var assignValue = require('./_assignValue');
4 * This function is like `copyObject` except that it accepts a function to
5 * customize copied values.
8 * @param {Object} source The object to copy properties from.
9 * @param {Array} props The property names to copy.
10 * @param {Object} [object={}] The object to copy properties to.
11 * @param {Function} [customizer] The function to customize copied values.
12 * @returns {Object} Returns `object`.
14 function copyObjectWith(source, props, object, customizer) {
15 object || (object = {});
18 length = props.length;
20 while (++index < length) {
21 var key = props[index],
22 newValue = customizer ? customizer(object[key], source[key], key, object, source) : source[key];
24 assignValue(object, key, newValue);
29 module.exports = copyObjectWith;