0.2.0 • Published 5 months ago
@bufbuild/cel v0.2.0
@bufbuild/cel
This package provides a CEL evaluator 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