-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Additional: Replace deprecated substr() with slice() and charAt() in cifES.js #2520
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
Additional: Replace deprecated substr() with slice() and charAt() in cifES.js #2520
Conversation
Co-authored-by: bytestream <1788397+bytestream@users.noreply.github.com>
|
@copilot revert the changes to |
Co-authored-by: bytestream <1788397+bytestream@users.noreply.github.com>
|
@copilot do not modify |
Co-authored-by: bytestream <1788397+bytestream@users.noreply.github.com>
|
@copilot is there ever a case where |
No, Line 98 calculates:
Line 99 handles the edge case:
Final range: |
Fix deprecated substr() usage in cifES.js
Issue: The
String.prototype.substr()method is deprecated in JavaScript.Changes Made:
( all_sum ).toString().substr( -1 )with( all_sum ).toString().slice( -1 )"JABCDEFGHI".substr( control_digit, 1 )with"JABCDEFGHI".charAt( control_digit )Technical Details:
slice(-1)extracts the last character, equivalent tosubstr(-1)charAt(index)extracts a single character at the specified index, equivalent tosubstr(index, 1)slice()andcharAt()are standard, non-deprecated methodsTesting:
The changes are minimal and surgical - only 2 lines modified in
src/additional/cifES.jsto replace the deprecated method with modern alternatives.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.