feat(base-formula): add function registry register helper

This commit is contained in:
Philipinho
2026-04-23 23:56:48 +01:00
parent ded855e44e
commit 1b30de32b5
2 changed files with 8 additions and 1 deletions
@@ -12,3 +12,10 @@ export type FormulaFn = {
};
export const registry: Map<string, FormulaFn> = new Map();
export function register(fn: FormulaFn): void {
if (registry.has(fn.name)) {
throw new Error(`Duplicate formula function: ${fn.name}`);
}
registry.set(fn.name, fn);
}
+1 -1
View File
@@ -7,6 +7,6 @@ export * from "./parser";
export * from "./resolver";
export * from "./typecheck";
export * from "./format";
export { registry } from "./functions/registry";
export { registry, register } from "./functions/registry";
export type { FormulaFn } from "./functions/registry";
export * from "./graph";