_initCloneObject.js 486 B

123456789101112131415161718
  1. var baseCreate = require('./_baseCreate'),
  2. getPrototype = require('./_getPrototype'),
  3. isPrototype = require('./_isPrototype');
  4. /**
  5. * Initializes an object clone.
  6. *
  7. * @private
  8. * @param {Object} object The object to clone.
  9. * @returns {Object} Returns the initialized clone.
  10. */
  11. function initCloneObject(object) {
  12. return (typeof object.constructor == 'function' && !isPrototype(object))
  13. ? baseCreate(getPrototype(object))
  14. : {};
  15. }
  16. module.exports = initCloneObject;