-
-
Notifications
You must be signed in to change notification settings - Fork 23
Fixes #25 Add support for stringifying event data with a maxDepth #127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
aaf2b06
to
a65e7a7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good.
switch (typeof value) { | ||
case "function": | ||
return true; | ||
case "object": | ||
switch (Object.prototype.toString.call(value)) { | ||
case "[object AsyncGenerator]": | ||
case "[object Generator]": | ||
case "[object ArrayBuffer]": | ||
case "[object Buffer]": | ||
case "[object DataView]": | ||
case "[object Promise]": | ||
case "[object WeakMap]": | ||
case "[object WeakSet]": | ||
return true; | ||
} | ||
|
||
// Check for buffer; | ||
if ("writeBigInt64LE" in value) { | ||
return true; | ||
} | ||
|
||
break; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure seems like we'd be better off having a list of things that we allow vs trying to keep an exhaustive list of unsupported types when new types can be added and probably different runtimes have different built in types as well. There are only so many intrinsic types that we should support.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we can work towards improving this. I'm assuming there will be more types over time, and we will need to optimize this some.
We added the most robust stringify and prune implementation out there. At minimum it's 12x all other implementations.