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

Replace deprecated substr() with slice() in the codebase #110

Open
sarraf1996 opened this issue Sep 29, 2024 · 4 comments
Open

Replace deprecated substr() with slice() in the codebase #110

sarraf1996 opened this issue Sep 29, 2024 · 4 comments

Comments

@sarraf1996
Copy link

Summary

The substr() method is deprecated in JavaScript and may cause issues or warnings in future versions. To ensure better compatibility and prevent potential runtime issues, we should replace all occurrences of substr() with slice().

Details

Currently, the following functions in index.js file contain instances of substr():

  • JSONCookie(str) {}
  • signedCookie (str, secret) {}

These should be refactored to use slice() instead.

Why It Should Be Fixed

JavaScript's substr() method has been deprecated. Refactoring to use slice() will future-proof the code and prevent potential issues in modern JavaScript environments. This change is necessary for compatibility with new ECMAScript standards and best practices.

Suggested Solution

Replace substr() with slice() in all occurrences.

References

For more details on the deprecation of substr(), see the MDN documentation: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr

@gitdevjin
Copy link

if it is still open, can I try to work on this?

@IamLizu IamLizu assigned gitdevjin and unassigned gitdevjin Oct 2, 2024
@IamLizu
Copy link
Member

IamLizu commented Oct 2, 2024

Hey @gitdevjin 👋

It appears we have a open PR for this one already. Could you please review the PR if you are interested? #111

@gitdevjin
Copy link

@IamLizu
Oh, I am sorry. I think I didn't check the PR.
Yeah I think someone has already made a PR for this issue, and I will review it.
thanks! :)

@sarraf1996
Copy link
Author

@gitdevjin Thanks for reviewing my pull request. Actually, I only created the PR post creating this issue thread.

@IamLizu Thank you for your review and approval. The pull request is now ready for merging. Please proceed if there are no additional concerns or outstanding issues.

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

No branches or pull requests

3 participants