Deep clone of object.
Like JSON.parse(JSON.stringify(obj)), but supports basic javascript types (string, number, object), Date and RegExps and cycles.
JSON.parse(JSON.stringify(obj))
Date
RegExp
Throws error if enounters object with prototype assuming that in general class instances cannot be reliably cloned by generic algorithm.
prototype
Deep clone of object.
Like
JSON.parse(JSON.stringify(obj))
, but supports basic javascript types (string, number, object),Date
andRegExp
s and cycles.Throws error if enounters object with
prototype
assuming that in general class instances cannot be reliably cloned by generic algorithm.