1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-08-12 00:50:53 +00:00

Replace deprecated String.prototype.substr()

String.prototype.substr() is deprecated (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr) so we replace it with slice() which works similarily but isn't deprecated.
Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
This commit is contained in:
Tobias Speicher 2022-02-18 09:20:19 +01:00
parent 6a7ac8c194
commit 61a9e80de0
No known key found for this signature in database
GPG key ID: 2CF824BD810C3BDB
7 changed files with 7 additions and 7 deletions

View file

@ -8,7 +8,7 @@ const dir = 'styles/fontello';
for(const file of fs.readdirSync(dir)) {
if ( file.endsWith('.css') ) {
const old_path = path.join(dir, file),
new_path = `${old_path.substr(0, old_path.length - 4)}.scss`;
new_path = `${old_path.slice(0, -4)}.scss`;
fs.renameSync(old_path, new_path);
}

View file

@ -400,7 +400,7 @@ export const Mentions = {
this.applyHighlight(msg, priority, null, 'mention', true);
// Push the remaining text from the token.
text.push(segment.substr(match[0].length));
text.push(segment.slice(match[0].length));
} else
text.push(segment);

View file

@ -543,7 +543,7 @@ export default {
if ( values )
for(const [key, value] of Object.entries(values)) {
if ( key.startsWith(prefix) ) {
prof.set(key.substr(prefix.length), value);
prof.set(key.slice(prefix.length), value);
i++;
}
}

View file

@ -104,7 +104,7 @@ export default {
out.push({
key: part.name,
i18n: `settings.filter.page.route.${this.route.name}.${part.name}`,
title: name[0].toLocaleUpperCase() + name.substr(1),
title: name[0].toLocaleUpperCase() + name.slice(1),
optional: part.optional
});
}

View file

@ -277,7 +277,7 @@ export default class SettingsContext extends EventEmitter {
if ( prefix && this._context_objects.has(prefix) ) {
for(const key of Object.keys(this._context) )
if ( key.startsWith(prefix) ) {
const partial_key = key.substr(prefix.length);
const partial_key = key.slice(prefix.length);
if ( ! keys.includes(partial_key) )
keys.push(partial_key);
}

View file

@ -671,7 +671,7 @@ export default class SettingsManager extends Module {
// If we're still here, it means an individual setting was changed.
// Look up the profile it belongs to and emit a changed event from
// that profile, thus notifying any contexts or UI instances.
key = key.substr(2);
key = key.slice(2);
// Is it a value?
const idx = key.indexOf(':');

View file

@ -54,7 +54,7 @@ module.exports = merge(common, {
publicPath: '',
map: data => {
if ( data.name.endsWith('.scss') )
data.name = `${data.name.substr(0,data.name.length - 5)}.css`;
data.name = `${data.name.slice(0, -5)}.css`;
return data;
}