From 143bf0bbdaf8fe809b3ec8baed4c5981a4332050 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Wed, 19 Jun 2024 01:11:54 +0200 Subject: [PATCH] Use flatmap --- src/Models/ThemeConfig/LayerConfig.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Models/ThemeConfig/LayerConfig.ts b/src/Models/ThemeConfig/LayerConfig.ts index 97268dabc..9babbb96b 100644 --- a/src/Models/ThemeConfig/LayerConfig.ts +++ b/src/Models/ThemeConfig/LayerConfig.ts @@ -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 (