-
Notifications
You must be signed in to change notification settings - Fork 220
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
Is there a way to assign a Jsonata function? #406
Labels
Comments
The alternate approaches I'm exploring are:
which works, but only for 1-arg functions |
Going back to your original code, it works if you add
|
Makes sense. The bindings must be JavaScript constructs, and the way to turn a Jsonata function to a Javascript function is not to compile it, but to evaluate it. Thanks, Andrew! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I want to add several "helper functions" to my jsonata expressions. For example, take this expression evaluated against the Invoice model:
yields:
"Firefly is active"
I can write a function with the neat transformation syntax and do this:
which yields:
"Firefly is cancelled"
:(I am trying to add such extension functions, which are written in Jsonata, using assign. But assign only accepts a literal or a javascript function. I want to do something like this:
I've tried using a few of the compiled function's internals which I spied. Still no luck.
Is it possible to do? Thanks.
The text was updated successfully, but these errors were encountered: