MCPcopy Create free account
hub / github.com/RubyLouvre/anu / copyObject

Function copyObject

test/babel.js:2805–2827  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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

Callers 6

babel.jsFile · 0.85
baseAssignFunction · 0.85
baseAssignInFunction · 0.85
copySymbolsFunction · 0.85
copySymbolsInFunction · 0.85
toPlainObjectFunction · 0.85

Calls 2

baseAssignValueFunction · 0.85
assignValueFunction · 0.85

Tested by

no test coverage detected