mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-12 09:00:54 +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:
parent
6a7ac8c194
commit
61a9e80de0
7 changed files with 7 additions and 7 deletions
|
@ -8,7 +8,7 @@ const dir = 'styles/fontello';
|
||||||
for(const file of fs.readdirSync(dir)) {
|
for(const file of fs.readdirSync(dir)) {
|
||||||
if ( file.endsWith('.css') ) {
|
if ( file.endsWith('.css') ) {
|
||||||
const old_path = path.join(dir, file),
|
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);
|
fs.renameSync(old_path, new_path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -400,7 +400,7 @@ export const Mentions = {
|
||||||
this.applyHighlight(msg, priority, null, 'mention', true);
|
this.applyHighlight(msg, priority, null, 'mention', true);
|
||||||
|
|
||||||
// Push the remaining text from the token.
|
// Push the remaining text from the token.
|
||||||
text.push(segment.substr(match[0].length));
|
text.push(segment.slice(match[0].length));
|
||||||
|
|
||||||
} else
|
} else
|
||||||
text.push(segment);
|
text.push(segment);
|
||||||
|
|
|
@ -543,7 +543,7 @@ export default {
|
||||||
if ( values )
|
if ( values )
|
||||||
for(const [key, value] of Object.entries(values)) {
|
for(const [key, value] of Object.entries(values)) {
|
||||||
if ( key.startsWith(prefix) ) {
|
if ( key.startsWith(prefix) ) {
|
||||||
prof.set(key.substr(prefix.length), value);
|
prof.set(key.slice(prefix.length), value);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ export default {
|
||||||
out.push({
|
out.push({
|
||||||
key: part.name,
|
key: part.name,
|
||||||
i18n: `settings.filter.page.route.${this.route.name}.${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
|
optional: part.optional
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,7 +277,7 @@ export default class SettingsContext extends EventEmitter {
|
||||||
if ( prefix && this._context_objects.has(prefix) ) {
|
if ( prefix && this._context_objects.has(prefix) ) {
|
||||||
for(const key of Object.keys(this._context) )
|
for(const key of Object.keys(this._context) )
|
||||||
if ( key.startsWith(prefix) ) {
|
if ( key.startsWith(prefix) ) {
|
||||||
const partial_key = key.substr(prefix.length);
|
const partial_key = key.slice(prefix.length);
|
||||||
if ( ! keys.includes(partial_key) )
|
if ( ! keys.includes(partial_key) )
|
||||||
keys.push(partial_key);
|
keys.push(partial_key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -671,7 +671,7 @@ export default class SettingsManager extends Module {
|
||||||
// If we're still here, it means an individual setting was changed.
|
// 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
|
// Look up the profile it belongs to and emit a changed event from
|
||||||
// that profile, thus notifying any contexts or UI instances.
|
// that profile, thus notifying any contexts or UI instances.
|
||||||
key = key.substr(2);
|
key = key.slice(2);
|
||||||
|
|
||||||
// Is it a value?
|
// Is it a value?
|
||||||
const idx = key.indexOf(':');
|
const idx = key.indexOf(':');
|
||||||
|
|
|
@ -54,7 +54,7 @@ module.exports = merge(common, {
|
||||||
publicPath: '',
|
publicPath: '',
|
||||||
map: data => {
|
map: data => {
|
||||||
if ( data.name.endsWith('.scss') )
|
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;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue