Skip to content

v0.5.3

Latest

Choose a tag to compare

@NirBarak-RecoLabs NirBarak-RecoLabs released this 06 Oct 11:49
aee1087

Changes

Fixes — jsonata-js conformance (#35)

  • Path semantics:
    • $v, $$ and % steps evaluate once per context item. For example, items.$v maps over items instead of yielding $v once.
    • An array built from one context (a.[b, c]) stays a single item through later steps.
    • #$i counts after a sort or predicate.
    • %, block, function, wildcard and constructor bases filter the whole tuple stream.
    • Grouped items merge the way fn.append does.
    • Subscripts floor fractional indices.
    • WithSequence bounds constructed arrays.
    • Error codes T1008, T0410 and T2002 match jsonata-js.
  • $formatNumber / $formatInteger: half-to-even rounding from the shortest decimal form, exponent mantissas, a decimal separator with nothing after it, negative words, and the D3086/D3093/D3130 checks.
  • Date pictures:
    • $fromMillis: name, fraction and year widths, [Ww], [xn], and [Z]/[z] widths.
    • $toMillis: filling unspecified components, D3136, linear parsing, and case-insensitive zone names.
    • $now, $millis and $toMillis share one timestamp per evaluation.
  • $match / $replace / $split: match objects with next, uncaptured groups as "", undefined, fractional and negative limits (D3040/D3011/D3020), and D1004 on empty matches.
  • Other builtins: $spread([]) returns undefined, $merge errors are T0412, $eval keeps guardrail error codes, and $base64decode accepts unpadded input.
  • Literal path steps: number, boolean and null literals used as path steps (a.true, a.null, a.1[0]) are rejected with S0213 at compile time, as in jsonata-js. (#52)

Tests

  • Coverage rises from 85.0% to 92.7%: every example program runs under go test, parser robustness tests seed FuzzParse, and fast-path vs full-evaluation parity is tested.

  • npm: gnata-js@0.5.3