Socket
Book a DemoInstallSign in
Socket

@bufbuild/cel

Package Overview
Dependencies
Maintainers
7
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bufbuild/cel

A CEL evaluator for ECMAScript

0.3.0
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
7
Weekly downloads
 
Created
Source

@bufbuild/cel

This package provides a CEL evaluator for ECMAScript.

Example

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

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

run(
  `name.indexOf('taco') == 0`,
  {name: "tacocat"},
  {funcs: STRINGS_EXT_FUNCS },
); // true

That's it!

For an example of creating resusable evaluator and more, refer to the 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}Valuedoublenumber
bigint, all signed int wrappersintbigint
CelUint, all unsigned int wrappersuintCelUint
string, StringValuestringstring
Uint8Array, BytesValuebytesUint8Array
Map, ReflectMapmapCelMap
any[], ReflectListlistCelList
boolean, BoolValueboolboolean
nullnull_typenull
CelTypetypeCelType
Timestamp, ReflectMessagetimestampReflectMessage
Duration, ReflectMessagedurationReflectMessage
Message, ReflectMessage, Any<typeName>ReflectMessage
google.protobuf.Value and friendsdouble/bool/string/list/map/nullnumber/boolean/string/CelList/CelMap

Keywords

javascript

FAQs

Package last updated on 28 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.