We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4eb26be commit eb393f1Copy full SHA for eb393f1
index.js
@@ -127,17 +127,15 @@ function serveStatic (root, options) {
127
128
/**
129
* Collapse all leading slashes into a single slash
130
+ * @param {string} str
131
* @private
132
*/
133
function collapseLeadingSlashes (str) {
- for (var i = 0; i < str.length; i++) {
134
- if (str.charCodeAt(i) !== 0x2f /* / */) {
135
- break
136
- }
137
+ let i
+ for (i = 0; i < str.length && str.charCodeAt(i) === 0x2f; i++);
138
139
return i > 1
140
- ? '/' + str.substr(i)
+ ? '/' + str.slice(i)
141
: str
142
}
143
0 commit comments