You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix singleton unwrapping for $each, $spread, and $match (RecoLabs#3)
These three functions returned []any instead of *Sequence,
preventing CollapseSequence from unwrapping single-element
results. This caused parity divergence from jsonata-js:
- $each({"a":1}, fn) returned ["result"] instead of "result"
- $spread({"a":1}) returned [{"a":1}] instead of {"a":1}
- $match("hello", /^h/) returned [{...}] instead of {...}
Return *Sequence from all three so evalFunction properly
singleton-unwraps single-element results. Also introduces
CollapseAndKeep helper in value.go (with shallow struct copy
for alias safety) to centralize KeepArray/singleton logic,
and collapses intermediate results in function composition
to prevent raw *Sequence leaking between composed functions.
Signed-off-by: NirBarak-RecoLabs <nirb@recolabs.ai>
0 commit comments