Skip to main content
Taion Expression logo

Taion Expression

A safe, sandboxed expression language for evaluating untrusted user input

Documentation for AI coding agents

What can you evaluate?

ExpressionResult
2 + 3 * 414
price * (1 - discount)90
user.age >= 18 ? "Adult" : "Minor""Adult"
toUpperCase("hello world")"HELLO WORLD"
contains(email, "@")true
sum(scores) / length(scores)85
if (total > 100) then total * 0.9 else total135
map([1, 2, 3], x => x * 2)[2, 4, 6]
filter(items, x => x > 3)[4, 5]
`Hello, ${name}!`"Hello, Alice!"
round(avg([10, 20, 33]))21
Quick Example
import { evaluateExpression } from 'taion-expression';

const result = evaluateExpression(
'user.age >= 18 ? "Welcome" : "Too young"',
{ user: { name: 'Alice', age: 25 } }
);

// result = { success: true, result: 'Welcome' }

Safe & Sandboxed

Evaluate untrusted user expressions without risk. Built-in timeout control, call stack limits, complexity checks, and prototype pollution prevention keep your application secure.

Expressive Language

Arithmetic, comparison, and logical operators. Conditionals, arrays, template strings, arrow functions, and a large set of built-in functions for strings, math, arrays, objects, and type checking.

TypeScript First

Full type definitions with discriminated union result types. Dual CJS/ESM package support. Zero runtime dependencies.