From 422d3158ee7f1cfe33c0ca23d24ff44da899b355 Mon Sep 17 00:00:00 2001 From: Patrick Heneise Date: Mon, 6 Nov 2017 15:01:55 +0000 Subject: [PATCH] tools: replace string concetation with templates Replace string concatenation in tools/doc/html.js with template literals. PR-URL: https://github.com/nodejs/node/pull/16801 Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Rich Trott --- tools/doc/html.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/doc/html.js b/tools/doc/html.js index b6e8866c247d55..462de24fd7be59 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -499,12 +499,12 @@ function buildToc(lexed, filename, cb) { depth = tok.depth; const realFilename = path.basename(realFilenames[0], '.md'); - const id = getId(realFilename + '_' + tok.text.trim()); + const id = getId(`${realFilename}_${tok.text.trim()}`); toc.push(new Array((depth - 1) * 2 + 1).join(' ') + `* ` + `${tok.text}`); - tok.text += '#'; + tok.text += `#`; }); toc = marked.parse(toc.join('\n')); @@ -518,7 +518,7 @@ function getId(text) { text = text.replace(/^_+|_+$/, ''); text = text.replace(/^([^a-z])/, '_$1'); if (idCounters.hasOwnProperty(text)) { - text += '_' + (++idCounters[text]); + text += `_${(++idCounters[text])}`; } else { idCounters[text] = 0; }