A JavaScript expression compiler that safely evaluates end-user-defined filter expressions by compiling them into sandboxed JavaScript functions. Current stable version is 3.1.0, with regular maintenance releases. Key differentiators: simple spreadsheet-like syntax, no eval, no loops or recursion (predictable), supports custom data and functions, ships TypeScript types, and is fast due to compiled output. Follows semver, breaking changes in v3 include stricter property access and boolean preservation.
npm install filtrexNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Compile and execute a filter expression with data and custom functions.
Update expressions to only access properties present in the data object, or add a check before passing data.
Review expressions that relied on numeric coercion of booleans, e.g., `(a > 5) + (b < 3)` will now throw an error instead of summing numbers.
Add parentheses to ensure intended order: `(2 ** 3) ** 2` if right-to-left not desired.
If negative results are needed, use custom function with Math.abs or adjust logic.
Escape backslashes in all string literals used in expressions.
Update links and references to point to new repo.
Ensure all properties accessed in the expression exist in the data object, or use optional chaining via custom functions.
Use logical operators (and, or, not) instead of arithmetic on booleans.
Escape backslashes: use '\\' for a backslash, or wrap string in double quotes and use literal newline.
Register the function via the customFunctions option in compileExpression's second argument.
No dependency data recorded yet.