From e51b120c7095801d9db7ef8776361f33cacbcba4 Mon Sep 17 00:00:00 2001 From: Govee91 Date: Fri, 6 Oct 2017 19:30:37 +0200 Subject: [PATCH 1/2] Replaced string concatenations with template literals. --- tools/license2rtf.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/tools/license2rtf.js b/tools/license2rtf.js index 22b5ffd522f543..435ba22a18307f 100644 --- a/tools/license2rtf.js +++ b/tools/license2rtf.js @@ -245,22 +245,18 @@ 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 ${lines.map(rtfEscape).join('\\line ')}`; if (!lic) rtf += '\\b0'; rtf += '\\par\n'; @@ -279,25 +275,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)}?`; }); } From 45b8f7244d6e81d59e162bbe18f2d8d7c7adc059 Mon Sep 17 00:00:00 2001 From: Govee91 Date: Sat, 7 Oct 2017 17:25:08 +0200 Subject: [PATCH 2/2] Replaced string concatenations with template literals. --- tools/license2rtf.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/license2rtf.js b/tools/license2rtf.js index 435ba22a18307f..df9bc28118c638 100644 --- a/tools/license2rtf.js +++ b/tools/license2rtf.js @@ -256,7 +256,8 @@ function RtfGenerator() { if (!lic) rtf += '\\b'; if (li) - rtf += ` ${li}\\tab ${lines.map(rtfEscape).join('\\line ')}`; + rtf += ` ${li}\\tab`; + rtf += ` ${lines.map(rtfEscape).join('\\line ')}`; if (!lic) rtf += '\\b0'; rtf += '\\par\n';