-
Notifications
You must be signed in to change notification settings - Fork 247
Description
Hello I was wondering if there was a better way of calling evaluate. To expand, currently in Jsonata to evaluate on a set of data we execute the following code:
`
var jsonata = require("jsonata");
var data = {
example: [
{value: 4},
{value: 7},
{value: 13}
]
};
var expression = jsonata("$sum(example.value)");
var result = expression.evaluate(data); // returns 24
`
As we can see in this code, when we call expression.evaluate we are calling it on a set of js/json data. Currently I am writing an internal script which calls the expression.evalute on a set of the same data each time a new expression is put in the jsonata function to get the expression. I was wondering if there was perhaps a way to simple call our expression.evaluate on a set of data once, and then call jsonata(--some expression--) multiple times as our data is never changing and only are input expressions are. If further clarification is needed I can provide it.
I should note I understand I can assign variables to certain values and hold it in memory, but was wondering if I could do this similar thing to entire json files. Again if this is confusing I can provide examples of my issue.