| 1 | export type Metadata = any; |
| 2 | |
| 3 | export class Test { |
| 4 | constructor(public readonly name: string, |
| 5 | public readonly line: number, |
| 6 | public readonly values |
| 7 | : ReadonlyMap<string, ReadonlyArray<string> >, |
| 8 | public readonly meta |
| 9 | : ReadonlyMap<string, ReadonlyArray<Metadata> >) { |
| 10 | } |
| 11 | |
| 12 | public toJSON(): any { |
| 13 | const values: { [key: string]: ReadonlyArray<string> } = {}; |
| 14 | this.values.forEach((value, key) => { |
| 15 | values[key] = value; |
| 16 | }); |
| 17 | |
| 18 | const meta: { [key: string]: ReadonlyArray<Metadata> } = {}; |
| 19 | this.meta.forEach((mvalue, key) => { |
| 20 | meta[key] = mvalue; |
| 21 | }); |
| 22 | |
| 23 | return { |
| 24 | line: this.line, |
| 25 | meta, |
| 26 | name: this.name, |
| 27 | values, |
| 28 | }; |
| 29 | } |
| 30 | } |