github expr-lang/expr v1.15.0

latest releases: v1.16.9, v1.16.8, v1.16.7...
12 months ago

Expr is a Go-centric expression language designed to deliver dynamic configurations with unparalleled accuracy, safety, and speed.

expr repl demo

In this release:

  • Added support for variables.
    let foo = filter(tweets, .Text contains "foo");
    let name = foo?.Author?.Name ?? "unknown";
    upper(name)
  • Added configuration to enable/disable builtin functions.
  • Added a bunch of optimizations for builtin function combinations:
    • len(filter()) and map(filter())
    • filter()[0] and filter()[-1]
  • Added a bunch of new builtin functions:
    • sort, sortBy
    • groupBy
    • toPairs, fromPairs
    • take, reduce, mean, median.
  • Fixed in-range optimization to be only applied to integers.
  • Fixed float folding optimization.
  • Fixed duration*integer mutliplications.
  • Improved language and developer documentation.

Examples:

tweets | filter(.Size < 280) | map(.Content) | join(" -- ")
filter(posts, {
    let span = now() - .CreatedAt;
    let limit = 7 * duration("24h");
    span >= limit
})

Don't miss a new expr release

NewReleases is sending notifications on new releases.