Skip to content

Commit b7ef644

Browse files
Shigeki OhtsuMyles Borins
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 f618080 commit b7ef644

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/doc/json.js

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

0 commit comments

Comments
 (0)