Formulex is a lightweight, extensible library (v0.0.60, pre-1.0, rapid releases) that parses user-defined formulas (e.g., `{Field 1} + {Field 2} * 2`) into SQL expressions or executable JavaScript functions, with built-in AST support. It targets low-code platforms, dashboards, and dynamic logic engines. Key differentiators: built-in type casting for `dropdown`/`checkboxes` fields with id↔name mapping via CTE, minimal dependencies (only luxon for dates), and support for custom field mappings. Note: requires Node.js >= 22.11 < 23; work-in-progress, expect breaking changes.
npm install formulexNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Parses a formula using Parser, generates SQL and JS, then evaluates JS with variable values.
Replace spaces with underscores in field name references within formulas.
Ensure Node.js version satisfies range (e.g., use nvm to switch to v22.11+).
Use ES import syntax: import { Parser } from 'formulex';Pin to specific version and test updates thoroughly.
Add "type": "module" in package.json or use .mjs extension, and ensure Node >= 22.11.
Use import { Parser } from 'formulex' instead of require.