Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80742 views
1
/**
2
* Copies properties of `source` to `object`.
3
*
4
* @private
5
* @param {Object} source The object to copy properties from.
6
* @param {Array} props The property names to copy.
7
* @param {Object} [object={}] The object to copy properties to.
8
* @returns {Object} Returns `object`.
9
*/
10
function baseCopy(source, props, object) {
11
object || (object = {});
12
13
var index = -1,
14
length = props.length;
15
16
while (++index < length) {
17
var key = props[index];
18
object[key] = source[key];
19
}
20
return object;
21
}
22
23
module.exports = baseCopy;
24
25