ljharb / ljharb/json-stable-stringify
key alignment option?
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 79
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
I would really like to see a new option that aligns the keys for even more readability when pretty printing... e.g.
```js
stringify({"a": 5, "foo": true, "glue": "hello"}, {space: ' ', alignKeys: true});
```
produces something like
```
{
"a" : 5,
"foo" : true,
"glue" : "hello"
}
```
Should be an easy option to add. Maybe I'll submit a PR if I get less lazy...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the stringify entry point and inspect how the space option formats object keys. Add coverage for the alignKeys option using the example object and expected aligned output, then verify existing formatting remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100