@dforge-core/formula
v0.0.1
Published
Dependency-free dForge formula DSL engine: parser, AST, evaluator, compiler, runtime functions and structural helpers for custom UIs.
Maintainers
Readme
@dforge-core/formula
Dependency-free TypeScript package for the dForge formula DSL.
It contains the formula engine only:
- parser and AST types
- sync/async evaluator
- runtime function library
- optional AST compiler
- formula context helpers
- AST analysis helpers
- structural UI helpers and catalog data
It intentionally does not include Svelte components, CSS, SQL translation,
generated-column DDL, Dataset, DataRecord, or metadata editing UI.
Usage
import {
parseFormula,
FormulaEvaluator,
createFormulaContext,
} from '@dforge-core/formula';
const ast = parseFormula('[quantity] * [price]');
const ctx = createFormulaContext((name) => row[name]);
const value = FormulaEvaluator.evaluate(ast, ctx);For navigation paths such as [customer].[name], use
createAsyncFormulaContext and provide a resolveNav implementation from the
host application.
