mirror of
https://github.com/docmost/docmost.git
synced 2026-07-24 09:22:52 +10:00
feat(base-formula): add function registry register helper
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user