Browse Source

tools: replace string concatenation with template

Replace string concatenation in tools/doc/type-parser.js
with template literals

PR-URL: https://github.com/nodejs/node/pull/15827
Reviewed-By: Ryan Graham <r.m.graham@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
v9.x-staging
Nicola Del Gobbo 7 years ago
committed by Gireesh Punathil
parent
commit
8c6c060918
  1. 19
      tools/doc/type-parser.js

19
tools/doc/type-parser.js

@ -1,8 +1,8 @@
'use strict';
const nodeDocUrl = '';
const jsDocPrefix = 'https://developer.mozilla.org/en-US/docs/Web/JavaScript/';
const jsDocUrl = jsDocPrefix + 'Reference/Global_Objects/';
const jsPrimitiveUrl = jsDocPrefix + 'Data_structures';
const jsDocUrl = `${jsDocPrefix}Reference/Global_Objects/`;
const jsPrimitiveUrl = `${jsDocPrefix}Data_structures`;
const jsPrimitives = {
'boolean': 'Boolean',
'integer': 'Number', // not a primitive, used for clarification
@ -22,10 +22,10 @@ const jsGlobalTypes = [
'AsyncFunction', 'SharedArrayBuffer'
];
const typeMap = {
'Iterable': jsDocPrefix +
'Reference/Iteration_protocols#The_iterable_protocol',
'Iterator': jsDocPrefix +
'Reference/Iteration_protocols#The_iterator_protocol',
'Iterable':
`${jsDocPrefix}Reference/Iteration_protocols#The_iterable_protocol`,
'Iterator':
`${jsDocPrefix}Reference/Iteration_protocols#The_iterator_protocol`,
'Buffer': 'buffer.html#buffer_class_buffer',
@ -87,11 +87,10 @@ module.exports = {
}
if (typeUrl) {
typeLinks.push('<a href="' + typeUrl + '" class="type">&lt;' +
typeTextFull + '&gt;</a>');
typeLinks.push(`
<a href="${typeUrl}" class="type">&lt;${typeTextFull}&gt;</a>`);
} else {
typeLinks.push('<span class="type">&lt;' + typeTextFull +
'&gt;</span>');
typeLinks.push(`<span class="type">&lt;${typeTextFull}&gt;</span>`);
}
}
});

Loading…
Cancel
Save