Skip to content

New JSON method #6

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

Open
nmn opened this issue Apr 8, 2015 · 0 comments
Open

New JSON method #6

nmn opened this issue Apr 8, 2015 · 0 comments

Comments

@nmn
Copy link
Contributor

nmn commented Apr 8, 2015

There already seems to be a toJSON method on the prototypes of the immutable types.

There should be a new method of JSON as well.

JSON.parseImmutable

This would return an immutable values instead of a mutable one.

In case the toImmutable method is added to the prototypes, this would as simple as this, behind the scenes:

JSON.parseImmutable = (string) => JSON.parse(string).toImmutable()

The actual implementation will be smarter in that it will not throw an error if the JSON value is already immutable (string/number/bool).

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

No branches or pull requests

1 participant