1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 1× 1× 1× 1× 3× 9× 18× 18× 18× 1× | import { each, uniq } from 'lodash'; export default (requests, lang) => { const result = []; each(requests, response => { Iif (response.type !== 'dictionary' || response.fromLang !== lang) { return; } response.result.forEach(entry => { entry.translations.forEach(translation => { translation.examples.forEach(example => { const origin = example.text; const translation = example.translations[0]; result.push(translation + "\t" + origin); }); }); }); }); return uniq(result); }; |