Allow node.status() to be passed number/bool types

Adds to the existing support for string types. Also
adds unit tests for all three cases
This commit is contained in:
Nick O'Leary
2019-10-14 13:06:59 +01:00
parent 147d2a02be
commit c1c694035d
2 changed files with 33 additions and 4 deletions

View File

@@ -539,7 +539,12 @@ Node.prototype.metric = function(eventname, msg, metricValue) {
* status: "simple text status"
*/
Node.prototype.status = function(status) {
if (typeof(status) === "string") { status = {text:status}; }
switch (typeof status) {
case "string":
case "number":
case "boolean":
status = {text:""+status}
}
this._flow.handleStatus(this,status);
};