fix another non-standard instance of checking for metadata
This commit is contained in:
parent
b360d79a76
commit
9623efd10b
@ -62,6 +62,10 @@ const sliceCpIndex = function (cpIndex, line) {
|
|||||||
return start.concat(end);
|
return start.concat(end);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isMetadataMessage = function (parsed) {
|
||||||
|
return Boolean(parsed && parsed.channel);
|
||||||
|
};
|
||||||
|
|
||||||
module.exports.create = function (cfg) {
|
module.exports.create = function (cfg) {
|
||||||
const rpc = cfg.rpc;
|
const rpc = cfg.rpc;
|
||||||
const tasks = cfg.tasks;
|
const tasks = cfg.tasks;
|
||||||
@ -131,7 +135,7 @@ module.exports.create = function (cfg) {
|
|||||||
if (typeof msg === "undefined") { return readMore(); }
|
if (typeof msg === "undefined") { return readMore(); }
|
||||||
|
|
||||||
// validate that the current line really is metadata before storing it as such
|
// 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;
|
metadata = msg;
|
||||||
return readMore();
|
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+\/=]+)\|)?/;
|
var CHECKPOINT_PATTERN = /^cp\|(([A-Za-z0-9+\/=]+)\|)?/;
|
||||||
|
|
||||||
/* onChannelMessage
|
/* onChannelMessage
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user