Skip to content

Common Expression Language for ECMAScript

License

Notifications You must be signed in to change notification settings

bufbuild/cel-es

Repository files navigation

The Buf logo

CEL-ES

License NPM Version NPM Version

An implementation of Common Expression Language (CEL) for ECMAScript.

Example

Let's create a CEL environment, and define the variable name:

import { createEnv } from "@bufbuild/cel";
import { createRegistry } from "@bufbuild/protobuf";

const env = createEnv("", createRegistry());
env.set("name", "tacocat");

That's it. The environment is ready to be used for parsing and evaluation.

To parse and evaluate an expression, call run:

env.run(`
  name.startsWith('taco')
`); // true

Packages

Status: Beta

This project is in beta.

Legal

Offered under the Apache 2 license.