Skip to content

@nhtio/lucid-resourceful/encoding

Portable cross-environment encoding and decoding of structured data.

Classes

ClassDescription
E_CIRCULAR_REFERENCEException thrown when a circular reference is detected during encoding. Circular references cannot be encoded and must be avoided.
E_INCOMPATIBLE_VERSIONException thrown when attempting to decode data encoded with an incompatible version. This typically occurs when the encoded data is from a newer version than the decoder supports.
E_INVALID_VERSIONException thrown when an invalid version string is encountered.
E_NOT_AN_ENCODED_VALUEException thrown when attempting to decode a value that is not a valid encoded value. This indicates the input string is not in the expected encoded format.
E_UNDECODABLE_VALUEException thrown when a value with an unknown or unsupported type cannot be decoded.
E_UNENCODABLE_VALUEException thrown when a value cannot be encoded. This indicates that the value type is not supported by the encoder.
FunctionSerializerA portable function serializer that can dehydrate and rehydrate functions from strings, with support for named bindings and various function types.

Interfaces

InterfaceDescription
BaseExceptionBase exception class that extends the native Error class. Provides a foundation for all custom exceptions with additional metadata like error codes, status codes, and help descriptions.

Type Aliases

Type AliasDescription
DehydratedFunctionValueType definition for a dehydrated function value
EncodableDefines all the types which can be be encoded

Variables

VariableDescription
decodeDecodes a compressed base64 string back into a value
encodeEncodes a value into a compressed base64 string
versionThe current version of the package.