Skip to content

refactor: replace deprecated String.prototype.substr()#1223

Merged
lamweili merged 1 commit intolog4js-node:masterfrom
CommanderRoot:refactor/rm-deprecated-substr
Mar 28, 2022
Merged

refactor: replace deprecated String.prototype.substr()#1223
lamweili merged 1 commit intolog4js-node:masterfrom
CommanderRoot:refactor/rm-deprecated-substr

Conversation

@CommanderRoot
Copy link
Copy Markdown
Contributor

@CommanderRoot CommanderRoot commented Mar 27, 2022

String.prototype.substr() is deprecated so we replace it with String.prototype.slice() which works similarily but isn't deprecated. While String.prototype.substring() isn't deprecated I replaced it with slice() as well. slice() is generally a bit faster (and uses less bites as the name is shorter) and this way we don't have 2 functions which nearly do the same thing in the code.
.substr() probably isn't going away anytime soon but the change is trivial so it doesn't hurt to do it.

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

Signed-off-by: Tobias Speicher <[email protected]>
@lamweili lamweili added this to the 6.4.5 milestone Mar 28, 2022
@lamweili lamweili merged commit 20607e8 into log4js-node:master Mar 28, 2022
@lamweili lamweili self-requested a review March 28, 2022 06:43
Copy link
Copy Markdown
Contributor

@lamweili lamweili left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants