From 9237b6e38a9355d7311ebfa4d4b538ff50eb6d84 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 d6cbbb04dc10a2..299c8ed9fd84ad 100644 --- a/tools/doc/json.js +++ b/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('=');