@blockchaincommons/dcbor - v1.0.0-beta.3
    Preparing search index...

    Function expectUnsigned

    • Extract unsigned integer value, throwing if type doesn't match.

      With options, the value is checked against a fixed width and, when wrapNegative is set, a negative node is wrapped exactly as the reference's u*::try_from wraps it (see ExpectUnsignedOptions).

      Parameters

      • cbor: Cbor

        CBOR value

      • Optionaloptions: ExpectUnsignedOptions

        Fixed-width extraction (optional; without it the behaviour is the plain Unsigned-or-WrongType check)

      Returns number | bigint

      Unsigned integer (bigint above Number.MAX_SAFE_INTEGER)

      WrongType if cbor is not an unsigned integer (or, with wrapNegative, not an integer); OutOfRange when the value does not fit width