serve-static icon indicating copy to clipboard operation
serve-static copied to clipboard

perf: optimize collapseLeadingSlashes function

Open Phillip9587 opened this issue 6 months ago • 1 comments

This pull request refactors the collapseLeadingSlashes function in index.js to improve readability and performance by simplifying the loop and replacing substr with slice.

Code readability and performance improvements:

  • index.js: Simplified the collapseLeadingSlashes function by combining the loop condition and increment into a single line, and replaced the deprecated substr method with the more modern slice method for better compatibility.

Phillip9587 avatar Apr 28 '25 21:04 Phillip9587