Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 15ae5a4

Browse filesBrowse files
Minya LiangMylesBorins
authored andcommitted
tools: replace concat with template literals
PR-URL: #16046 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Lance Ball <lball@redhat.com>
1 parent ab7f43a commit 15ae5a4
Copy full SHA for 15ae5a4

File tree

Expand file treeCollapse file tree

1 file changed

+10
-10
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-10
lines changed
Open diff view settings
Collapse file

‎tools/doc/json.js‎

Copy file name to clipboardExpand all lines: tools/doc/json.js
+10-10Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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
});
242242

243243
// 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
}
248248

249249
// 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) {
471471

472472
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
}
480480

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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.