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

This commit is contained in:
CommanderRoot
2022-03-23 15:31:25 +01:00
committed by GitHub
parent 70a1b714e4
commit 755ee333d0
2 changed files with 2 additions and 2 deletions

View File

@@ -74,7 +74,7 @@ export default defineComponent({
let color = "#"
for (let i = 0; i < 3; i++) {
const value = (hash >> (i * 8)) & 255
color += `00${value.toString(16)}`.substr(-2)
color += `00${value.toString(16)}`.slice(-2)
}
return color
},

View File

@@ -88,7 +88,7 @@ const getTokenConfiguration = async (endpoint) => {
const generateRandomString = () => {
const array = new Uint32Array(28)
window.crypto.getRandomValues(array)
return Array.from(array, (dec) => `0${dec.toString(16)}`.substr(-2)).join("")
return Array.from(array, (dec) => `0${dec.toString(16)}`.slice(-2)).join("")
}
/**