njs-modbus 1.3.1 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -647,11 +647,11 @@ class RtuApplicationLayer extends AbstractApplicationLayer {
647
647
  return;
648
648
  }
649
649
  if (typeof res === 'number') {
650
- if (res < frame.data.length) {
650
+ if (frame.data.length < res) {
651
651
  callback(new Error('Insufficient data length'));
652
652
  return;
653
653
  }
654
- if (res !== frame.data.length) {
654
+ if (frame.data.length !== res) {
655
655
  callback(new Error('Invalid response'));
656
656
  return;
657
657
  }
@@ -818,11 +818,11 @@ class AsciiApplicationLayer extends AbstractApplicationLayer {
818
818
  return;
819
819
  }
820
820
  if (typeof res === 'number') {
821
- if (res < frame.data.length) {
821
+ if (frame.data.length < res) {
822
822
  callback(new Error('Insufficient data length'));
823
823
  return;
824
824
  }
825
- if (res !== frame.data.length) {
825
+ if (frame.data.length !== res) {
826
826
  callback(new Error('Invalid response'));
827
827
  return;
828
828
  }
@@ -934,11 +934,11 @@ class TcpApplicationLayer extends AbstractApplicationLayer {
934
934
  return;
935
935
  }
936
936
  if (typeof res === 'number') {
937
- if (res < frame.data.length) {
937
+ if (frame.data.length < res) {
938
938
  callback(new Error('Insufficient data length'));
939
939
  return;
940
940
  }
941
- if (res !== frame.data.length) {
941
+ if (frame.data.length !== res) {
942
942
  callback(new Error('Invalid response'));
943
943
  return;
944
944
  }
package/dist/index.mjs CHANGED
@@ -645,11 +645,11 @@ class RtuApplicationLayer extends AbstractApplicationLayer {
645
645
  return;
646
646
  }
647
647
  if (typeof res === 'number') {
648
- if (res < frame.data.length) {
648
+ if (frame.data.length < res) {
649
649
  callback(new Error('Insufficient data length'));
650
650
  return;
651
651
  }
652
- if (res !== frame.data.length) {
652
+ if (frame.data.length !== res) {
653
653
  callback(new Error('Invalid response'));
654
654
  return;
655
655
  }
@@ -816,11 +816,11 @@ class AsciiApplicationLayer extends AbstractApplicationLayer {
816
816
  return;
817
817
  }
818
818
  if (typeof res === 'number') {
819
- if (res < frame.data.length) {
819
+ if (frame.data.length < res) {
820
820
  callback(new Error('Insufficient data length'));
821
821
  return;
822
822
  }
823
- if (res !== frame.data.length) {
823
+ if (frame.data.length !== res) {
824
824
  callback(new Error('Invalid response'));
825
825
  return;
826
826
  }
@@ -932,11 +932,11 @@ class TcpApplicationLayer extends AbstractApplicationLayer {
932
932
  return;
933
933
  }
934
934
  if (typeof res === 'number') {
935
- if (res < frame.data.length) {
935
+ if (frame.data.length < res) {
936
936
  callback(new Error('Insufficient data length'));
937
937
  return;
938
938
  }
939
- if (res !== frame.data.length) {
939
+ if (frame.data.length !== res) {
940
940
  callback(new Error('Invalid response'));
941
941
  return;
942
942
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "njs-modbus",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "A pure JavaScript implemetation of Modbus for NodeJS.",
5
5
  "keywords": [
6
6
  "modbus",