Map an array with an async function
The map function is like Array.prototype.map, but it works with async functions. Only one item is processed at a time.
map
Array.prototype.map
const userIds = [1, 2, 3, 4]const api = { users: { find: async (id: number) => id < 3, },} const users = await _.map(userIds, async userId => { return await api.users.find(userId)}) // [true, true, false, false]