Ensure _.clone and _.cloneDeep work on prototype objects.

This commit is contained in:
John-David Dalton
2016-01-28 00:45:42 -08:00
parent 7bf7ab954b
commit 03f7205e6d
2 changed files with 13 additions and 1 deletions

View File

@@ -4956,6 +4956,9 @@
* @returns {Object} Returns the initialized clone.
*/
function initCloneObject(object) {
if (isPrototype(object)) {
return {};
}
var Ctor = object.constructor;
return baseCreate(isFunction(Ctor) ? Ctor.prototype : undefined);
}