Function: preprocess()
preprocess(
data):Promise<LmzIntermediate>
Defined in: preprocess.ts:44
Preprocesses complex values to a format that can be stringified to JSON
Converts complex JavaScript values (including cycles/aliases) to an intermediate format
(LmzIntermediate) that can be:
- Stringified via JSON.stringify() for transport over the wire
- Sent over MessagePort/BroadcastChannel (supports objects but not all Web API types)
- Stored in IndexedDB or other object-based storage
- Inspected or manipulated before stringification
Primitives are encoded inline as tuples: ["string", "hello"], ["number", 42] Complex objects are stored in the objects array and referenced by index: ["$lmz", 0]
Preserves cycles and aliases by tracking seen objects with WeakMap.
Parameters
data
any
Value to preprocess
Returns
Promise<LmzIntermediate>
Intermediate format with root value and objects array