From 8940f5fc33223c523f0b045738ca1c2ecc3ea8f5 Mon Sep 17 00:00:00 2001 From: freearhey Date: Sat, 17 Apr 2021 13:44:42 +0300 Subject: [PATCH] Update utils.js --- src/utils.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/utils.js b/src/utils.js index ad69ac1..c3d4388 100644 --- a/src/utils.js +++ b/src/utils.js @@ -171,8 +171,13 @@ utils.parsePrograms = function ({ response, item, config }) { buffer: response.data }) - return config - .parser(options) + const programs = config.parser(options) + + if (!Array.isArray(programs)) { + throw new Error('Parser should return an array') + } + + return programs .filter(i => i) .map(p => { p.channel = item.channel.xmltv_id