Closed naivefun closed 2 years ago
Sorry for the late response on this!
At the moment, dynamic creation of functions is not supported. This was actually a big topic of discussion a few years back, but we didn't get to an implementation that was bulletproof and upheld all of Jexl's security features, so it was iced.
What you CAN do, if you're able to predict the kinds of mappings you'll need, is write those as transforms instead. Then from inside the expression, simply pipe your value to the named transform.
I'm going to close this since it's not currently in the scope of the project, but I'm happy to review any PR or proposal that implements closures in a sane way.
for example:
[1,2,3]
to[1,4,9]
or object array with different object property name?
[{name: 'a'}]
to[{Name: 'a'}]
something like projections here: https://jmespath.org/tutorial.html#projections