mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-22 00:10:25 +01:00
refactor: replace deprecated String.prototype.substr() (#10432)
.substr() is deprecated 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:
@@ -335,7 +335,7 @@
|
||||
// see https://github.com/NodeBB/NodeBB/issues/4378
|
||||
tag = tag.replace(/\u202E/gi, '');
|
||||
tag = tag.replace(/[,/#!$^*;:{}=_`<>'"~()?|]/g, '');
|
||||
tag = tag.substr(0, maxLength || 15).trim();
|
||||
tag = tag.slice(0, maxLength || 15).trim();
|
||||
const matches = tag.match(/^[.-]*(.+?)[.-]*$/);
|
||||
if (matches && matches.length > 1) {
|
||||
tag = matches[1];
|
||||
@@ -652,7 +652,7 @@
|
||||
);
|
||||
|
||||
if (key) {
|
||||
if (key.substr(-2, 2) === '[]') {
|
||||
if (key.slice(-2) === '[]') {
|
||||
key = key.slice(0, -2);
|
||||
}
|
||||
if (!hash[key]) {
|
||||
|
||||
Reference in New Issue
Block a user