Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,18 +127,14 @@ function serveStatic (root, options) {

/**
* Collapse all leading slashes into a single slash
*
* @param {string} str
* @returns {string}
* @private
*/
function collapseLeadingSlashes (str) {
for (var i = 0; i < str.length; i++) {
if (str.charCodeAt(i) !== 0x2f /* / */) {
break
}
}

return i > 1
? '/' + str.substr(i)
: str
function collapseLeadingSlashes (str) {
return str.replace(/^\/+/, '/') || '/'
}

/**
Expand Down
8 changes: 1 addition & 7 deletions scripts/version-history.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,5 @@ function repeat (str, length) {
}

function zeroPad (number, length) {
var num = number.toString()

while (num.length < length) {
num = '0' + num
}

return num
return number.toString().padStart(length, '0')
}
Loading