I have two async/await function, first one is taking images and get response of images text, Second one needs to take response of first function as a parameter.
First async function
const detecText = async (filename) => {
let [result] = await client.textDetection(filename);
const labels = result.textAnnotations[0].description;
return labels;
};
as I am using this detecText()
function with multiple parameter from array ImagesName[]
ImagesNames.forEach((element) => {
detecText(element)
.then((result) => {
console.log(result);
})
.catch((err) =>
console.log(
"loop not working!" +
err +
element
)
);
});
Now I have second async/await function which has to take parameter from above detecText() function
const target = "en";
const translateText = async function translateText(text) {
let [translations] = await translate.translate(text, target);
translations = Array.isArray(translations) ? translations : [translations];
translations.forEach((translation, i) => {
return translation;
});
};
How can I use this translateText()
function with parameter from the response of deteText()
function ?