File tree Expand file tree Collapse file tree 1 file changed +17
-7
lines changed
Expand file tree Collapse file tree 1 file changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -30,15 +30,25 @@ For simple use cases where you evaluate an expression once:
3030import { evaluate } from " cel-typescript" ;
3131
3232// Basic string and numeric operations
33- await evaluate (" size(message) > 5" , { message: " Hello World" }); // true
33+ await evaluate (
34+ // 1️⃣ Provide a CEL expression
35+ " size(message) > 5" ,
36+ // 2️⃣ Provide a context object
37+ { message: " Hello World" },
38+ ); // true
3439
3540// Complex object traversal and comparison
36- await evaluate (" user.age >= 18 && user.preferences.notifications" , {
37- user: {
38- age: 25 ,
39- preferences: { notifications: true },
40- },
41- }); // true
41+ await evaluate (
42+ // 1️⃣ Provide a CEL expression
43+ " user.age >= 18 && user.preferences.notifications" ,
44+ // 2️⃣ Provide a context object
45+ {
46+ user: {
47+ age: 25 ,
48+ preferences: { notifications: true },
49+ },
50+ },
51+ ); // true
4252```
4353
4454### Compile Once, Execute Multiple Times
You can’t perform that action at this time.
0 commit comments