Deep cloning objects defined by JSON.
Jake Verbaten
raynos2 at gmail.com
Sun Jan 22 14:40:30 PST 2012
>
> The idea here is that methods do not belong in data structures (clone
>> should be to efficiently clone data).
>>
>
> This is already too much "unfortunate" restriction.
>
> What about calculated "get" properties:
>
> > var o = {
> ... get foo() {
> ... return "foo";
> ... }
> ... },
> ... clone = JSON.parse(JSON.stringify(o));
>
> > clone
> { foo: 'foo' }
>
I don't know what the sensible choice here is. Could be either way.
Your right, restrictions are annoying.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120122/9834ec4c/attachment.html>
More information about the es-discuss
mailing list