From 9623efd10bb800067723d6205fc06e7b3430d79f Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 21 Aug 2019 13:05:01 +0200 Subject: [PATCH] fix another non-standard instance of checking for metadata --- historyKeeper.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/historyKeeper.js b/historyKeeper.js index efbc44dd5..93ce0a2f1 100644 --- a/historyKeeper.js +++ b/historyKeeper.js @@ -62,6 +62,10 @@ const sliceCpIndex = function (cpIndex, line) { return start.concat(end); }; +const isMetadataMessage = function (parsed) { + return Boolean(parsed && parsed.channel); +}; + module.exports.create = function (cfg) { const rpc = cfg.rpc; const tasks = cfg.tasks; @@ -131,7 +135,7 @@ module.exports.create = function (cfg) { if (typeof msg === "undefined") { return readMore(); } // validate that the current line really is metadata before storing it as such - if (msg && typeof(msg) === 'object' && !Array.isArray(msg)) { + if (isMetadataMessage(msg)) { metadata = msg; return readMore(); } @@ -291,10 +295,6 @@ module.exports.create = function (cfg) { }); }; - const isMetadataMessage = function (parsed) { - return Boolean(parsed && parsed.channel); - }; - var CHECKPOINT_PATTERN = /^cp\|(([A-Za-z0-9+\/=]+)\|)?/; /* onChannelMessage