trim all trivial trailing forward-slashes ("/") and dot-slashes ("./"), at the end a string. but exclude non-trivial dotdotslash ("/../") from being wrongfully trimmed.

TODO: this operation is somewhat expensive, because:
the implementation uses regex, however it was not possible for me to design a regex that handles the input string as is, so I resort to reversing the input string, and using a slightly easier-to-design regex that discovers trivial (dot)slashes in reverse order, and then after the string replacement, I reverse it again and return it as the output.

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

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

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