def as_str

emerging-ezjson@1.3.0.0 · src/value.bend:466

import emerging-ezjson@1.3.0.0/src/value.bend as Value
import Base

466# a string, or none when the value is not one
467def as_str(val: Json) -> Maybe<&2, String>:
468  match val:
469    case JStr{s}:
470      Some{s}
471    case JSpan{src, +n}:
472      Some{span.str(src, n, U32.is_zero(n))}
473    case other:
474      None{}

Uses (5)

Used by (1)