BC-DCBOR TypeScript Library - v1.0.0-alpha.13
    Preparing search index...

    Interface CborMethods

    interface CborMethods {
        toData(): Uint8Array;
        toHex(): string;
        toHexAnnotated(tagsStore?: TagsStore): string;
        toString(): string;
        toDebugString(): string;
        toDiagnostic(): string;
        toDiagnosticAnnotated(): string;
        isByteString(): boolean;
        isText(): boolean;
        isArray(): boolean;
        isMap(): boolean;
        isTagged(): boolean;
        isSimple(): boolean;
        isBool(): boolean;
        isTrue(): boolean;
        isFalse(): boolean;
        isNull(): boolean;
        isNumber(): boolean;
        isInteger(): boolean;
        isUnsigned(): boolean;
        isNegative(): boolean;
        isNaN(): boolean;
        isFloat(): boolean;
        asByteString(): Uint8Array<ArrayBufferLike> | undefined;
        asText(): string | undefined;
        asArray(): readonly Cbor[] | undefined;
        asMap(): CborMap | undefined;
        asTagged(): [Tag, Cbor] | undefined;
        asBool(): boolean | undefined;
        asInteger(): number | bigint | undefined;
        asNumber(): number | bigint | undefined;
        asSimpleValue(): Simple | undefined;
        toByteString(): Uint8Array;
        toText(): string;
        toArray(): readonly Cbor[];
        toMap(): CborMap;
        toTagged(): [Tag, Cbor];
        toBool(): boolean;
        toInteger(): number | bigint;
        toNumber(): number | bigint;
        toSimpleValue(): Simple;
        expectTag(tag: Tag | CborNumber): Cbor;
        walk<State>(initialState: State, visitor: Visitor<State>): void;
        validateTag(expectedTags: Tag[]): Tag;
        untagged(): Cbor;
    }
    Index

    Methods

    • Returns Uint8Array

    • Returns string

    • Returns string

    • Returns string

    • Returns boolean

    • Returns boolean

    • Returns boolean

    • Returns boolean

    • Returns boolean

    • Returns boolean

    • Returns boolean

    • Returns boolean

    • Returns boolean

    • Returns boolean

    • Returns Uint8Array<ArrayBufferLike> | undefined

    • Returns string | undefined

    • Returns readonly Cbor[] | undefined

    • Returns boolean | undefined

    • Returns number | bigint | undefined

    • Returns number | bigint | undefined

    • Convert to byte string, throwing if type doesn't match.

      Returns Uint8Array

      If value is not a byte string type

    • Convert to text string, throwing if type doesn't match.

      Returns string

      If value is not a text string type

    • Convert to array, throwing if type doesn't match.

      Returns readonly Cbor[]

      If value is not an array type

    • Convert to map, throwing if type doesn't match.

      Returns CborMap

      If value is not a map type

    • Convert to tagged value, throwing if type doesn't match.

      Returns [Tag, Cbor]

      If value is not a tagged type

    • Convert to boolean, throwing if type doesn't match.

      Returns boolean

      If value is not a boolean (True/False) type

    • Convert to integer, throwing if type doesn't match.

      Returns number | bigint

      If value is not an integer (Unsigned or Negative) type

    • Convert to number, throwing if type doesn't match.

      Returns number | bigint

      If value is not a numeric (Unsigned, Negative, or Float) type

    • Convert to simple value, throwing if type doesn't match.

      Returns Simple

      If value is not a simple type

    • Expect specific tag and return content, throwing if tag doesn't match.

      Parameters

      Returns Cbor

      With type 'WrongType' if value is not tagged, or 'Custom' if tag doesn't match

    • Walk the CBOR structure with a visitor function.

      Type Parameters

      • State

      Parameters

      • initialState: State

        Initial state for the visitor

      • visitor: Visitor<State>

        Visitor function called for each element

      Returns void

    • Validate that value has one of the expected tags.

      Parameters

      • expectedTags: Tag[]

        Array of expected tag values

      Returns Tag

      With type 'WrongType' if value is not tagged, or 'Custom' if tag doesn't match any expected value

    • Remove one level of tagging, returning the inner content.

      Returns Cbor