Skip to content

Commit

Permalink
Merge pull request #18 from mbland/1.0.3-check-comma-first
Browse files Browse the repository at this point in the history
Bump to v1.0.3, tweak stripJsonComments()
  • Loading branch information
mbland authored Jan 1, 2024
2 parents a3a41ff + 1f73de0 commit 9d3677a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Running the wrapper will generate the local `file://` URL to the generated
`index.html` file, e.g.:

```text
file:///path/to/jsdoc/output/jsdoc-cli-wrapper/1.0.0/index.html
file:///path/to/jsdoc/output/jsdoc-cli-wrapper/1.0.3/index.html
```

You can click on or copy this link to open it in your browser. You can also open
Expand Down Expand Up @@ -99,10 +99,10 @@ This wrapper resolves both of these minor annoyances.
```sh
$ pnpm jsdoc

> [email protected].1 jsdoc /path/to/jsdoc-cli-wrapper
> [email protected].3 jsdoc /path/to/jsdoc-cli-wrapper
> node index.js -c jsdoc.json .

file:///path/to/jsdoc-cli-wrapper/jsdoc/jsdoc-cli-wrapper/1.0.0/index.html
file:///path/to/jsdoc-cli-wrapper/jsdoc/jsdoc-cli-wrapper/1.0.3/index.html
```

Of course, your own project would use `jsdoc-cli-wrapper` instead of `node
Expand Down
4 changes: 3 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,12 @@ export function stripJsonComments(str) {
comment = (c === '/') ? 'line' : 'block'
c = result[i-1] = ' '
}
} else if (c === ',') {
comma = i
} else { // outside any valid string or comment, replace trailing commas
if (c === '"') inString = true
else if (comma && (c === ']' || c === '}')) result[comma] = ' '
comma = (c === ',') ? i : null
comma = null
}
result.push(c)
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jsdoc-cli-wrapper",
"version": "1.0.2",
"version": "1.0.3",
"description": "JSDoc command line interface wrapper",
"main": "index.js",
"bin": "./index.js",
Expand Down

0 comments on commit 9d3677a

Please sign in to comment.