Releases: bitcode-framework/expr-js
Releases · bitcode-framework/expr-js
v1.17.8
TypeScript port of expr-lang/expr v1.17.8.
Highlights
- Dual output: ESM + CJS + type declarations
- 60+ builtin functions — len, max, min, sum, type, keys, values, sort, string/math/date helpers
- Full language surface — arithmetic, comparison, logical, bitwise operators
- Ternary
? :andif {} else {}conditionals letdeclarations, sequences (;), member access, optional chaining (?.), slicing, ranges (1..5)- Pipes (
|), nil-coalescing (??) - Predicates — all, any, none, one, filter, map, count, find, findIndex, findLast, findLastIndex, groupBy, sortBy, reduce
- Compile-time type checker via
Env() - Optimizer — constant folding, predicate fusion, in_array, in_range, sum/map optimizations
- AST patchers, custom functions, operator overloading
- Zero runtime dependencies
- Parity testing infrastructure with Go fixture generator
Numeric Model
Go semantics preserved in TypeScript:
- Go
int/int64→ JSbigint - Go
float64→ JSnumber
Install
npm install @bitcode-framework/expr-jsUsage
import { Compile, Run, Eval } from '@bitcode-framework/expr-js';
Eval('1 + 2', null); // => 3n
Eval('user.age >= 18', { user: { age: 21 } }); // => true
const program = Compile('price * qty');
Run(program, { price: 10n, qty: 3n }); // => 30n