Repository navigation
Changes
Fixes — jsonata-js conformance (#35)
- Path semantics:
$v,$$and%steps evaluate once per context item. For example,items.$vmaps overitemsinstead of yielding$vonce.- An array built from one context (
a.[b, c]) stays a single item through later steps. #$icounts after a sort or predicate.%, block, function, wildcard and constructor bases filter the whole tuple stream.- Grouped items merge the way
fn.appenddoes. - Subscripts floor fractional indices.
WithSequencebounds 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,$millisand$toMillisshare one timestamp per evaluation.
$match/$replace/$split: match objects withnext, uncaptured groups as"", undefined, fractional and negative limits (D3040/D3011/D3020), and D1004 on empty matches.- Other builtins:
$spread([])returns undefined,$mergeerrors are T0412,$evalkeeps guardrail error codes, and$base64decodeaccepts 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 seedFuzzParse, and fast-path vs full-evaluation parity is tested. -
npm:
gnata-js@0.5.3