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

Use optional args for JSON.stringify and JSON.parseExn #201

Merged
merged 2 commits into from
Apr 1, 2024

Conversation

cknitt
Copy link
Member

@cknitt cknitt commented Mar 8, 2024

This would simplify the API a lot, but it would be a breaking change.

What do you think?

@cknitt cknitt requested a review from zth March 8, 2024 16:06
@zth
Copy link
Collaborator

zth commented Mar 8, 2024

Love it! If we keep the old functions around for a while but deprecate them then we can avoid breaking, right?

@cknitt
Copy link
Member Author

cknitt commented Mar 8, 2024

Love it! If we keep the old functions around for a while but deprecate them then we can avoid breaking, right?

Yes, will do that! (And also update the documentation and add some tests.)

@cknitt
Copy link
Member Author

cknitt commented Mar 8, 2024

@zth BTW, MDN docs and TypeScript typedefs call the last parameter space instead of indent. I think we should do that, too.

@cknitt cknitt force-pushed the stringify-with-opt-args branch 2 times, most recently from 9a395a0 to a4f1ec9 Compare March 30, 2024 09:19
@cknitt cknitt changed the title RFC: Use optional args for JSON.stringify and JSON.parseExn Use optional args for JSON.stringify and JSON.parseExn Mar 30, 2024
@cknitt cknitt marked this pull request as ready for review March 30, 2024 09:20
@cknitt cknitt force-pushed the stringify-with-opt-args branch 3 times, most recently from a45c9a4 to 2f7cba0 Compare March 30, 2024 09:31
@cknitt
Copy link
Member Author

cknitt commented Mar 30, 2024

@zth Ready for re-review, could you have a look?

src/Core__JSON.resi Outdated Show resolved Hide resolved
Copy link
Collaborator

@zth zth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. 2 comments:

  • Docstrings should probably be updated to match the new v11 Json representation.
  • Will this require 11.1 to play nicely with undefineds?

@cknitt cknitt force-pushed the stringify-with-opt-args branch from 2f7cba0 to 2005e5b Compare April 1, 2024 19:42
@cknitt
Copy link
Member Author

cknitt commented Apr 1, 2024

This looks good to me. 2 comments:

  • Docstrings should probably be updated to match the new v11 Json representation.

Done

  • Will this require 11.1 to play nicely with undefineds?

No, both JSON.stringify and JSON.parse work fine with undefineds.

@cknitt cknitt requested a review from zth April 1, 2024 19:45
@cknitt cknitt merged commit 6725ea4 into main Apr 1, 2024
6 checks passed
@cknitt cknitt deleted the stringify-with-opt-args branch April 1, 2024 20:07
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.

2 participants