Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Proposal: patch function for editing JSON5 while preserving comments (WIP)#262

Draft
giacomorebonato wants to merge7 commits intojson5:main
base:main
Choose a base branch
Loading
fromgiacomorebonato:adds_patching

Conversation

giacomorebonato
Copy link

@giacomorebonatogiacomorebonato commentedMar 7, 2022
edited
Loading

This branch adds apatch function to the public API.

Its purpose is to allow the editing of a JSON5 object while preserving the comments in the file.
The API works like this.

letjson5Text=`  {    hello: 'world' // this is a comment  }`json5.patch(json5Text,{hello:'world',my:'friend'})/* returns a string like this`  {    hello: 'world', // this is a comment    my: 'friend'  }`*/

Note that the comment is still present in the string. The above example is the most simple I can imagine, but it should work in many other cases that I mean to cover in the tests.

What do you think? Would you be welcoming such an addition@jordanbtucker ?
Happy to ultimate the work if so and I'll close the PR if you believe that it's out of the scope of this library.

Mentioning that:

bbugh, ds300, benpankow, and roncohen reacted with thumbs up emoji
@giacomorebonatogiacomorebonato changed the titleProposal: add a patch function for editing while preserving comments (WIP)Proposal: patch function for editing JSON5 while preserving comments (WIP)Mar 7, 2022
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@giacomorebonato

[8]ページ先頭

©2009-2025 Movatter.jp