cookie-parser icon indicating copy to clipboard operation
cookie-parser copied to clipboard

Refactor: use slice() instead of deprecated substr() to avoid future issues

Open sarraf1996 opened this issue 1 year ago • 5 comments

This Pull Request (PR) is created for issue #110 and needs review to merge it.

What does this PR do?

This pull request replaces all occurrences of the deprecated substr() method with slice() in the codebase.

Why is this needed?

The substr() method is deprecated and may lead to issues or warnings in future JavaScript versions. This update ensures the code remains future-proof and compliant with modern JavaScript standards.

How does it address the issue?

Each instance of substr() has been refactored to slice() to maintain the same functionality.

Are there any side effects?

This change should not introduce any side effects. Both substr() and slice() have similar behavior, with the exception of how they handle negative indices. All instances in the codebase have been reviewed to ensure compatibility.

Additional Context

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

sarraf1996 avatar Sep 29 '24 12:09 sarraf1996

@defunctzombie @dougwilson

When you have a moment, could you please review my pull request? I’d appreciate your feedback and any suggestions for improvement.

Thank you for your time and consideration.

sarraf1996 avatar Oct 01 '24 11:10 sarraf1996

@IamLizu Thanks for reviewing and approving this PR.

As the pull request has been approved, it is now ready for merging. Please feel free to proceed if there are no further concerns.

sarraf1996 avatar Oct 02 '24 18:10 sarraf1996

Hello, @sarraf1996. Maybe I am a bit late, but I also reviewed your PR by merging it locally, and tested it. It looks great to me too. Screenshot 2024-10-02 at 2 19 06 PM

gitdevjin avatar Oct 02 '24 18:10 gitdevjin

@sarraf1996 thank you for being an awesome contributor. Please allow us some time before your PR lands.

@gitdevjin Good work! Do you know that you can check a PR without merging the branch? You can use,

gh pr checkout 111

Here 111 is the PR number in GitHub and gh is a cli tool of GitHub.

IamLizu avatar Oct 04 '24 17:10 IamLizu

@IamLizu Thanks for the great tip! I didn't know that. I'll definitely check it out!

gitdevjin avatar Oct 04 '24 17:10 gitdevjin