Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modification of 1st parameter of $append #139

Closed
HiroyasuNishiyama opened this issue Jan 30, 2018 · 2 comments
Closed

Modification of 1st parameter of $append #139

HiroyasuNishiyama opened this issue Jan 30, 2018 · 2 comments
Labels

Comments

@HiroyasuNishiyama
Copy link
Contributor

The following code produces { a: [ 1 ] } instead of { a: [] }.

var jsonata = require("jsonata");
var data = { a: [] };
var exp = jsonata("$append(a,[1])");
exp.evaluate(data);
console.log(data);

The 1st parameter of $append is modified as a side effect of $append call.
The documentation of $append do not mention this side effect. Also, similar function for array such as $reverse or $sort do not modify their argument.

@andrew-coleman
Copy link
Member

This is a bug. Many thanks for reporting.

@mattbaileyuk
Copy link
Member

Fixed via #142

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants