fix another non-standard instance of checking for metadata

This commit is contained in:
ansuz 2019-08-21 13:05:01 +02:00
parent b360d79a76
commit 9623efd10b
1 changed files with 5 additions and 5 deletions

View File

@ -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