From 6c2589bab7d20bbffeb29f63962672457b65b63c Mon Sep 17 00:00:00 2001 From: Mats Andreassen Date: Sun, 14 Jun 2020 18:12:19 +0200 Subject: [PATCH] Updated text forecast repacker, so we also support days without text forecasts (sunday, sunday people...) --- lib/repack-text-forecast.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/repack-text-forecast.js b/lib/repack-text-forecast.js index 14f0b34..073a66b 100644 --- a/lib/repack-text-forecast.js +++ b/lib/repack-text-forecast.js @@ -1,6 +1,8 @@ module.exports = (textForecast, areaIds) => { return textForecast.textforecast.time.map(period => { - const areas = period.forecasttype.location + const { forecasttype } = period + + const areas = forecasttype && forecasttype.location ? forecasttype.location : [] const filteredAreas = areaIds ? areas.filter(area => areaIds.includes(area['@_id'])) : areas const areaForcasts = filteredAreas.map(area => {