Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: replace deprecated String.prototype.substr() #3702

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

CommanderRoot
Copy link

What:

Replacing usage of .substr() with .slice()

Why:

String.prototype.substr() is deprecated.

Checklist:

  • Documentation N/A
  • Added/updated unit tests N/A
  • Code complete

.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated
Signed-off-by: Tobias Speicher <[email protected]>
@iChenLei iChenLei requested a review from matthew-dean March 18, 2022 00:58
@iChenLei
Copy link
Member

Thanks for your contribution, @matthew-dean sir, what'r you opinion ? Do we need replace substr with slice now? (To be honest, I never use substr on my own code.

@matthew-dean
Copy link
Member

Oh interesting, I had no idea it was deprecated. However, I'm wary of this drop-in replace with .slice. The MDN document doesn't say that it's a drop-in replacement, and gives a different polyfill.

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.

3 participants