Skip to content

Commit 9f98989

Browse files
Minya LiangBridgeAR
Minya Liang
authored andcommittedOct 9, 2017
tools: replace concat with template literals
PR-URL: #16046 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Lance Ball <[email protected]>
1 parent be3ac44 commit 9f98989

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed
 

‎tools/doc/json.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const marked = require('marked');
3232
// customized heading without id attribute
3333
const renderer = new marked.Renderer();
3434
renderer.heading = function(text, level) {
35-
return '<h' + level + '>' + text + '</h' + level + '>\n';
35+
return `<h${level}>${text}</h${level}>\n`;
3636
};
3737
marked.setOptions({
3838
renderer: renderer
@@ -246,25 +246,25 @@ function processList(section) {
246246
} else if (type === 'list_item_end') {
247247
if (!current) {
248248
throw new Error('invalid list - end without current item\n' +
249-
JSON.stringify(tok) + '\n' +
249+
`${JSON.stringify(tok)}\n` +
250250
JSON.stringify(list));
251251
}
252252
current = stack.pop();
253253
} else if (type === 'text') {
254254
if (!current) {
255255
throw new Error('invalid list - text without current item\n' +
256-
JSON.stringify(tok) + '\n' +
256+
`${JSON.stringify(tok)}\n` +
257257
JSON.stringify(list));
258258
}
259259
current.textRaw = current.textRaw || '';
260-
current.textRaw += tok.text + ' ';
260+
current.textRaw += `${tok.text} `;
261261
}
262262
});
263263

264264
// shove the name in there for properties, since they are always
265265
// just going to be the value etc.
266266
if (section.type === 'property' && values[0]) {
267-
values[0].textRaw = '`' + section.name + '` ' + values[0].textRaw;
267+
values[0].textRaw = `\`${section.name}\` ${values[0].textRaw}`;
268268
}
269269

270270
// now pull the actual values out of the text bits.
@@ -362,8 +362,8 @@ function parseSignature(text, sig) {
362362
// at this point, the name should match.
363363
if (p !== param.name) {
364364
console.error('Warning: invalid param "%s"', p);
365-
console.error(' > ' + JSON.stringify(param));
366-
console.error(' > ' + text);
365+
console.error(` > ${JSON.stringify(param)}`);
366+
console.error(` > ${text}`);
367367
}
368368
if (optional) param.optional = true;
369369
if (def !== undefined) param.default = def;
@@ -428,7 +428,7 @@ function parseListItem(item) {
428428
function finishSection(section, parent) {
429429
if (!section || !parent) {
430430
throw new Error('Invalid finishSection call\n' +
431-
JSON.stringify(section) + '\n' +
431+
`${JSON.stringify(section)}\n` +
432432
JSON.stringify(parent));
433433
}
434434

@@ -488,11 +488,11 @@ function finishSection(section, parent) {
488488

489489
var plur;
490490
if (section.type.slice(-1) === 's') {
491-
plur = section.type + 'es';
491+
plur = `${section.type}es`;
492492
} else if (section.type.slice(-1) === 'y') {
493493
plur = section.type.replace(/y$/, 'ies');
494494
} else {
495-
plur = section.type + 's';
495+
plur = `${section.type}s`;
496496
}
497497

498498
// if the parent's type is 'misc', then it's just a random

0 commit comments

Comments
 (0)
Please sign in to comment.