def text_value

mlbend-huggingface@0.1.1.0 · main.bend:180

import mlbend-huggingface@0.1.1.0/main.bend as MlbendHuggingface
import Base
import bend-kit-json@0.6.1.1/json.bend as Json
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes

180# The text of a JSON value, when it is a string or a number.
181def text_value(v: Json.Val) -> Maybe<&1, String>:
182  match v:
183    case Json.Str{s}:
184      Some{Bytes.to_string(s)}
185    case Json.Num{s}:
186      Some{Bytes.to_string(s)}
187    case _:
188      None{}

Uses (4)

Used by (2)