Commits
Click on a commit to change the comparison rangefeat: preserve newlines in comments and port sindresorhus tests
Changes to comment handling:
- Preserve \r and \n characters inside block comments (InBlockComment, MaybeCommentEnd states)
- Preserve \r characters in line comments (InLineComment state)
- This matches sindresorhus/strip-json-comments behavior and improves readability
Test additions (13 new tests from sindresorhus/strip-json-comments):
- sindresorhus_replace_comments_with_whitespace
- sindresorhus_doesnt_strip_comments_inside_strings
- sindresorhus_consider_escaped_slashes
- sindresorhus_line_endings_no_comments
- sindresorhus_line_endings_single_line_comment
- sindresorhus_line_endings_single_line_block_comment
- sindresorhus_line_endings_multi_line_block_comment
- sindresorhus_line_endings_works_at_eof
- sindresorhus_handles_weird_escaping
- sindresorhus_strips_trailing_commas
- sindresorhus_strips_trailing_commas_with_comments
- sindresorhus_handles_malformed_block_comments
- sindresorhus_handles_non_breaking_space
All 57 tests (54 integration + 3 doc tests) passing.
Ported from: https://github.com/sindresorhus/strip-json-comments/blob/main/test.js
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>