tools: replace concat with template literals · nodejs/node@15ae5a4

@@ -11,7 +11,7 @@ const marked = require('marked');

1111

// customized heading without id attribute

1212

var renderer = new marked.Renderer();

1313

renderer.heading = function(text, level) {

14-

return '<h' + level + '>' + text + '</h' + level + '>\n';

14+

return `<h${level}>${text}</h${level}>\n`;

1515

};

1616

marked.setOptions({

1717

renderer: renderer

@@ -225,25 +225,25 @@ function processList(section) {

225225

} else if (type === 'list_item_end') {

226226

if (!current) {

227227

throw new Error('invalid list - end without current item\n' +

228-

JSON.stringify(tok) + '\n' +

228+

`${JSON.stringify(tok)}\n` +

229229

JSON.stringify(list));

230230

}

231231

current = stack.pop();

232232

} else if (type === 'text') {

233233

if (!current) {

234234

throw new Error('invalid list - text without current item\n' +

235-

JSON.stringify(tok) + '\n' +

235+

`${JSON.stringify(tok)}\n` +

236236

JSON.stringify(list));

237237

}

238238

current.textRaw = current.textRaw || '';

239-

current.textRaw += tok.text + ' ';

239+

current.textRaw += `${tok.text} `;

240240

}

241241

});

242242243243

// shove the name in there for properties, since they are always

244244

// just going to be the value etc.

245245

if (section.type === 'property' && values[0]) {

246-

values[0].textRaw = '`' + section.name + '` ' + values[0].textRaw;

246+

values[0].textRaw = `\`${section.name}\` ${values[0].textRaw}`;

247247

}

248248249249

// now pull the actual values out of the text bits.

@@ -345,8 +345,8 @@ function parseSignature(text, sig) {

345345

// at this point, the name should match.

346346

if (p !== param.name) {

347347

console.error('Warning: invalid param "%s"', p);

348-

console.error(' > ' + JSON.stringify(param));

349-

console.error(' > ' + text);

348+

console.error(` > ${JSON.stringify(param)}`);

349+

console.error(` > ${text}`);

350350

}

351351

if (optional) param.optional = true;

352352

if (def !== undefined) param.default = def;

@@ -411,7 +411,7 @@ function parseListItem(item) {

411411

function finishSection(section, parent) {

412412

if (!section || !parent) {

413413

throw new Error('Invalid finishSection call\n' +

414-

JSON.stringify(section) + '\n' +

414+

`${JSON.stringify(section)}\n` +

415415

JSON.stringify(parent));

416416

}

417417

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

471471472472

var plur;

473473

if (section.type.slice(-1) === 's') {

474-

plur = section.type + 'es';

474+

plur = `${section.type}es`;

475475

} else if (section.type.slice(-1) === 'y') {

476476

plur = section.type.replace(/y$/, 'ies');

477477

} else {

478-

plur = section.type + 's';

478+

plur = `${section.type}s`;

479479

}

480480481481

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