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>
feature/145/mastodon-api
Tobias Speicher 2022-03-24 16:17:46 +01:00
rodzic d239b379e2
commit 11f437135a
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 2CF824BD810C3BDB
4 zmienionych plików z 6 dodań i 6 usunięć

Wyświetl plik

@ -30,6 +30,6 @@ const getSearchParams = url => {
}, {}) }, {})
} }
const randHash = () => Math.random().toString(36).replace(/[^a-z]+/g, '').substr(0, 10) const randHash = () => Math.random().toString(36).replace(/[^a-z]+/g, '').slice(0, 10)
export default { getSearchParams, randHash } export default { getSearchParams, randHash }

Wyświetl plik

@ -67,7 +67,7 @@ function transformText(createElement, text) {
props: { props: {
to: { to: {
name: 'profile', name: 'profile',
params: { account: match[2].substr(1) } params: { account: match[2].slice(1) }
} }
} }
}, },
@ -85,7 +85,7 @@ function transformText(createElement, text) {
props: { props: {
to: { to: {
name: 'tags', name: 'tags',
params: { tag: match[2].substr(1) } params: { tag: match[2].slice(1) }
} }
} }
}, },
@ -139,7 +139,7 @@ function cleanLink(createElement, node, context) {
props: { props: {
to: { to: {
name: 'tags', name: 'tags',
params: { tag: node.textContent.substr(1) } params: { tag: node.textContent.slice(1) }
} }
} }
}, },

Wyświetl plik

@ -128,7 +128,7 @@ export default {
computed: { computed: {
localUid() { localUid() {
// Returns only the local part of a username // Returns only the local part of a username
return (this.uid.indexOf('@') === -1) ? this.uid : this.uid.substr(0, this.uid.indexOf('@')) return (this.uid.indexOf('@') === -1) ? this.uid : this.uid.slice(0, this.uid.indexOf('@'))
}, },
displayName() { displayName() {
if (typeof this.accountInfo.name !== 'undefined' && this.accountInfo.name !== '') { if (typeof this.accountInfo.name !== 'undefined' && this.accountInfo.name !== '') {

Wyświetl plik

@ -62,7 +62,7 @@ export default {
* @returns {String} * @returns {String}
*/ */
account() { account() {
return window.location.href.split('/')[window.location.href.split('/').length - 2].substr(1) return window.location.href.split('/')[window.location.href.split('/').length - 2].slice(1)
}, },
/** /**
* @description Returns the timeline currently loaded in the store * @description Returns the timeline currently loaded in the store