(value: T)
| 7 | |
| 8 | export class JSONObjectStringifier<T> implements IStringifier<T> { |
| 9 | public stringify(value: T) { |
| 10 | // Sort the object keys. |
| 11 | return JSON.stringify( |
| 12 | Object.keys(value) |
| 13 | .sort() |
| 14 | .reduce((acc, curr) => ({ ...acc, [curr]: (value as any)[curr] }), {}) |
| 15 | ); |
| 16 | } |
| 17 | |
| 18 | public parse(value: string) { |
| 19 | return JSON.parse(value) as T; |
no outgoing calls
no test coverage detected