Skip to content

map

An async map function. Works like the built-in Array.map function but handles an async mapper function.

Usage

const urls = ["/data1", "/data2", "/data3"];
const responses = await map(urls, async (url) => {
const response = await fetch("https://api.example.com" + url);
return response.json();
});

Installation

Terminal window
npx atmx add helper map