-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathejson.d.ts
More file actions
71 lines (59 loc) · 1.28 KB
/
ejson.d.ts
File metadata and controls
71 lines (59 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
export interface EJSONableCustomType {
clone?(): EJSONableCustomType;
equals?(other: Object): boolean;
toJSONValue(): JSONable;
typeName(): string;
}
export type EJSONableProperty =
| number
| string
| boolean
| Object
| number[]
| string[]
| Object[]
| Date
| Uint8Array
| EJSONableCustomType
| undefined
| null;
export interface EJSONable {
[key: string]: EJSONableProperty;
}
export interface JSONable {
[key: string]:
| number
| string
| boolean
| Object
| number[]
| string[]
| Object[]
| undefined
| null;
}
export interface EJSON extends EJSONable {}
export namespace EJSON {
function addType(
name: string,
factory: (val: JSONable) => EJSONableCustomType
): void;
function clone<T>(val: T): T;
function equals(
a: EJSON,
b: EJSON,
options?: { keyOrderSensitive?: boolean | undefined }
): boolean;
function fromJSONValue(val: JSONable): any;
function isBinary(x: Object): x is Uint8Array;
function newBinary(size: number): Uint8Array;
function parse(str: string): EJSON;
function stringify(
val: EJSON,
options?: {
indent?: boolean | number | string | undefined;
canonical?: boolean | undefined;
}
): string;
function toJSONValue(val: EJSON): JSONable;
}