mirror of
https://github.com/docmost/docmost.git
synced 2026-08-28 01:07:08 +08:00
Table and kanban UI, formula engine package, and the base-embed editor extension
17 lines
549 B
TypeScript
17 lines
549 B
TypeScript
import { register } from "./registry";
|
|
|
|
register({
|
|
name: "toNumber", arity: { min: 1, max: 1 }, paramTypes: "any", returnType: "number",
|
|
eval: ([v]) => {
|
|
if (v == null) return null;
|
|
const n = Number(v);
|
|
return Number.isFinite(n) ? n : null;
|
|
},
|
|
doc: "Parses the value as a number, or null.", category: "coercion",
|
|
});
|
|
register({
|
|
name: "toString", arity: { min: 1, max: 1 }, paramTypes: "any", returnType: "string",
|
|
eval: ([v]) => v == null ? "" : String(v),
|
|
doc: "Converts the value to a string.", category: "coercion",
|
|
});
|