Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Codec<T>

Prescribes the way to convert a value to a string back and forth.

You should implement encode and decode to ensure that they satisfy the rule: decode(encode(x)) === x.

Type parameters

  • T

Hierarchy

  • Codec

Index

Methods

decode

  • decode(s: string): T
  • Converts a string to the value of type T that is represented by the input.

    Should throw error when the input is not decodable as type T.

    Parameters

    • s: string

    Returns T

encode

  • encode(t: T): string
  • Converts a value of type T to its string representation.

    Parameters

    • t: T

    Returns string

Generated using TypeDoc