From b87a9e5c201f149883bef7467b982526bb68b183 Mon Sep 17 00:00:00 2001 From: "Jan Schwarzrock (PSSGCSim)" Date: Fri, 29 Sep 2017 00:28:45 +0200 Subject: [PATCH] Replaced concatenated strings with template literals in the readers/ini.js updates: https://github.com/haraka/Haraka/issues/2129 --- readers/ini.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/readers/ini.js b/readers/ini.js index b9e703c..409812a 100644 --- a/readers/ini.js +++ b/readers/ini.js @@ -43,7 +43,7 @@ exports.load = function (name, options, regex) { match = regex.param.exec(line); if (!match) { exports.logger( - 'Invalid line in config file \'' + name + '\': ' + line); + `Invalid line in config file '${name}': ${line}`); return; } @@ -61,13 +61,12 @@ exports.load = function (name, options, regex) { if (options && Array.isArray(options.booleans) && ( - exports.bool_matches.indexOf(current_sect_name + '.' + match[1]) !== -1 + exports.bool_matches.indexOf(`${current_sect_name}.${match[1]}`) !== -1 || - exports.bool_matches.indexOf('*.' + match[1]) !== -1 + exports.bool_matches.indexOf(`*.${match[1]}`) !== -1 )) { current_sect[match[1]] = regex.is_truth.test(match[2]); - // var msg = 'Using boolean ' + current_sect[match[1]] + - // ' for ' + current_sect_name + '.' + match[1] + '=' + match[2]; + // var msg = `Using boolean ${current_sect[match[1]]} for ${current_sect_name}.${match[1]}=${match[2]}`; // exports.logger(msg, 'logdebug'); } else if (regex.is_integer.test(match[2])) { @@ -111,8 +110,8 @@ exports.init_booleans = function (options, result) { if (section === '*') continue; // wildcard, don't initialize // so boolean detection in the next section will match - if (options.booleans.indexOf(section + '.' + key) === -1) { - this.bool_matches.push(section + '.' + key); + if (options.booleans.indexOf(`${section}.${key}`) === -1) { + this.bool_matches.push(`${section}.${key}`); } if (!result[section]) result[section] = {};