diff --git a/README.md b/README.md index 03f0bc3..b2e728d 100644 --- a/README.md +++ b/README.md @@ -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 @@ -99,10 +99,10 @@ This wrapper resolves both of these minor annoyances. ```sh $ pnpm jsdoc -> jsdoc-cli-wrapper@1.0.1 jsdoc /path/to/jsdoc-cli-wrapper +> jsdoc-cli-wrapper@1.0.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 diff --git a/lib/index.js b/lib/index.js index 66b0ecb..d5fc262 100644 --- a/lib/index.js +++ b/lib/index.js @@ -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) } diff --git a/package.json b/package.json index e5b2c09..4cc7d1a 100644 --- a/package.json +++ b/package.json @@ -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",