@blockchaincommons/dcbor - Deterministic CBOR (dCBOR) for TypeScript.
Public surface
Construct:cbor(input) - the single polymorphic constructor.
taggedValue(tag, content) is the only explicit tagged-value
constructor. Custom types implement ToCbor { toCbor(): Cbor }.
Decode:decodeCbor(bytes) throws CborError; tryDecode(bytes)
is the non-throwing twin returning Result<Cbor>. The try prefix
means "returns Result, never throws" - everywhere.
Read: free accessors with fixed prefix semantics: isX(c) =
type-narrowing guard; asX(c) = T | undefined; expectX(c) = T or
throw. Containers mirror the JS Map/Set vocabulary.
Format/traverse:import { diagnostic, hexAnnotated } from "@blockchaincommons/dcbor/diagnostic"; import { walk } from "@blockchaincommons/dcbor/walk";
opt-in debug output via @blockchaincommons/dcbor/debug.
@blockchaincommons/dcbor - Deterministic CBOR (dCBOR) for TypeScript.
Public surface
cbor(input)- the single polymorphic constructor.taggedValue(tag, content)is the only explicit tagged-value constructor. Custom types implementToCbor { toCbor(): Cbor }.encodeCbor(value): Uint8Array<ArrayBuffer>.decodeCbor(bytes)throwsCborError;tryDecode(bytes)is the non-throwing twin returningResult<Cbor>. Thetryprefix means "returnsResult, never throws" - everywhere.isX(c)= type-narrowing guard;asX(c)=T | undefined;expectX(c)=Tor throw. Containers mirror the JSMap/Setvocabulary.import { diagnostic, hexAnnotated } from "@blockchaincommons/dcbor/diagnostic";import { walk } from "@blockchaincommons/dcbor/walk"; opt-in debug output via@blockchaincommons/dcbor/debug.