Skip to content

Commit

Permalink
added explicit semicolons
Browse files Browse the repository at this point in the history
  • Loading branch information
PLCHome authored Jan 29, 2024
1 parent 5938086 commit 67cb014
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function extractValue(type, len, buffer, offset) {
_len = 0;
const corr = ((type === 'string16') ? 1 : 0);
while (_len < len * 2) {
const pos = offset * 2 + _len
const pos = offset * 2 + _len;
if (buffer[pos] || buffer[pos + 1]) {
str += String.fromCharCode(buffer[pos + corr] + (buffer[pos + (1 - corr)] << 8));
} else {
Expand All @@ -147,7 +147,7 @@ function extractValue(type, len, buffer, offset) {
// find length
_len = 0;
while (_len < len * 2) {
str += buffer[offset * 2 + _len].toString(16).padStart(2, '0')
str += buffer[offset * 2 + _len].toString(16).padStart(2, '0');
_len += 1;
}
return str;
Expand Down Expand Up @@ -351,7 +351,7 @@ function writeValue(type, value, len) {
// fix length
buffer = Buffer.alloc(len * 2);
_buffer.copy(buffer);
break
break;
default:
throw new Error(`Invalid type: ${type}`);
buffer = Buffer.alloc(2);
Expand All @@ -372,4 +372,4 @@ module.exports = {
writeValue,
extractValue,
getJSModbusPath
};
};

0 comments on commit 67cb014

Please sign in to comment.