8
0

baseCopy.js 543 B

1234567891011121314151617181920212223
  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. var index = -1,
  13. length = props.length;
  14. while (++index < length) {
  15. var key = props[index];
  16. object[key] = source[key];
  17. }
  18. return object;
  19. }
  20. export default baseCopy;