Skip to content
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 support for reviving symbols #46

Merged
merged 27 commits into from
Aug 15, 2020
Merged

Add support for reviving symbols #46

merged 27 commits into from
Aug 15, 2020

Conversation

Skn0tt
Copy link
Collaborator

@Skn0tt Skn0tt commented Aug 3, 2020

Closes #45, depends on #36

Similarly to SuperJSON.registerClass introduced in #36, this PR adds support for reviving symbols using a Symbol registry: SuperJSON.registerSymbol.

Skn0tt added 24 commits July 31, 2020 11:20
While we had been trying to fit Map's semantics into JSON's object,
the solution had been in front of us all along: It's impossible!
`new Map()` takes a list of pairs and not an object, because objects are inherently
less powerful than Maps.
By also using list of pairs to describe `Map`, we finally can serialize
`Map<RegExp, V>` or `Map<{}, V>`.

See introduced tests in `index.test.ts` for reference! :D
merelinguist
merelinguist previously approved these changes Aug 5, 2020
@merelinguist
Copy link
Contributor

Nice! Almost at full JS support.

@Skn0tt Skn0tt marked this pull request as ready for review August 12, 2020 06:19
@Skn0tt Skn0tt requested a review from merelinguist August 12, 2020 06:19
@merelinguist merelinguist merged commit d8fe430 into main Aug 15, 2020
@merelinguist merelinguist deleted the revive-symbols branch August 15, 2020 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for preserving Symbols
2 participants