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.
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
feat: support parse and stringify with comments #247
base: main
Are you sure you want to change the base?
feat: support parse and stringify with comments #247
Changes from all commits
3e3d9e2
6e2190c
2e835c4
bd7f21e
77b762a
c199a7e
79f6d72
69c7264
9c83f30
040639c
8ae5a06
f17c0ee
4213a94
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this will work because the
comments
key on the returned object could have already been set in theini
text being decoded.Here's an example:
I think the best strategy here would be to follow what
json-parse-even-better-errors
does and store this data as a symbol on the returned object which can then be read back when encoding. Here's a reference to that code: https://github.com/npm/json-parse-even-better-errors/blob/9355df83b4ce4567711823fc1b40fe63dbeebba5/lib/index.js#L106-L108Another option would be new methods like
decodeWithComments
which could return a tuple of[data, comments]
which could then be passed back to a newencodeWithComments
. But I think the symbols would be a better API if that will work.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.decode