Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Serializable

Serialization implementation.

Hierarchy

  • Serializable

Index

Methods

deserialize

  • deserialize(data?: object | null): void
  • Deserialize data object to this instance.

    Parameters

    • Optional data: object | null

      data to deserialize.

    Returns void

serialize

  • serialize(): object
  • Serialize this instance to plain data object.

    Returns object

    plain data object.

Static copy

  • copy(value: any, target?: object | null, skipSerializable?: undefined | false | true, filter?: FilterFunc<any> | null): any
  • Make plain data copy of value for serialization purposes.

    Parameters

    • value: any

      value to copy.

    • Optional target: object | null

      target object to copy to when value is object.

    • Optional skipSerializable: undefined | false | true

      if true then serialize serializable as object.

    • Optional filter: FilterFunc<any> | null

    Returns any

    copied value.

Static deserializeArray

  • deserializeArray<T>(valueType: object, data?: object | null, target?: T[] | null): T[]
  • Deserialize to specific type array.

    Type parameters

    Parameters

    • valueType: object

      type to deserialize to.

    • Optional data: object | null

      data to deserialize.

    • Optional target: T[] | null

      if set then deserialize to this target array instead of creating new one.

    Returns T[]

    deserialized array.

Static serializeValue

  • serializeValue<T>(data: T | T[], target?: object | null, filter?: FilterFunc<T> | null, skipSerializable?: undefined | false | true): any
  • Serialize value with agility to filter out its items by index and value (filtering only works for arrays and objects). Note: filtering function will not work if object extends Serializable unless skipSerializable is set to true.

    Type parameters

    • T

    Parameters

    • data: T | T[]

      array to serialize.

    • Optional target: object | null

      target array to serialize to (if not set new will be created).

    • Optional filter: FilterFunc<T> | null

      filter function to use to filter items (this only works when data is array or object).

    • Optional skipSerializable: undefined | false | true

      if true then serialize serializable as object.

    Returns any

    serialized value.