jmespath.js icon indicating copy to clipboard operation
jmespath.js copied to clipboard

Allow addition of custom functions via decorate()

Open darrenmothersele opened this issue 4 years ago • 0 comments

This pull request contains various fixes I have made:

  • npm audit fix
  • allow addition of custom functions
  • allow caching of compiled expressions
  • a couple of minor changes proposed in other PRs

The main difference is that I've added a decorate() function.

The decorate function allows you to add entries to the runtime's built in function table. The return value from this decorate function is a curried function (takes arguments one at a time) that takes the search expression and then the data to search. Because it's curried it means you can cache the parsed expression and run it against multiple data sets.

PR includes basic tests for the decorate() function.

darrenmothersele avatar Feb 27 '20 17:02 darrenmothersele