trim leading and trailing forward-slashes, at the beginning and end of a string. this is a combination of trimStartSlashes and trimEndSlashes, so see their doc comments for more precise test cases.

import { assertEquals } from "jsr:@std/assert"

// aliasing our functions for brevity
const eq = assertEquals, fn = trimSlashes

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(".///../a/b.zip//"), ".///../a/b.zip")
eq(fn("file:///a/b.zip//c.txt"), "file:///a/b.zip//c.txt")