nationid/extract — structured-data extraction from documents that
structurally encode that data (DOB, sex, region).
Design notes:
All extractors validate first via parse(). If parse(...).ok === false
they return null. No extractor sees an unverified body.
The dispatcher is a switch on DocumentTypeCode. Adding a new spec
requires only an entry in SUPPORT_TABLE plus the per-spec extractor.
The public surface is intentionally small: 4 functions and 4 types.
We do not expose a "rich" object with all three fields because most
specs encode only one or two; mixing them in a single shape would force
consumers to handle implausible combinations.
nationid/extract— structured-data extraction from documents that structurally encode that data (DOB, sex, region).Design notes:
parse(). Ifparse(...).ok === falsethey returnnull. No extractor sees an unverified body.DocumentTypeCode. Adding a new spec requires only an entry inSUPPORT_TABLEplus the per-spec extractor.