Clone based on JSON Operations

node v0.12.18
version: 1.0.0
endpointsharetweet
function clone(obj) { return JSON.parse(JSON.stringify(obj)) } var fixture = { foo: new Date() } var copy = clone(fixture) // doesn't works fine with Dates! console.log(fixture) console.log(copy)
Loading…

no comments

    sign in to comment