I'm currently refactoring some code, and I'm running into a problem.
I am trying to return the value from inside an anonymous function. I played around with it a few different ways, and tried await
-ing it.
Essentially I'm getting data about the request that's being made, not the data from the request.
Here are some different ways I've tried working with it -
const run = async (text) => {
...
const s = personalityInsights.profile(req, (err, data) => {
...
return data; // correct value
});
return s; // incorrect value
};
const run = async (text) => {
...
personalityInsights.profile(req, (err, data) => {
...
return data;
});
};
const run = async (text) => {
...
return personalityInsights.profile(req, (err, data) => {
...
return data;
});
};
I can give the full code, but I think this is more of a language specific problem I have, than a code specific one.
Thanks for your help, Ollie
Edit: This question has been marked as a duplicate, which I understand - but the solutions in that duplicate simply aren't working, and they aren't things I haven't already tried...