UNPKG

ejson2

Version:
30 lines (29 loc) 1.33 kB
export declare const EJSON: { clone: (rootVal: any) => any; equals: (a: any, b: any, options?: any) => any; isBinary: (obj: Uint8Array & number[] & { $Uint8ArrayPolyfill?: boolean; }) => boolean; parse: (item: any) => any; stringify: (...args: any[]) => any; fromJSONValue: (item: any) => any; toJSONValue: (item: any) => any; newBinary: (len: number) => Uint8Array | import("../utils").PolyfillableArray; /** * @summary Add a custom datatype to EJSON. * @locus Anywhere * @param {String} name A tag for your custom type; must be unique among * custom data types defined in your project, and must * match the result of your type's `typeName` method. * @param {Function} factory A function that deserializes a JSON-compatible * value into an instance of your type. This should * match the serialization performed by your * type's `toJSONValue` method. */ addType(name: string, factory: any): void; _isCustomType(obj: any): boolean; _getTypes(isOriginal?: boolean): unknown; _getConverters(): any; _adjustTypesToJSONValue: (obj: any) => any; _adjustTypesFromJSONValue: (obj: any) => any; };