MCPcopy
hub / github.com/wensonsmith/YoudaoTranslator / parse

Method parse

src/adapters/baidu.ts:45–57  ·  view source on GitHub ↗
(data: any)

Source from the content-addressed store, hash-verified

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 = {

Callers 2

translateMethod · 0.45
redaxiosFunction · 0.45

Calls 2

parseErrorMethod · 0.95
addResultMethod · 0.95

Tested by

no test coverage detected