From ca9812cf4dd0790cc3bc3f8dc8de92a19f048e8f Mon Sep 17 00:00:00 2001 From: Shigeki Ohtsu Date: Tue, 5 Jan 2016 18:11:19 +0900 Subject: [PATCH] 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 Reviewed-By: James M Snell --- tools/doc/json.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/doc/json.js b/tools/doc/json.js index 4c57aefd797eba..07aef469f3e383 100644 --- a/tools/doc/json.js +++ b/tools/doc/json.js @@ -283,7 +283,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('=');