Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Commit

Permalink
metric: Fix metric data array processing
Browse files Browse the repository at this point in the history
Signed-off-by: Scott Ware <[email protected]>
  • Loading branch information
srware committed Mar 24, 2021
1 parent 0ed2559 commit 7083c6f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions lib/data/metric.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,20 @@ Metric.prototype.dataAsRoot = function (value) {
};

Metric.prototype.dataAsArray = function (msg) {
var l = msg.data.length;
var l = msg.length;
this.globalCid = msg.cid || this.componentId ;
for (var i = 0; i < l; i++) {
var value = msg.data[i];
var value = msg[i];
this.dataAsRoot(value);
}
};

Metric.prototype.dataProcess = function (datoArr) {
if (datoArr) {
if (Array.isArray(datoArr.data)) {
this.dataAsArray(datoArr);
Metric.prototype.dataProcess = function (dataArr) {
if (dataArr) {
if (Array.isArray(dataArr)) {
this.dataAsArray(dataArr);
} else {
this.dataAsRoot(datoArr);
this.dataAsRoot(dataArr);
}
}
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"dependencies": {
"async": "^3.1.0",
"borc": "^2.1.1",
"mqtt" : "^3.0.0",
"mqtt": "^3.0.0",
"request": "^2.88.0",
"tunnel": "0.0.6",
"websocket": "^1.0.29"
Expand Down

0 comments on commit 7083c6f

Please sign in to comment.