Class ConversionRegister

Conversion register for converting values to and from strings Used to store values in a database that does not support the type of the value

Hierarchy

  • ConversionRegister

Constructors

Properties

Entries for the conversion register

instance: ConversionRegister = ...

The instance of the conversion register

Methods

  • Deep-Export an array of values to an array of strings

    Parameters

    • value: unknown[]

      the array of values to export

    • supportsValue: ((it) => boolean) = ...

      Function to check if a value is supported and therefore should not be converted to a string

        • (it): boolean
        • Parameters

          • it: unknown

          Returns boolean

    Returns unknown[]

    Array of strings

    Throws

    • Unsupported type
  • Deep-Export an object of values to an object of strings

    Parameters

    • value: Record<string, unknown>

      Object of values to export

    • supportsValue: ((it) => boolean) = ...

      Function to check if a value is supported and therefore should not be converted to a string

        • (it): boolean
        • Parameters

          • it: unknown

          Returns boolean

    Returns Record<string, unknown>

    Object of strings

    Throws

    • Unsupported type
  • Deep-Export a value to a string

    Parameters

    • value: unknown[]

      Value to export

    • Optional supportsValue: ((it) => boolean)

      Function to check if a value is supported and therefore should not be converted to a string

        • (it): boolean
        • Parameters

          • it: unknown

          Returns boolean

    Returns unknown[]

    String

    Throws

    • Unsupported type
  • Parameters

    • value: Record<string, unknown>
    • Optional supportsValue: ((it) => boolean)
        • (it): boolean
        • Parameters

          • it: unknown

          Returns boolean

    Returns Record<string, unknown>

  • Deep-Import an array of values from an array of strings

    Parameters

    • value: unknown[]

      Array of strings to import

    Returns unknown[]

    Array of values

    Throws

    • Unsupported type
  • Deep-Import an object of values from an object of strings

    Parameters

    • value: Record<string, unknown>

      Object of strings

    Returns Record<string, unknown>

    Object of values

    Throws

    • Unsupported type
  • Export an array of values to an array of strings

    Parameters

    • value: unknown[]

      the array of values to export

    • supportsValue: ((it) => boolean) = ...

      Function to check if a value is supported and therefore should not be converted to a string

        • (it): boolean
        • Parameters

          • it: unknown

          Returns boolean

    Returns unknown[]

    Array of strings

  • Export an object of values to an object of strings

    Parameters

    • object: Record<string, unknown>

      Object of values to export

    • supportsValue: ((it) => boolean) = ...

      Function to check if a value is supported and therefore should not be converted to a string

        • (it): boolean
        • Parameters

          • it: unknown

          Returns boolean

    Returns Record<string, any>

    Object of strings

    Throws

    • Unsupported type
  • Export a value to a string

    Parameters

    • value: unknown

      Value to export

    Returns string

    • String representation of the value

    Throws

    • Unsupported type
  • Import an array of values from an array of strings

    Parameters

    • value: unknown[]

      Array of strings

    Returns unknown[]

    Array of values

    Throws

    • Unsupported type
  • Import a value from a string

    Parameters

    • value: string

      String representation of the value

    Returns unknown

    • Imported value

    Throws

    • Unsupported type
  • Import an object of values from an object of strings

    Parameters

    • value: Record<string, unknown>

      Object of strings

    Returns Record<string, unknown>

    Object of values

    Throws

    • Unsupported type
  • Register a type in the conversion register

    Type Parameters

    Parameters

    • type: T

      the type to register

    • identifier: string

      the identifier for the type

    • exportToString: ((value) => string)

      export to string function

    • importFromString: ((value) => PrimitiveType<T>)

      import from string function

    Returns void

Generated using TypeDoc