@blockchaincommons/envelope - v1.0.0-beta.4
    Preparing search index...

    Class FormatContext

    Context object for formatting Gordian Envelopes with annotations.

    The FormatContext provides information about CBOR tags, known values, functions, and parameters that are used to annotate the output of envelope formatting functions.

    Implements

    • ReadonlyTagsStore
    Index
    • A context over the given stores (empty ones by default). The stores are taken as they are: pass clones when the context must not follow later registrations, as the reference's FormatContext::new clones its arguments.

      Parameters

      • __namedParameters: {
            tags?: TagsStore;
            knownValues?: KnownValuesStore;
            functions?: FunctionsStore;
            parameters?: ParametersStore;
        } = {}

      Returns FormatContext

    • Get the assigned name for a tag, if any.

      Parameters

      • tag: Tag

        The tag to look up

      Returns string | undefined

      The assigned name, or undefined if no name is registered

    • Get a display name for a tag.

      Parameters

      • tag: Tag

        The tag to get a name for

      Returns string

      The assigned name if available, otherwise the tag value as a string

    • Look up a tag by its numeric value.

      Parameters

      • value: CborNumber

        The numeric tag value

      Returns Tag | undefined

      The Tag object if found, undefined otherwise

    • Look up a tag by its name.

      Parameters

      • name: string

        The tag name

      Returns Tag | undefined

      The Tag object if found, undefined otherwise

    • Get a display name for a tag value.

      Parameters

      • value: CborNumber

        The numeric tag value

      Returns string

      The tag name if registered, otherwise the value as a string

    • Get a custom summarizer function for a tag, if registered.

      Parameters

      • tag: CborNumber

        The numeric tag value

      Returns CborSummarizer | undefined

      The summarizer function if registered, undefined otherwise