Skip to content

@nhtio/encoder

A portable cross-environment encoder / decoder for complex and structured data

Interfaces

InterfaceDescription
CustomEncodableA class that opts in to custom encoding/decoding.

Type Aliases

Type AliasDescription
EncodableDefines all the types which can be be encoded
EncodablePrimitiveDefines the union of all encodable primitive types.
EncodableTypedArrayDefines a union for all the encodable typed arrays.

Variables

VariableDescription
DECODE_METHODStatic method: reconstruct an instance from an Encodable snapshot
ENCODE_METHODInstance method: serialize the object into an Encodable snapshot
versionThe current version of the package.

Functions

FunctionDescription
decodeDecodes a compressed base64 string back into a value
encodeEncodes a value into a compressed base64 string
registerClassRegister a class so the decoder can reconstruct it from a snapshot. The class must have a static [DECODE_METHOD] that accepts an Encodable snapshot and returns an instance of the class.