def take_auth.go

bend-net-url@0.4.0.0 · url.bend:292

import bend-net-url@0.4.0.0/url.bend as Url
import Base

292# §3.2: the authority runs to the first "/", "?" or "#".
293def take_auth.go(s: String, acc: String, hit: Bool) -> String & String:
294  match s:
295    case SNil{}:
296      match hit:
297        case True{}:
298          take.back(acc, SNil{})
299        case False{}:
300          (String.reverse(acc), SNil{})
301    case SCon{Chr{+c}, t}:
302      match hit:
303        case True{}:
304          take.back(acc, SCon{Chr{c}, t})
305        case False{}:
306          take_auth.go(t, SCon{Chr{c}, acc}, auth_end(c))

Uses (8)

Used by (1)