This repository was archived by the owner on Dec 17, 2025. It is now read-only.
Add Js.JSON.parseExnWithReviver and parseToAnyExnWithReviver#14
Open
MoOx wants to merge 4 commits into
Open
Conversation
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#syntax I had to make this binding for https://reverecre.github.io/relay-nextjs/docs/configuration#routing-integration (see end of the first example) and I think it could be here :)
Owner
|
Could you add a (and possibly add the same logic with |
Contributor
Author
|
@bloodyowl is this what you had in mind? |
bloodyowl
reviewed
May 28, 2022
Owner
|
yup! just added a small comment on a typo |
Contributor
Author
|
Fixed ! |
DZakh
reviewed
May 28, 2022
Comment on lines
10
to
+13
| @val external stringify: t => string = "JSON.stringify" | ||
| @val external stringifyWithIndent: (t, @as(json`null`) _, int) => string = "JSON.stringify" | ||
| @val external stringifyWithReplacer: (t, jsonReplacer) => string = "JSON.stringify" | ||
| @val external stringifyWithReplacerAndIndent: (t, jsonReplacer, int) => string = "JSON.stringify" |
Contributor
There was a problem hiding this comment.
Maybe it's better to have one method instead of 4:
@val external stringify: (t, ~jsonReplacer: jsonReplacer=?, ~indent: int=?, ()) => string = "JSON.stringify"@MoOx @bloodyowl what do you think?
Owner
There was a problem hiding this comment.
I'd like to avoid having an extra unit argument at the end for the general use-case, it'd make the API a feel bit weird for beginners.
Contributor
There was a problem hiding this comment.
Makes sense, also it will generate bigger js output, passing three additional undefineds when we call it with only one argument
Contributor
Author
|
I guess should be good now. |
zth
added a commit
to zth/rescript-js
that referenced
this pull request
Oct 28, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#syntax
I had to make this binding for https://reverecre.github.io/relay-nextjs/docs/configuration#routing-integration (see end of the first example) and I think it could be here :)