Closed
Description
Not sure what the desired behavior is here, but I assumed that calling _.clone
on an object created with Object.create(null)
would create a new object which does not inherit from Object.prototype
.
var obj = Object.create(null);
// typeof obj.hasOwnProperty === "undefined"
var obj2 = _.clone(obj);
// typeof obj2.hasOwnProperty === "function"
Couldn't find any prior tickets, but I could have missed something.
Activity
jdalton commentedon Jun 14, 2014
A shallow clone won't do that as it's just
_.assign({}, object)
and a deep clone is loosely based on the structured cloning algorithm and doesn't attempt to clone inheritance or lack thereof .lock commentedon Jan 21, 2019
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.