UNPKG

any-serialize

Version:

Serialize / Deserialize any JavaScript objects, as long as you provides how-to. I have already provided `Date`, `RegExp`, `Set` and `Function`.

54 lines 1.52 kB
import { StringifyFunction, ParseFunction, IRegistration } from './utils'; export declare class Serialize { private registrar; private prefix; private stringifyFunction; private parseFunction; private undefinedProxy; constructor( /** * For how to write a replacer and reviver, see * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON */ options?: { prefix?: string; stringify?: StringifyFunction; parse?: ParseFunction; }); /** * * @param rs Accepts Class constructors or IRegistration */ register(...rs: ({ new (...args: any[]): any; } | IRegistration)[]): void; unregister(...rs: ({ new (...args: any[]): any; } | IRegistration)[]): void; /** * * @param obj Uses `JSON.stringify` with sorter Array by default */ stringify(obj: any): string; hash(obj: any): string; clone<T>(obj: T): T; deepEqual(o1: any, o2: any): boolean; /** * * @param repr Uses `JSON.parse` by default */ parse(repr: string): any; private getKey; /** * * @param o * @param type Type of findAndReplace */ private deepCloneAndFindAndReplace; } export declare const FullFunctionAdapter: IRegistration; export declare const WriteOnlyFunctionAdapter: IRegistration; export declare const UndefinedAdapter: IRegistration; export * from './mongo'; export * from './utils'; //# sourceMappingURL=index.d.ts.map