def needs.go

bend-kit-csv@0.3.0.0 · csv.bend:221

import bend-kit-csv@0.3.0.0/csv.bend as Csv
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes

221# Writer
222# ------
223# Does a byte from i on need quotes? n counts the bytes left.
224def needs.go(n: Nat, r: Array<U32> & U32, +i: U32) -> Array<U32> & Bool:
225  match n:
226    case 0n:
227      (a, c) = r
228      (a, False{})
229    case 1n+p:
230      (a, +c) = r
231      match c:
232        case 34:
233          (a, True{})
234        case 44:
235          (a, True{})
236        case 10:
237          (a, True{})
238        case 13:
239          (a, True{})
240        case _:
241          needs.go(p, Bytes.peek(a, (i + 1 : U32)), (i + 1 : U32))

Uses (10)

Used by (1)