Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Don't use JSON.parse/stringify to clone. #440

Merged
merged 1 commit into from
Nov 7, 2016
Merged

Conversation

drhayes
Copy link
Contributor

@drhayes drhayes commented Oct 12, 2016

Fixes #439.

Uses the clone npm package to provide a deep clone. This probably has performance implications since JSON.parse(JSON.stringify(thing)) is super fast, but I don't think the original implementation meant to throw away Date and Symbol objects.

@ianp
Copy link

ianp commented Nov 4, 2016

You could call it as clone(message, true) to get better performance, because stringily/parse would fail with circular references in any case.

Other than that, this looks good to me to merge.

@benbrown benbrown merged commit 47ea1ef into howdyai:master Nov 7, 2016
@benbrown
Copy link
Contributor

benbrown commented Nov 7, 2016

Thanks @drhayes @ianp!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants