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

[bug] JSONata mutates bindings passed as arguments during evaluate call #590

Open
asennikov opened this issue Aug 24, 2022 · 0 comments
Open

Comments

@asennikov
Copy link

I've noticed by accident that JSONata mutates the variable passed to the evaluate method call, if evaluation fails due to an error associated with that variable, here's the reproduction branch: #589

it("should not mutate bound variable on failure", function() {
    var expr = jsonata("$myVariable()");
    var myVariable = { "foo": "bar" };
    try {
        expr.evaluate(testdata2, { myVariable });
    } catch (e) {
        // ignore the evaluation error
    }
    expect(myVariable).to.deep.equal({ "foo": "bar" });
});

image

@asennikov asennikov changed the title JSONata mutates bindings passed as arguments during evaluate call [bug] JSONata mutates bindings passed as arguments during evaluate call Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant