def matches

bend-kit-router@0.2.0.0 · router.bend:138

import bend-kit-router@0.2.0.0/router.bend as Router
import Base

138def matches(pat: List<&2, Segment>, got: List<&2, String>) -> Bool:
139  match pat got:
140    case Nil{} Nil{}:
141      True{}
142    case Literal{p} <> pt g <> gt:
143      continue(String.eq(p, g), u => matches(pt, gt))
144    case Parameter{name} <> pt +g <> gt:
145      continue(Bool.not(String.is_empty(g)), u => matches(pt, gt))
146    case _ _:
147      False{}

Uses (8)

Used by (2)