# @bufbuild/cel

> A CEL evaluator for ECMAScript

Latest version **0.6.1** (published 2026-08-27) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @bufbuild/cel
pnpm add @bufbuild/cel
yarn add @bufbuild/cel
bun add @bufbuild/cel
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.6.1 |
| Published | 2026-08-27 |
| First published | 2025-04-30 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 880.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 38 |
| Maintainers | bufdev, tstamm-buf, bufbot, jdailey_buf, doriakeung, cmahony |
| Keywords | javascript, typescript, protobuf, cel, common-expression-language |

## Links

- npm: https://www.npmjs.com/package/@bufbuild/cel
- Repository: https://github.com/bufbuild/cel-es
- Homepage: https://github.com/bufbuild/cel-es#readme
- Issues: https://github.com/bufbuild/cel-es/issues
- npm.io page: https://npm.io/package/@bufbuild/cel

## Dependencies (2)

- [@bufbuild/re2](https://npm.io/package/@bufbuild/re2.md) 0.6.1
- [@bufbuild/cel-spec](https://npm.io/package/@bufbuild/cel-spec.md) 0.6.1

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.6.1 (latest) — 2026-08-27
- 0.6.0 — 2026-06-01
- 0.5.0 — 2026-05-06
- 0.4.0 — 2026-01-20
- 0.3.0 — 2025-07-28
- 0.2.0 — 2025-06-04
- 0.1.0 — 2025-05-02
- 0.0.1 — 2025-04-30

## README

# @bufbuild/cel

This package provides a [CEL](https://cel.dev) evaluator for ECMAScript.

## Example

Let's evaluate a CEL expression that has the variable `name` and uses the `strings` extension functions:

```ts
import { run } from "@bufbuild/cel";
import { strings } from "@bufbuild/cel/ext";

run(
  `name.indexOf('taco') == 0`, // CEL expression to run
  { name: "tacocat" }, // Bind a value to the variable `name`
  { funcs: strings }, // Register `indexOf` and other string extensions
); // true
```

That's it!

For an example of creating a reusable evaluator and more, refer to [example.ts](https://github.com/bufbuild/cel-es/blob/main/packages/example/src/example.ts).

### Types

The table below maps JS types to CEL types.

- `Input` column is any value that can be passed to the evaluator as input. (`CelInput`)
- `CEL Type` column is the CEL type it will represent at runtime. (`CelType`)
- `Output` column is the type of values that are returned by the evaluator, either as returned from `eval` or as arguments to function implementations. (`CelValue`)

| Input (JS Type) | CEL Type (runtime) | Output (JS Type) |
| --- | --- | --- |
| number, {Float,Double}Value | double | number |
| bigint, all signed int wrappers | int | bigint |
| CelUint, all unsigned int wrappers | uint | CelUint |
| string, StringValue | string | string |
| Uint8Array, BytesValue | bytes | Uint8Array |
| Map, ReflectMap | map | CelMap |
| any[], ReflectList | list | CelList |
| boolean, BoolValue | bool | boolean |
| null | null_type | null |
| CelType | type | CelType |
| Timestamp, ReflectMessage | timestamp | ReflectMessage |
| Duration, ReflectMessage | duration | ReflectMessage |
| Message, ReflectMessage, Any | \<typeName> | ReflectMessage |
| google.protobuf.Value and friends | double/bool/string/list/map/null | number/boolean/string/CelList/CelMap |

---
_Source: https://npm.io/package/@bufbuild/cel · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
