Repository navigation
v3.0.0
3.0.0 (2025-10-25)
Bug Fixes
- 🐛 Function overloads now properly support dyn (dynamic) argument types. (2668f94)
Overlapping function overloads are validated during function registration.const env = new Environment() // This function now correctly accepts any type as argument env.registerFunction('process(dyn): string', (x) => `processed: ${x}`) env.evaluate('process(42)') // Works with integers env.evaluate('process("hello")') // Works with strings env.evaluate('process([1, 2])') // Works with lists // ⚠️ Overlapping function parameters (dyn together with regular ones) throw an error env.registerFunction('process(int): string', (x) => `processed: ${x}`) // Throws: Function signature 'process(int): string' overlaps with existing overload 'process(dyn): string'
BREAKING CHANGES
-
💥 Remove legacy format for custom function. Please use the
new Environment().registerFunctioninstead. (eb37f88)
The third argument toevaluate('max(a, b) == 15.0', {a: 5, b: 15}, fns)is not supported anymore.
Also the second argument to the return value ofparse('max(a, b) == 15.0')({a: 5, b: 15}, fns)is not supported anymore.// ❌ Old (no longer works) const context = {a: 5, b: 15} const functions = {max: (x, y) => x > y ? x : y} evaluate('max(a, b)', context, functions) parse('max(a, b)')(context, functions) // ✅ New (use Environment) import {Environment} from 'cel-js' const env = new Environment() env.registerFunction('max(dyn, dyn): dyn', (x, y) => x > y ? x : y) env.evaluate('max(a, b)', {a: 5, b: 15}) // Or with parse: const parsed = env.parse('max(a, b)') parsed({a: 5, b: 15})