Options
All
  • Public
  • Public/Protected
  • All
Menu

External module deserted

Index

Type aliases

AnyConstructor

AnyConstructor: object

A constructor taking any parameter.

Type declaration

ConverterConfig

ConverterConfig: object

An object containing class names as keys, and the corresponding converter instances as values.

Type declaration

EmptyConstructor

EmptyConstructor: object

A constructor taking no parameters

Type declaration

Options

Options: object

Options for the Deserted instance

param

if true, any encountered circular references will throw an error

param

a custom converter for functions, defaults to a string value

param

a custom converter for symbols, defaults to resolving global Symbols

param

a custom stringifier, defaults to JSON.stringify/parse

Type declaration

Variables

Const DefaultFunctionConverter

DefaultFunctionConverter: Converter = Converter.create((f: Function) => f.name,name => `[function ${name}]`)

The default converter for functions. It converts the function to a string.

Const DefaultSymbolConverter

DefaultSymbolConverter: Converter = Converter.create((s: symbol) => {const key = Symbol.keyFor(s)if (key !== undefined) return keyreturn String(s).slice(7, -1)},(key: string) => Symbol.for(key))

The default converter for Symbols. It gets the Symbol's descriptor, and when denormalizing tries to get a global Symbol with that descriptor.

Const deserted

deserted: Deserted = Deserted.default()

A default Deserted instance pre-configured with standard converters and options.

Object literals

Const Converter

Converter: object

A two-way converter from and to some object

create

  • create(from: function, to: function): Converter
  • Returns a new converter based on the provided from and to functions.

    Parameters

    • from: function

      the function to convert from some value to a normalized value.

        • (state: any): any
        • Parameters

          • state: any

          Returns any

    • to: function

      the function to convert from some normalized value to a denormalized value.

        • (obj: any): any
        • Parameters

          • obj: any

          Returns any

    Returns Converter

from

  • from(state: any): any

to

  • to(obj: any): any

Generated using TypeDoc