ensure that there is at least one trailing slash at the end.
import { assertEquals } from "jsr:@std/assert"// aliasing our functions for brevityconst eq = assertEquals, fn = ensureEndSlasheq(fn("///a/b.zip//"), "///a/b.zip//")eq(fn(".///../a/b.zip/"), ".///../a/b.zip/")eq(fn(".///../a/b.zip/."), ".///../a/b.zip/./")eq(fn(".///../a/b.zip/./"), ".///../a/b.zip/./")eq(fn(".///../a/b.zip/.."), ".///../a/b.zip/../")eq(fn(".///../a/b.zip/../"), ".///../a/b.zip/../")eq(fn("file:///a/b.zip//c.txt"), "file:///a/b.zip//c.txt/") Copy
import { assertEquals } from "jsr:@std/assert"// aliasing our functions for brevityconst eq = assertEquals, fn = ensureEndSlasheq(fn("///a/b.zip//"), "///a/b.zip//")eq(fn(".///../a/b.zip/"), ".///../a/b.zip/")eq(fn(".///../a/b.zip/."), ".///../a/b.zip/./")eq(fn(".///../a/b.zip/./"), ".///../a/b.zip/./")eq(fn(".///../a/b.zip/.."), ".///../a/b.zip/../")eq(fn(".///../a/b.zip/../"), ".///../a/b.zip/../")eq(fn("file:///a/b.zip//c.txt"), "file:///a/b.zip//c.txt/")
ensure that there is at least one trailing slash at the end.
Example