Skip to content

Commit 05f17db

Browse files
Shigeki Ohtsujasnell
authored andcommitted
tools: fix warning in doc parsing
The description of "[start[, end]]" in the doc shows warning of "invalid param" when parsing an optional parameter in the section. This fixes insufficient trimming of right square brackets. PR-URL: #4537 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 64e294a commit 05f17db

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎tools/doc/json.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ function parseSignature(text, sig) {
283283
// [foo] -> optional
284284
if (p.charAt(p.length - 1) === ']') {
285285
optional = true;
286-
p = p.substr(0, p.length - 1);
286+
p = p.replace(/\]/g, '');
287287
p = p.trim();
288288
}
289289
var eq = p.indexOf('=');

0 commit comments

Comments
 (0)