(data: any)
| 43 | } |
| 44 | |
| 45 | parse(data: any): Result[] { |
| 46 | if (data.error_code) { |
| 47 | return this.parseError(data.error_code); |
| 48 | } |
| 49 | |
| 50 | const { trans_result:result } = data; |
| 51 | result.forEach(item => { |
| 52 | const pronounce = this.isChinese ? item.dst : this.word; |
| 53 | this.addResult(item.dst, item.src, pronounce, pronounce); |
| 54 | }); |
| 55 | |
| 56 | return this.results; |
| 57 | } |
| 58 | |
| 59 | private parseError(code: number): Result[] { |
| 60 | const messages = { |
no test coverage detected