mirror of
https://github.com/nodejs/node.git
synced 2025-05-15 05:00:15 +00:00

PR-URL: https://github.com/nodejs/node/pull/42744 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
11 lines
238 B
JavaScript
11 lines
238 B
JavaScript
const removeTrailingSlashes = (input) => {
|
|
// in order to avoid regexp redos detection
|
|
let output = input
|
|
while (output.endsWith('/')) {
|
|
output = output.slice(0, -1)
|
|
}
|
|
return output
|
|
}
|
|
|
|
module.exports = removeTrailingSlashes
|