https://github.com/bufbuild/cel-es
Common Expression Language for ECMAScript
https://github.com/bufbuild/cel-es
cel common-expression-language javascript protobuf protocol-buffers typescript
Last synced: 12 months ago
JSON representation
Common Expression Language for ECMAScript
- Host: GitHub
- URL: https://github.com/bufbuild/cel-es
- Owner: bufbuild
- License: apache-2.0
- Created: 2023-06-23T16:34:21.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-06-25T19:19:57.000Z (12 months ago)
- Last Synced: 2025-06-25T19:25:41.648Z (12 months ago)
- Topics: cel, common-expression-language, javascript, protobuf, protocol-buffers, typescript
- Language: TypeScript
- Homepage:
- Size: 1.72 MB
- Stars: 10
- Watchers: 6
- Forks: 2
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
[][buf]
# CEL-ES
[](./LICENSE) [](https://www.npmjs.com/package/@bufbuild/cel) [](https://www.npmjs.com/package/@bufbuild/cel-spec)
An implementation of [Common Expression Language (CEL)][cel] for ECMAScript.
## Example
Let's create a CEL environment, and define the variable `name`:
```ts
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`:
```ts
env.run(`
name.startsWith('taco')
`); // true
```
## Packages
- [@bufbuild/cel](https://www.npmjs.com/package/@bufbuild/cel):
Provides a CEL evaluator for ECMAScript.
- [@bufbuild/cel-spec](https://www.npmjs.com/package/@bufbuild/cel-spec):
Provides CEL definitions and test data from [github.com/google/cel-spec](https://github.com/google/cel-spec).
## Status: Beta
This project is in beta.
## Legal
Offered under the [Apache 2 license][license].
[buf]: https://buf.build
[cel]: https://cel.dev
[license]: LICENSE
[contributing]: .github/CONTRIBUTING.md