Class TypeUtils

Provide utiltiies to work with types

  • Convert hex value between types string and array of uint8
  • Check types

Hierarchy

  • TypeUtils

Constructors

Methods

  • Convert bytes to a bigint number

    Parameters

    • bytes: Uint8Array

    Returns bigint

  • Clear all elements of the given array

    Type Parameters

    • T

    Parameters

    • input: Uint8Array | T[]

    Returns void

  • Concat multiple byte-arrays into one

    Parameters

    • Rest ...arrays: Uint8Array[]

    Returns Uint8Array

  • Convert an array of bytes to a string of binary digits

    Parameters

    • input: Uint8Array

      The input array of bytes.

    • Optional bitsPerValue: number = 8

      The number of bits to use per value.

    Returns string

    The binary string representation of the input array.

  • Convert the given array value to a hex string

    Parameters

    • input: Uint8Array | ArrayBuffer

      hex array

    Returns string

  • Convert the given hex string to an Uint8Array

    Parameters

    • input: string

      hex string

    Returns Uint8Array

  • Convert U32 number to bytes

    Parameters

    • n: number

    Returns Uint8Array

  • It checks if the input is a string or a string instance.

    Parameters

    • input: any

      any

    Returns boolean

    true or false

  • Convert a bigint number to bytes

    Parameters

    • num: bigint

    Returns Uint8Array

  • It takes a hex value and converts it to a Uint8Array.

    Parameters

    • input: Hex

      The input to be converted to a Uint8Array.

    Returns Uint8Array

    a Uint8Array object

  • It takes a hex value and converts it to a hex string.

    Parameters

    • input: Hex

      The input to be converted to a string.

    Returns string

    The hex string representation of the input.

Generated using TypeDoc