Expand description
WebAssembly bindings for edtf_core — the same validator the database
runs, compiled for JavaScript. The app imports this in place of edtf.js.
Exported API (JS names):
isValid(input)→booleanlevel(input)→0 | 1 | 2 | -1(-1 = invalid)canonical(input)→string | undefined(spec-preferred form)parse(input)→ JSON string of aSummaryorundefinedrelation(a, b)→ JSON string of aRelationSummaryorundefinednormalize(input, options?)→ JSON string of aNormalizeSummary(always returns;{"kind":"noMatch"}when the prose is outside the grammar).optionsis a JSON string:{"language": "en"|"ru", "numericOrder": "dayFirst"|"monthFirst", "defaultCentury": 1900}— all fields optional.
Structs§
- Interpretation
Json - One reading of an ambiguous input.
- Note
Json - One note: the governing N-decision (or null) and a human-readable message.
- Relation
Summary - The JSON shape
relationreturns. - Summary
- The JSON shape
parsereturns; one object per valid expression.
Enums§
- Normalize
Summary - The JSON shape
normalizereturns, discriminated bykind:"normalized"|"ambiguous"|"noMatch". Semantics and the N-decision ids inside notes:docs/normalize-notes.md.
Functions§
- canonical
- The canonical (spec-preferred) form of
input, orundefinedif invalid. - is_
valid - True if
inputis valid EDTF (levels 0–2). - level
- Minimum conformance level of
input: 0, 1 or 2; -1 if invalid. - normalize
- Deterministic prose-date normalization (“1980s” → 198X) as a JSON string.
- normalize_
summary - Build the
NormalizeSummaryfor an input.Noneonly for invalid options JSON. - parse
- Full parse summary as a JSON string, or
undefinedif invalid. SeeSummaryfor the object shape. - relate
- Build the
RelationSummaryfor two inputs, if both are valid EDTF. - relation
- Three-valued temporal relation between
aandbas a JSON string, orundefinedif either input is invalid. SeeRelationSummaryfor the object shape. - summarize
- Build the
Summaryfor an input, if it is valid EDTF.