Use flatmap
This commit is contained in:
parent
2ce9c67204
commit
143bf0bbda
1 changed files with 2 additions and 3 deletions
|
@ -277,10 +277,9 @@ export default class LayerConfig extends WithContextLoader {
|
||||||
".units: the 'units'-section should be a list; you probably have an object there"
|
".units: the 'units'-section should be a list; you probably have an object there"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
this.units = [].concat(
|
this.units = (json.units ?? []).flatMap((unitJson, i) =>
|
||||||
...(json.units ?? []).map((unitJson, i) =>
|
|
||||||
Unit.fromJson(unitJson, this.tagRenderings, `${context}.unit[${i}]`)
|
Unit.fromJson(unitJson, this.tagRenderings, `${context}.unit[${i}]`)
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|
Loading…
Reference in a new issue