(obj: any)
| 24 | } |
| 25 | |
| 26 | function objectToString(obj: any): string { |
| 27 | const result = {}; |
| 28 | |
| 29 | Object.keys(obj) |
| 30 | .sort() |
| 31 | .forEach(key => { |
| 32 | const value = obj[key]; |
| 33 | if (typeof value === 'function') { |
| 34 | const fnStr = value.toString().replace(/\r\n/g, '\n').replace(/\s+/g, ' ').trim(); |
| 35 | result[key] = fnStr; |
| 36 | } else if (typeof value === 'object' && value !== null) { |
| 37 | result[key] = objectToString(value); |
| 38 | } else { |
| 39 | result[key] = value; |
| 40 | } |
| 41 | }); |
| 42 | |
| 43 | return JSON.stringify(result); |
| 44 | } |
| 45 | |
| 46 | function createShortHash(str: string): string { |
| 47 | let hash = 0; |
no test coverage detected