Browse Source

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: https://github.com/nodejs/node/pull/4537
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
v4.x
Shigeki Ohtsu 9 years ago
committed by Myles Borins
parent
commit
88293f2d9c
  1. 2
      tools/doc/json.js

2
tools/doc/json.js

@ -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('=');

Loading…
Cancel
Save