-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add option preserveReferences #3
Conversation
With this option, all references within the object will be preserved. This also allows to serialize recursive structures. If needed, the resulting expression will be an iife.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 1 1
Lines 218 634 +416
Branches 49 123 +74
==========================================
+ Hits 218 634 +416 ☔ View full report in Codecov by Sentry. |
This is simpler, because it’s passed around a lot.
It’s a ton of code, so I don’t grasp it all. But some Qs:
|
❤️
I like the word “reference”, but I’m open to alternatives.
Personally I don’t think so.
The I think it makes sense to flip the default behaviour, and I like the name
I think this is the only way. I don’t think it’s pretty, but practically I think it doesn’t really matter for most use cases. |
This way we don’t have to pass context around.
Huh? I thought the docs said the inverse? GH-2 is asking about I think we talked about this in DMs but mentioning it here to be sure: I’ve investigated how to do that too, but safely, and it’s not possible except when you stick to math (
Maybe https://github.com/estree/estree/blob/master/experimental/do-expressions.md? |
Yes, this is correct. I was confused because you singled out
Hmm yes, I think
Absolutely! But only if https://github.com/tc39/proposal-do-expressions reached stage 4 and is widely supported. |
lgtm btw, I don’t have blockers |
The new algorithm avoids variable declarations and statements as much as possible.
With this option, all references within the object will be preserved. This also allows to serialize recursive structures. If needed, the resulting expression will be an iife.