Replace deprecated String.prototype.substr() (#17949)

* Replace deprecated String.prototype.substr()

.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated

* Change String.prototype.substring() to String.prototype.slice()

.substring() and .slice() work very similary but .slice() is a bit faster and stricter

* Add ESLint rule to forbid usage of .substr and .substring

.substr() is deprecated and .substring() is very similar to .slice() so better to use .slice() at all times

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
This commit is contained in:
CommanderRoot 2022-04-04 18:19:45 +02:00 committed by GitHub
parent 80ded02a4b
commit 0ec695e036
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 3 deletions

View file

@ -91,7 +91,7 @@ export const fileNameFromURL = str => {
const pathname = url.pathname;
const index = pathname.lastIndexOf('/');
return pathname.substring(index + 1);
return pathname.slice(index + 1);
};
export default @injectIntl