Skip to content

Commit

Permalink
tools: fix warning in doc parsing
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Shigeki Ohtsu authored and Myles Borins committed Mar 2, 2016
1 parent c6cfd31 commit 88293f2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/doc/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ function parseSignature(text, sig) {
// [foo] -> optional
if (p.charAt(p.length - 1) === ']') {
optional = true;
p = p.substr(0, p.length - 1);
p = p.replace(/\]/g, '');
p = p.trim();
}
var eq = p.indexOf('=');
Expand Down

0 comments on commit 88293f2

Please sign in to comment.