serializr
    Preparing search index...

    Function serializeAll

    • The serializeAll decorator can used on a class to signal that all primitive properties, or complex properties with a name matching a pattern, should be serialized automatically.

      Type Parameters

      • T

      Parameters

      Returns Clazz<T>

      @serializeAll
      class Store {
      a = 3
      b
      }

      const store = new Store()
      store.c = 5
      store.d = {}
      serialize(store) // { "c": 5 }
      class DataType {
      @serializable
      x
      @serializable
      y
      }

      @serializeAll(/^[a-z]$/, DataType)
      class ComplexStore {
      }

      const store = new ComplexStore()
      store.a = {x: 1, y: 2}
      store.b = {}
      store.somethingElse = 5
      serialize(store) // { a: {x: 1, y: 2}, b: { x: undefined, y: undefined } }
    • The serializeAll decorator can used on a class to signal that all primitive properties, or complex properties with a name matching a pattern, should be serialized automatically.

      Parameters

      Returns (clazz: Clazz<any>) => Clazz<any>

      @serializeAll
      class Store {
      a = 3
      b
      }

      const store = new Store()
      store.c = 5
      store.d = {}
      serialize(store) // { "c": 5 }
      class DataType {
      @serializable
      x
      @serializable
      y
      }

      @serializeAll(/^[a-z]$/, DataType)
      class ComplexStore {
      }

      const store = new ComplexStore()
      store.a = {x: 1, y: 2}
      store.b = {}
      store.somethingElse = 5
      serialize(store) // { a: {x: 1, y: 2}, b: { x: undefined, y: undefined } }