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

Deep sorting with comments? #37

Open
bbugh opened this issue Oct 2, 2022 · 1 comment
Open

Deep sorting with comments? #37

bbugh opened this issue Oct 2, 2022 · 1 comment
Labels

Comments

@bbugh
Copy link

bbugh commented Oct 2, 2022

Hi 👋🏻 thanks for a library that actually works with jsonc.

Why this feature is better to be included in comment-json? Please describe the scenario

Not exactly a feature request, or maybe it is?

assign can be used for sorting based on the README, but all of my attempts to walk the tree and produce a deep sorted result that preserves comments have ended in failure (and tears).

Provide 1-2 code examples that the usage of the new feature:

Maybe assign can take a function? or a new deepAssign that takes a function?

const sorted = deepAssign({}, parsed, (keys) => keys.sort())

Are you willing to submit a pull request to implement this rule?

If I knew what to do here, I definitely would!

@bbugh bbugh added the feature label Oct 2, 2022
@kaelzhang
Copy link
Owner

actually it is quite easy to work it out with assign

const sorted = assign({}, parsed, Object.keys(parsed).sort())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants