Skip to content

Reference

Utils — type guards

Runtime type narrowing for unknown JSON into OCF entity shapes, plus detectOcfObjectType and assertOcf* helpers for batch tooling.

typeGuards exports isNonEmptyString, isMonetary, isIsoDateString, per-entity isOcfIssuer, isOcfStakeholder, … through major OCF types, plus detectOcfObjectType (returns DetectedOcfType) and assertOcf* assertion functions.

Assertions throw plain Error with optional custom messages when narrowing fails.

Source