def valid
import bendvy-ecs-core@0.1.0.3/decode_utf16.bend as DecodeUtf16import Base
2# JS strings are UTF-16 code-unit sequences, including lone surrogates.
3# Bend String is Unicode-scalar text; no invalid Chr is constructed here.
4def valid(units:List<&2,U32>) -> Bool:
5 match units:
6 case []: True{}
7 case unit <> tail: U32.is_le(unit,65535) && valid(tail)