use Map for maps, not objects
This commit is contained in:
parent
abbbc8d5a0
commit
3457143194
13
l3config.js
13
l3config.js
|
@ -62,19 +62,18 @@ class L3Section {
|
||||||
.filter(option => !!option);
|
.filter(option => !!option);
|
||||||
|
|
||||||
if (options.length == 0) {
|
if (options.length == 0) {
|
||||||
return undefined
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
var compiledopts = {};
|
var compiledopts = new Map();
|
||||||
for (const option of options) {
|
for (const option of options) {
|
||||||
if (!compiledopts[option.optionName]) {
|
let c = compiledopts.get(option.optionName) ?? [];
|
||||||
compiledopts[option.optionName] = [];
|
c.push(option.value);
|
||||||
}
|
compiledopts.set(option.optionName, c);
|
||||||
compiledopts[option.optionName].push(option.value)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let optstrs = [];
|
let optstrs = [];
|
||||||
for (const [opt, values] of Object.entries(compiledopts)) {
|
for (const [opt, values] of compiledopts) {
|
||||||
if (values.length == 1) {
|
if (values.length == 1) {
|
||||||
optstrs.push(`option ${opt} '${values[0]}'`);
|
optstrs.push(`option ${opt} '${values[0]}'`);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue