node-dmx / dmx

DMX controller library for node.js
MIT License
297 stars 95 forks source link

"const" incorrectly used for some loop iterators in drivers/bbdmx.js #166

Open H-s-O opened 1 month ago

H-s-O commented 1 month ago

Today I used patch-package to patch dmx@0.2.5 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/dmx/drivers/bbdmx.js b/node_modules/dmx/drivers/bbdmx.js
index e4df5b5..64c296c 100644
--- a/node_modules/dmx/drivers/bbdmx.js
+++ b/node_modules/dmx/drivers/bbdmx.js
@@ -22,7 +22,7 @@ BBDMX.prototype.sendUniverse = function () {
     let channel;
     let messageBuffer = Buffer.from(UNIVERSE_LEN.toString());

-    for (const i = 1; i <= UNIVERSE_LEN; i++) {
+    for (let i = 1; i <= UNIVERSE_LEN; i++) {
       channel = Buffer.from(' ' + this.universe[i]);
       messageBuffer = Buffer.concat([messageBuffer, channel]);
     }
@@ -55,7 +55,7 @@ BBDMX.prototype.update = function (u, extraData) {
 };

 BBDMX.prototype.updateAll = function (v) {
-  for (const i = 1; i <= UNIVERSE_LEN; i++) {
+  for (let i = 1; i <= UNIVERSE_LEN; i++) {
     this.universe[i] = v;
   }
 };