chore: replace deprecated String.prototype.substr() - #5384
CommanderRoot wants to merge 1 commit into
Conversation
.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 doesn't seem to be fixing any bugs − unless you can demonstrate with a test case that fails before and passes after this PR. Thanks for taking the time, although as you stated these whimsical deprecations never results in any removal (see |
|
It removes a deprecation warning in the IDE. But you're right, unless the function gets removed by browsers or other software which uses this code there is nothing broken. |
lbesecker195
left a comment
There was a problem hiding this comment.
Checked each of the seven replacements: substr(pos, len) becomes slice(pos, pos + len), substr(1, n - 1) becomes slice(1, n), and single-argument calls are unchanged in meaning. All equivalent for the non-negative indices used here. LGTM.
This PR contains a:
Motivation / Use-Case
String.prototype.substr() is deprecated so we replace it with String.prototype.slice() which works similarily but isn't deprecated.
.substr() probably isn't going away anytime soon but the change is trivial so it doesn't hurt to do it.
Breaking Changes
None