helene
Version:
Real-time Web Apps for Node.js
15 lines (14 loc) • 634 B
TypeScript
/**
* Serialize an object to be persisted to a one-line string
* For serialization/deserialization, we use the native JSON parser and not eval or Function
* That gives us less freedom but data entered the database may come from users
* so eval and the like are not safe
* Accepted primitive types: Number, String, Boolean, Date, null
* Accepted secondary types: Objects, Arrays
*/
export declare function serialize(obj: Record<string, any>): string;
/**
* From a one-line representation of an object generate by the serialize function
* Return the object itself
*/
export declare function deserialize(rawData: string): any;