url.bend source
url.bend on the hub · documented module
import Basedef rstrip.go(s: String) -> String: match s: case SNil{}: SNil{} case SCon{Chr{47}, t}: rstrip.go(t) case SCon{h, t}: SCon{h, t}def rstrip(s: String) -> String: String.reverse(rstrip.go(String.reverse(s)))def join.on(b: String, path: String) -> String: match path: case SNil{}: b case SCon{Chr{47}, t}: b ++ SCon{Chr{47}, t} case SCon{h, t}: b ++ "/" ++ SCon{h, t}def join(+base: String, +path: String) -> String: join.on(rstrip(base), path)