def text

emerging-ezjson@1.3.0.0 · src/pull.bend:1649

import emerging-ezjson@1.3.0.0/src/pull.bend as Pull
import Base
import emerging-ezjson@1.3.0.0/src/value.bend as V

1649# the text of a string, a key, or a number. A span is copied here. None when
1650# the event is not one of those
1651def text(ev: Ev) -> Maybe<&2, String>:
1652  match ev:
1653    case EStr{body}:
1654      Some{body}
1655    case EKey{body}:
1656      Some{body}
1657    case EStrS{src, +nn}:
1658      Some{V.span.str(src, nn, U32.is_zero(nn))}
1659    case EKeyS{src, +nn}:
1660      Some{V.span.str(src, nn, U32.is_zero(nn))}
1661    case ENum{src, +nn}:
1662      Some{V.span.str(src, nn, U32.is_zero(nn))}
1663    case other:
1664      None{}

Uses (5)

Used by (1)