Skip to content

Expr Playground provides a simple and user-friendly interface to write and quickly evaluate Expr expressions.

License

Notifications You must be signed in to change notification settings

polds/expr-playground

Repository files navigation

Expr Playground

GitHub Go Report Card

Expr Playground is an interactive WebAssembly (Wasm) powered environment to explore and experiment with Expr-lang. It provides a simple and user-friendly interface to write and quickly evaluate Expr expressions.

Credits

This project is forked from CEL Playground and modified to support Expr. Please be sure to check out their project and give them a star as well!

Expr libraries

Expr Playground is built by compiling Go code to WebAssembly. At present only the Expr engine is available in this environment. We will look at injecting some other utilities to make this environment more useful, on-par with the the CEL standard library and CEL Playground.

Take a look at all the environment options.

Playground Methods

The following custom methods are available in the playground:

isSorted(array)

Returns whether the list is sorted in ascending order.

isSorted([1, 2, 3]) == true
isSorted([1, 3, 2]) == false
isSorted(["apple", "banana", "cherry"]) == true

This custom function is importable in your own Expr code by importing github.com/polds/expr-playground/functions and adding functions.IsSorted() to your environment. The library supports sorting on types that satisfy the sort.Interface interface.

Development

Build the Wasm binary:

make build

Serve the static files:

make serve

Contributing

We appreciate your contribution. Please refer to our contributing guideline for further information. This project adheres to the Contributor Covenant code of conduct.

License

Expr Playground and the original CEL Playground is available under the Apache 2.0 license. See the LICENSE file for more info.