You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.
In working with the botkit I was trying to pass some custom middleware some Symbols on the message object. By the time the middleware gets them, the Symbols have all been nulled out.
Turns out that's because the cloneMessage method on Conversation uses JSON.parse and JSON.stringify to deep clone the message object. This method is great and really fast, except it discards values that aren't JSON-compatible, like Dates and Symbols and Functions. Not cool, man, not cool.
The text was updated successfully, but these errors were encountered:
drhayes
changed the title
Conversation.cloneMessage throws away Symbol and Date objects
Conversation.cloneMessage throws away Symbol and Date objects
Oct 12, 2016
In working with the botkit I was trying to pass some custom middleware some
Symbol
s on the message object. By the time the middleware gets them, theSymbol
s have all beennull
ed out.Turns out that's because the
cloneMessage
method on Conversation usesJSON.parse
andJSON.stringify
to deep clone the message object. This method is great and really fast, except it discards values that aren't JSON-compatible, likeDate
s andSymbol
s andFunction
s. Not cool, man, not cool.The text was updated successfully, but these errors were encountered: