Options
All
  • Public
  • Public/Protected
  • All
Menu

Module packer

Index

Functions

Const getParser

  • getParser(type: string): Parser<unknown, unknown>
  • Get the parser for the specified type. This will throw if there is no parser for the specified type.

    Parameters

    • type: string

      The type to get a parser for.

    Returns Parser<unknown, unknown>

    The parser.

Const isDynamicParser

  • isDynamicParser(parser: Parser<unknown, unknown>, type: string): boolean
  • Check if the specified parser is dynamic, for the provided types. This is primarily used for parsing tuples, where a tuple can be dynamic based on the types. For other parsers, it will simply use the set isDynamic value.

    Parameters

    • parser: Parser<unknown, unknown>

      The parser to check.

    • type: string

      The type to check the parser with.

    Returns boolean

    Whether the parser is dynamic.

Const pack

  • pack(types: string[], values: unknown[], buffer?: Uint8Array): Uint8Array
  • Pack the provided values in a buffer, encoded with the specified types. If a buffer is specified, the resulting value will be concatenated with the buffer.

    Parameters

    • types: string[]

      The types to use for encoding.

    • values: unknown[]

      The values to encode.

    • buffer: Uint8Array = ...

    Returns Uint8Array

    The resulting encoded buffer.

Const unpack

  • unpack(types: string[], buffer: Uint8Array): unknown[]
  • Parameters

    • types: string[]
    • buffer: Uint8Array

    Returns unknown[]

Generated using TypeDoc