1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-22 12:50:36 +01:00

Replace deprecated String.prototype.substr()

This commit is contained in:
CommanderRoot 2022-02-21 19:46:02 +01:00 committed by GitHub
parent dc593daba8
commit bfa355b58d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -17,7 +17,7 @@ const fs = require("fs");
function getAlphaVersion(manifest){ function getAlphaVersion(manifest){
"use strict"; "use strict";
const now = new Date(); const now = new Date();
const date = now.toISOString().substr(0, 10).replace(/-/g, ""); const date = now.toISOString().substring(0, 10).replace(/-/g, "");
return manifest.version.replace(/^([\d.]+).*$/, "$1Alpha" + date); return manifest.version.replace(/^([\d.]+).*$/, "$1Alpha" + date);
} }
function getRCVersion(manifest){ function getRCVersion(manifest){

View File

@ -126,10 +126,10 @@ const decompressed2 = decompress(compressed2, usedWords);
console.log("test: ", compressed === decompressed2); console.log("test: ", compressed === decompressed2);
for (let start = 0; start < compressed.length; start += 100){ for (let start = 0; start < compressed.length; start += 100){
if (compressed.substr(start, 100) !== decompressed2.substr(start, 100)){ if (compressed.substring(start, start + 100) !== decompressed2.substring(start, start + 100)){
console.log(start); console.log(start);
console.log(compressed.substr(start, 100)); console.log(compressed.substring(start, start + 100));
console.log(decompressed2.substr(start, 100)); console.log(decompressed2.substring(start, start + 100));
} }
} }

View File

@ -6,7 +6,7 @@ var log = function(){
str.unshift("color: green"); str.unshift("color: green");
str.unshift("%cOK"); str.unshift("%cOK");
} }
else if (str[str.length - 1].substr(0, 9) === "missmatch"){ else if (str[str.length - 1].startsWith("missmatch")){
str.unshift("color: red"); str.unshift("color: red");
str.unshift("%cX"); str.unshift("%cX");
} }