cel-ts: Common Expression Language (CEL) implementation in TypeScript
CEL is an expression language developed by Google, used for configuration files and policy definitions. This library is implemented in TypeScript based on the cel-go design.
import { Env, Variable, IntType } from "cel-ts";// Create an environmentconst env = new Env({ variables: [new Variable("x", IntType)],});// Compile an expressionconst ast = env.compile("x + 1");// Create and run a programconst program = env.program(ast);const result = program.eval({ x: 10n });console.log(result.value()); // 11n Copy
import { Env, Variable, IntType } from "cel-ts";// Create an environmentconst env = new Env({ variables: [new Variable("x", IntType)],});// Compile an expressionconst ast = env.compile("x + 1");// Create and run a programconst program = env.program(ast);const result = program.eval({ x: 10n });console.log(result.value()); // 11n
cel-ts: Common Expression Language (CEL) implementation in TypeScript
CEL is an expression language developed by Google, used for configuration files and policy definitions. This library is implemented in TypeScript based on the cel-go design.
Example