* Copies properties of `source` to `object`. * * @private * @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
(source, props, object, customizer)
| 2803 | * @returns {Object} Returns `object`. |
| 2804 | */ |
| 2805 | function copyObject(source, props, object, customizer) { |
| 2806 | var isNew = !object; |
| 2807 | object || (object = {}); |
| 2808 | |
| 2809 | var index = -1, |
| 2810 | length = props.length; |
| 2811 | |
| 2812 | while (++index < length) { |
| 2813 | var key = props[index]; |
| 2814 | |
| 2815 | var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined; |
| 2816 | |
| 2817 | if (newValue === undefined) { |
| 2818 | newValue = source[key]; |
| 2819 | } |
| 2820 | if (isNew) { |
| 2821 | baseAssignValue(object, key, newValue); |
| 2822 | } else { |
| 2823 | assignValue(object, key, newValue); |
| 2824 | } |
| 2825 | } |
| 2826 | return object; |
| 2827 | } |
| 2828 | |
| 2829 | module.exports = copyObject; |
| 2830 |
no test coverage detected