Change string concats to template literals

This commit is contained in:
Sam Schloegel
2022-01-03 14:31:13 -05:00
parent c5691b56c9
commit aec191e178
11 changed files with 47 additions and 80 deletions
+6 -8
View File
@@ -48,9 +48,9 @@ exports.data = function (device, buf) {
for (var i = 0; i <= 32; i++) {
device.send(
Buffer.from(
'/ch/' +
i.toString().padStart(2, '0') +
'/config/name\u0000\u0000\u0000\u0000'
`/ch/${i
.toString()
.padStart(2, '0')}/config/name\u0000\u0000\u0000\u0000`
)
);
}
@@ -85,7 +85,7 @@ exports.data = function (device, buf) {
}
device.draw();
device.send(
Buffer.from('/ch/' + addr[1] + '/mix/fader\u0000\u0000\u0000\u0000')
Buffer.from(`/ch/${addr[1]}/mix/fader\u0000\u0000\u0000\u0000`)
);
} else if (msg[0].indexOf('/config/name') > 0) {
var addr = parseAddress(msg[0]);
@@ -93,16 +93,14 @@ exports.data = function (device, buf) {
device.data.channelNames[channel - 1] = msg[2];
device.draw();
device.send(
Buffer.from('/ch/' + addr[1] + '/config/color\u0000\u0000\u0000\u0000')
Buffer.from(`/ch/${addr[1]}/config/color\u0000\u0000\u0000\u0000`)
);
} else if (msg[0].indexOf('/config/color') > 0) {
var addr = parseAddress(msg[0]);
var channel = Number(addr[1]);
device.data.channelColors[channel - 1] = buf.readInt8(27);
device.draw();
device.send(
Buffer.from('/ch/' + addr[1] + '/mix/on\u0000\u0000\u0000\u0000')
);
device.send(Buffer.from(`/ch/${addr[1]}/mix/on\u0000\u0000\u0000\u0000`));
} else {
//console.log(msg)
}