Skip to content

Commit 61bb42f

Browse files
author
Andrea Cosentino
committed
fix: removeSlash
1 parent c39c751 commit 61bb42f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/utils/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,10 +351,10 @@ export const Utils = {
351351
removeSlash(url: string, type: "leading" | "trailing" | "both") {
352352
let newUrl = url;
353353
if (["both", "leading"].includes(type)) {
354-
newUrl.startsWith("/") && (newUrl = newUrl.substring(1));
354+
newUrl = newUrl.replace(/^\/+/, "");
355355
}
356356
if (["both", "trailing"].includes(type)) {
357-
newUrl.endsWith("/") && (newUrl = newUrl.substring(0, newUrl.length - 1));
357+
newUrl = newUrl.replace(/\/+$/, "");
358358
}
359359
return newUrl;
360360
},

0 commit comments

Comments
 (0)