
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
Map over promises with concurrency control. Same API as p-map, ships ESM + CJS with zero dependencies.
Map over promises with concurrency control. Same API as p-map, but ships both ESM and CJS with zero dependencies.
import { pMap } from "tiny-map";
const pages = await pMap(urls, (url) => fetch(url).then((r) => r.text()), {
concurrency: 5,
});
~1.2 KB gzipped. Zero dependencies. Replaces p-map without the ESM-only headache.

Demo built with remotion-readme-kit
npm install tiny-map
import { pMap } from "tiny-map";
const users = await pMap([1, 2, 3, 4, 5], (id) => fetchUser(id), {
concurrency: 3,
});
import { pMap, pMapSkip } from "tiny-map";
const adults = await pMap(users, (user) => {
if (user.age < 18) return new pMapSkip();
return user;
});
async function* generateIds() {
for (let i = 0; i < 100; i++) yield i;
}
const results = await pMap(generateIds(), (id) => process(id), {
concurrency: 10,
});
try {
await pMap(items, riskyOperation, { stopOnError: false, concurrency: 5 });
} catch (error) {
// AggregateError with all failures
console.log(error.errors);
}
const controller = new AbortController();
setTimeout(() => controller.abort(), 5000);
await pMap(urls, fetchPage, {
concurrency: 3,
signal: controller.signal,
});
p-mapp-map v7+ is ESM-only. If you require("p-map") in a CommonJS project, you get ERR_REQUIRE_ESM. tiny-map works with both import and require().
p-map | tiny-map | |
|---|---|---|
| CJS support | v5 only (v6+ ESM-only) | ESM + CJS |
| Dependencies | none | 0 |
| TypeScript | separate @types | native |
| Export | default | named |
- import pMap from "p-map";
+ import { pMap } from "tiny-map";
One line. Everything else stays the same.
pMap(input, mapper, options?)Maps over input with the mapper function, limiting concurrency.
input - Iterable or AsyncIterablemapper(element, index) - function returning a value or promiseoptions.concurrency - max parallel executions (default: Infinity)options.stopOnError - throw on first error or collect all (default: true)options.signal - AbortSignal for cancellationReturns Promise<NewElement[]> with results in input order.
pMapSkipReturn new pMapSkip() from the mapper to exclude that element from results.
Drop-in replacements for sindresorhus async utilities. All ship ESM + CJS with zero dependencies.
| Package | Replaces | What it does |
|---|---|---|
| tiny-limit | p-limit | Concurrency limiter |
| tiny-map | p-map | Concurrent map with order |
| tiny-retry | p-retry | Retry with exponential backoff |
| tiny-queue | p-queue | Priority task queue |
| tiny-ms | ms | Parse/format durations |
| tiny-escape | escape-string-regexp | Escape regex chars |
Want all async utilities in one import? Use tiny-async.
If this saved you from ERR_REQUIRE_ESM, star the repo or open an issue if something breaks.
FAQs
Map over promises with concurrency control. Same API as p-map, ships ESM + CJS with zero dependencies.
We found that map-tiny demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.