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