summaryrefslogtreecommitdiff
path: root/tools/license2rtf.js
diff options
context:
space:
mode:
authorGovee91 <pierluigi.iannarelli@gmail.com>2017-10-06 19:30:37 +0200
committerRuben Bridgewater <ruben@bridgewater.de>2017-10-08 15:46:11 -0700
commitdd1592020b31d810caa276f11738343551d59b82 (patch)
tree7e232d110c27d5dcacfdc64854a3559ec01078c6 /tools/license2rtf.js
parent3a265556ece7c23e2d9afdfe492bff2812e43bfb (diff)
downloadnode-new-dd1592020b31d810caa276f11738343551d59b82.tar.gz
tools: use more template literals
PR-URL: https://github.com/nodejs/node/pull/15942 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'tools/license2rtf.js')
-rw-r--r--tools/license2rtf.js21
1 files changed, 9 insertions, 12 deletions
diff --git a/tools/license2rtf.js b/tools/license2rtf.js
index 22b5ffd522..a32a121135 100644
--- a/tools/license2rtf.js
+++ b/tools/license2rtf.js
@@ -245,22 +245,19 @@ function RtfGenerator() {
if (li)
level++;
- var rtf = '\\pard';
- rtf += '\\sa150\\sl300\\slmult1';
+ var rtf = '\\pard\\sa150\\sl300\\slmult1';
if (level > 0)
- rtf += '\\li' + (level * 240);
+ rtf += `\\li${level * 240}`;
if (li) {
- rtf += '\\tx' + (level) * 240;
- rtf += '\\fi-240';
+ rtf += `\\tx${level * 240}\\fi-240`;
}
if (lic)
rtf += '\\ri240';
if (!lic)
rtf += '\\b';
if (li)
- rtf += ' ' + li + '\\tab';
- rtf += ' ';
- rtf += lines.map(rtfEscape).join('\\line ');
+ rtf += ` ${li}\\tab`;
+ rtf += ` ${lines.map(rtfEscape).join('\\line ')}`;
if (!lic)
rtf += '\\b0';
rtf += '\\par\n';
@@ -279,25 +276,25 @@ function RtfGenerator() {
function toHex(number, length) {
var hex = (~~number).toString(16);
while (hex.length < length)
- hex = '0' + hex;
+ hex = `0${hex}`;
return hex;
}
function rtfEscape(string) {
return string
.replace(/[\\{}]/g, function(m) {
- return '\\' + m;
+ return `\\${m}`;
})
.replace(/\t/g, function() {
return '\\tab ';
})
// eslint-disable-next-line no-control-regex
.replace(/[\x00-\x1f\x7f-\xff]/g, function(m) {
- return '\\\'' + toHex(m.charCodeAt(0), 2);
+ return `\\'${toHex(m.charCodeAt(0), 2)}`;
})
.replace(/\ufeff/g, '')
.replace(/[\u0100-\uffff]/g, function(m) {
- return '\\u' + toHex(m.charCodeAt(0), 4) + '?';
+ return `\\u${toHex(m.charCodeAt(0), 4)}?`;
});
}