Function serialize

  • Takes a values and tries to serialize it.

    If the value is undefined, it returns undefined.

    If the value is a serialized value, it returns it.

    If the value is a string, it checks if it is a serialized value, following the SerializedType. If it is, it returns it. If it is not, it returns a serialized string.

    If the value is a number, it returns a serialized integer.

    If the value is a boolean, it returns a serialized boolean.

    If the value is null, it throws an error.

    If the value is an array buffer, it returns serialized bytes.

    If the value is a hologram, it returns a serialized hologram.

    If the value is an array, it checks if it is a serialized value, following the SerializedType. If it is, it returns it. If it is not, it returns a serialized list.

    If the value is an object, it returns a serialized map.

    If the value is none of the above, it throws an error.

    Parameters

    • value: any

      value to serialize or a serialized value

    Returns SerializedType

    serialized value

Generated using TypeDoc