map
Map an array with an async function
124 bytes
since v12.1.0
Usage
The map function is like Array.prototype.map, but it works with async functions. Only one item is processed at a time.
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]