Parse:parseDcborItem(src, options?) returns a Cbor or throws
DcborParseError; tryParseDcborItem returns { ok, value } | { ok, error }
instead. parseDcborItemPartial/tryParseDcborItemPartial parse the first item
and report how much source it took.
Compose:composeDcborArray(items, options?) and
composeDcborMap(items, options?) parse each item; DcborComposeError
wraps an item's error as cause.
Options:tags and knownValues choose where names resolve (the
global stores by default); maxDepth bounds nesting (1 000).
Errors:code says why, details is typed by code (an
UnexpectedToken carries the Token), fullMessage(source) draws a
caret. Arguments of the wrong type throw TypeError.
dCBOR diagnostic notation → CBOR:
parseDcborItem("[1, h'ff', 'isA', date(2023-01-01)]").parseDcborItem(src, options?)returns aCboror throwsDcborParseError;tryParseDcborItemreturns{ ok, value } | { ok, error }instead.parseDcborItemPartial/tryParseDcborItemPartialparse the first item and report how much source it took.composeDcborArray(items, options?)andcomposeDcborMap(items, options?)parse each item;DcborComposeErrorwraps an item's error ascause.tagsandknownValueschoose where names resolve (the global stores by default);maxDepthbounds nesting (1 000).codesays why,detailsis typed bycode(anUnexpectedTokencarries theToken),fullMessage(source)draws a caret. Arguments of the wrong type throwTypeError.@blockchaincommons/dcbor-parse/lexer(beta).