How to use async await on map function

The built-in map function in JS does not provide a async and await out of the box so here is how you should do it.

const functionName = results => {
  const promises = results.map(async result => asyncFunctionName(result));
  return Promise.all(promises);
};

Define the async function.

const asyncFunctionName = async ({});

Now you can call:

const data = await functionName(results);