Setload.norm.kind: def of cswap-bend-cli@0.1.0.0 Import: import cswap-bend-cli@0.1.0.0/setload.bend as Setload Lines 97-110 of cswap-bend-cli@0.1.0.0/setload.bend: https://jend.leeeet.dev/read.txt?path=cswap-bend-cli@0.1.0.0/setload.bend&start_line=97&end_line=110 import Base import cswap-bend-cli@0.1.0.0/json.bend as Json import cswap-bend-cli@0.1.0.0/settings.bend as Settings # One setting's lenient value: clamped into range, or the default for a value # of the wrong type. def norm.kind(kind: Settings.Sort, lo: String, hi: String, choices: String, dflt: Json.Json, v: Json.Json) -> Json.Json: match kind: case Settings.KFloat{}: norm.numv(False{}, lo, hi, dflt, v) case Settings.KInt{}: norm.numv(True{}, lo, hi, dflt, v) case Settings.KBool{}: Json.JBool{truthy(v)} case Settings.KChoice{}: norm.choice(choices, dflt, v) case Settings.KString{}: norm.str(dflt, v) Uses (8): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/json.bend&name=Json https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/setload.bend&name=norm.choice https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/setload.bend&name=norm.numv https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/setload.bend&name=norm.str https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/setload.bend&name=truthy https://jend.leeeet.dev/definition.txt?path=cswap-bend-cli@0.1.0.0/settings.bend&name=Sort