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
r = new Resurrect()
var O = {test : function(){console.log("cats")}}
r.stringify(O)
// => Uncaught ResurrectError {message: "Can't serialize functions."...
r.stringify(O)
// => "[]"
I'm just starting out with the library and came across this behavior while playing with it in the console. It's hard (at least at this point) for me to imagine why I'd end up calling this twice on the same object in real code, but this struck me as strange behavior.
The text was updated successfully, but these errors were encountered:
Oops, that's definitely a bug. The problem is that Resurrect is leaving
its marker on the object. When there's an exception, it doesn't clean up
after itself, so next time around it sees the marker, assumes the object
has already been seen, and skips it, hence the empty array in the
result. The cleanup should moved into a finally block so that it happens
regardless.
I'm just starting out with the library and came across this behavior while playing with it in the console. It's hard (at least at this point) for me to imagine why I'd end up calling this twice on the same object in real code, but this struck me as strange behavior.
The text was updated successfully, but these errors were encountered: