-
-
Notifications
You must be signed in to change notification settings - Fork 235
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
Refactor collapseLeadingSlashes function for simplicity and readability #183
base: master
Are you sure you want to change the base?
Refactor collapseLeadingSlashes function for simplicity and readability #183
Conversation
Replaced the manual loop with `padStart` to simplify the code and improve readability. This aligns with modern JavaScript practices, making the function more concise and easier to maintain. No functional changesjust a cleaner, more efficient approach to padding numbers with leading zeros.
Replaced the old implementation of collapseLeadingSlashes, which iterated over each character, with a more concise and efficient version using a regular expression. The new version uses eplace() to collapse leading slashes into a single slash and handles empty strings by returning '/'. This update improves code readability and leverages modern JavaScript string methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @Ayoub-Mabrouk! ❤️
Can you lint the code?
Replaced the old implementation of collapseLeadingSlashes, which iterated over each character, with a more concise and efficient version using a regular expression. The new version uses eplace() to collapse leading slashes into a single slash and handles empty strings by returning '/'. This update improves code readability and leverages modern JavaScript string methods.
Replaced the manual loop with `padStart` to simplify the code and improve readability. This aligns with modern JavaScript practices, making the function more concise and easier to maintain. No functional changesjust a cleaner, more efficient approach to padding numbers with leading zeros.
…e manual loop with padStart to simplify the code and improve readability. This aligns with modern JavaScript practices, making the function more concise and easier to maintain. No functional changesjust a cleaner, more efficient approach to padding numbers with leading zeros.
…ub-Mabrouk/serve-static into chore/collapseLeadingSlashes
Replaced the old implementation of collapseLeadingSlashes, which iterated over each character, with a more concise and efficient version using a regular expression. The new version uses eplace() to collapse leading slashes into a single slash and handles empty strings by returning '/'. This update improves code readability and leverages modern JavaScript string methods.
…ub-Mabrouk/serve-static into chore/collapseLeadingSlashes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR feels like a style change? While I am not opposed to the new style, I dont think we gain anything from this and so should decline.
Replaced the old implementation of collapseLeadingSlashes, which iterated over each character, with a more concise and efficient version using a regular expression. The new version uses
eplace() to collapse leading slashes into a single slash and handles empty strings by returning '/'. This update improves code readability and leverages modern JavaScript string methods.