From 3457143194762bb50c16d572da6c93f4070e74bc Mon Sep 17 00:00:00 2001 From: Johannes Kimmel Date: Sat, 6 May 2023 00:52:04 +0200 Subject: [PATCH] use Map for maps, not objects --- l3config.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/l3config.js b/l3config.js index a3cf261..e6a8b92 100644 --- a/l3config.js +++ b/l3config.js @@ -62,19 +62,18 @@ class L3Section { .filter(option => !!option); if (options.length == 0) { - return undefined + return undefined; } - var compiledopts = {}; + var compiledopts = new Map(); for (const option of options) { - if (!compiledopts[option.optionName]) { - compiledopts[option.optionName] = []; - } - compiledopts[option.optionName].push(option.value) + let c = compiledopts.get(option.optionName) ?? []; + c.push(option.value); + compiledopts.set(option.optionName, c); } let optstrs = []; - for (const [opt, values] of Object.entries(compiledopts)) { + for (const [opt, values] of compiledopts) { if (values.length == 1) { optstrs.push(`option ${opt} '${values[0]}'`); } else {