(object: SuperJSONValue)
| 31 | } |
| 32 | |
| 33 | serialize(object: SuperJSONValue): SuperJSONResult { |
| 34 | const identities = new Map<any, any[][]>(); |
| 35 | const output = walker(object, identities, this, this.dedupe); |
| 36 | const res: SuperJSONResult = { |
| 37 | json: output.transformedValue, |
| 38 | }; |
| 39 | |
| 40 | if (output.annotations) { |
| 41 | res.meta = { |
| 42 | ...res.meta, |
| 43 | values: output.annotations, |
| 44 | }; |
| 45 | } |
| 46 | |
| 47 | const equalityAnnotations = generateReferentialEqualityAnnotations( |
| 48 | identities, |
| 49 | this.dedupe |
| 50 | ); |
| 51 | if (equalityAnnotations) { |
| 52 | res.meta = { |
| 53 | ...res.meta, |
| 54 | referentialEqualities: equalityAnnotations, |
| 55 | }; |
| 56 | } |
| 57 | |
| 58 | if (res.meta) res.meta.v = 1; |
| 59 | |
| 60 | return res; |
| 61 | } |
| 62 | |
| 63 | deserialize<T = unknown>(payload: SuperJSONResult, options?: { inPlace?: boolean }): T { |
| 64 | const { json, meta } = payload; |
no test coverage detected