refactor: replace deprecated String.prototype.substr() (#1782)

* refactor: replace deprecated String.prototype.substr()

.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>

* Resolve PR comment

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
Esse commit está contido em:
CommanderRoot
2023-01-23 15:51:52 +01:00
commit de GitHub
commit f7aae7c9ef
4 arquivos alterados com 4 adições e 4 exclusões
+1 -1
Ver Arquivo
@@ -33,7 +33,7 @@ var board = new five.Board();
board.on("ready", function() {
var random = Math.random().toString(36).replace(/[^a-z]+/g, "").substr(0, 4).toUpperCase();
var random = Math.random().toString(36).replace(/[^a-z]+/g, "").slice(0, 4).toUpperCase();
// Controller: PARALLEL (default)
var p = new five.LCD({
+1 -1
Ver Arquivo
@@ -4,7 +4,7 @@ var board = new five.Board();
board.on("ready", function() {
var random = Math.random().toString(36).replace(/[^a-z]+/g, "").substr(0, 4).toUpperCase();
var random = Math.random().toString(36).replace(/[^a-z]+/g, "").slice(0, 4).toUpperCase();
// Controller: PARALLEL (default)
var p = new five.LCD({
+1 -1
Ver Arquivo
@@ -4,7 +4,7 @@ var board = new five.Board();
board.on("ready", function() {
var random = Math.random().toString(36).replace(/[^a-z]+/g, "").substr(0, 4).toUpperCase();
var random = Math.random().toString(36).replace(/[^a-z]+/g, "").slice(0, 4).toUpperCase();
// Controller: PARALLEL (default)
var p = new five.LCD({
+1 -1
Ver Arquivo
@@ -674,7 +674,7 @@ const Controllers = {
throw new Error("The `row` method is only supported for Matrix devices");
}
if (typeof val === "number") {
val = (`0000000000000000${parseInt(val, 10).toString(2)}`).substr(0 - (this.columns), this.columns);
val = (`0000000000000000${parseInt(val, 10).toString(2)}`).slice(0 - (this.columns));
}
if (arguments.length === 2) {
val = row;