Use flatmap

This commit is contained in:
Pieter Vander Vennet 2024-06-19 01:11:54 +02:00
parent 2ce9c67204
commit 143bf0bbda

View file

@ -277,10 +277,9 @@ export default class LayerConfig extends WithContextLoader {
".units: the 'units'-section should be a list; you probably have an object there"
)
}
this.units = [].concat(
...(json.units ?? []).map((unitJson, i) =>
this.units = (json.units ?? []).flatMap((unitJson, i) =>
Unit.fromJson(unitJson, this.tagRenderings, `${context}.unit[${i}]`)
)
)
if (