npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

tiny-pmap

v1.0.0

Published

Map over promises with concurrency control. Same API as p-map, ships ESM + CJS with zero dependencies.

Downloads

117

Readme

tiny-map

npm version npm downloads CI TypeScript License: MIT

Map over promises with concurrency control. Same API as p-map, but ships both ESM and CJS with zero dependencies.

import { pMap } from "tiny-pmap";

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

Demo built with remotion-readme-kit

Install

npm install tiny-pmap

Usage

import { pMap } from "tiny-pmap";

const users = await pMap([1, 2, 3, 4, 5], (id) => fetchUser(id), {
  concurrency: 3,
});

Skip items from results

import { pMap, pMapSkip } from "tiny-pmap";

const adults = await pMap(users, (user) => {
  if (user.age < 18) return new pMapSkip();
  return user;
});

Async iterables

async function* generateIds() {
  for (let i = 0; i < 100; i++) yield i;
}

const results = await pMap(generateIds(), (id) => process(id), {
  concurrency: 10,
});

Collect all errors

try {
  await pMap(items, riskyOperation, { stopOnError: false, concurrency: 5 });
} catch (error) {
  // AggregateError with all failures
  console.log(error.errors);
}

Cancel with AbortSignal

const controller = new AbortController();
setTimeout(() => controller.abort(), 5000);

await pMap(urls, fetchPage, {
  concurrency: 3,
  signal: controller.signal,
});

Differences from p-map

p-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 |

Migrating from p-map

- import pMap from "p-map";
+ import { pMap } from "tiny-pmap";

One line. Everything else stays the same.

API

pMap(input, mapper, options?)

Maps over input with the mapper function, limiting concurrency.

  • input - Iterable or AsyncIterable
  • mapper(element, index) - function returning a value or promise
  • options.concurrency - max parallel executions (default: Infinity)
  • options.stopOnError - throw on first error or collect all (default: true)
  • options.signal - AbortSignal for cancellation

Returns Promise<NewElement[]> with results in input order.

pMapSkip

Return new pMapSkip() from the mapper to exclude that element from results.

The tiny-* family

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-pasync.

Author

Made by ofershap

LinkedIn GitHub


If this saved you from ERR_REQUIRE_ESM, star the repo or open an issue if something breaks.

License

MIT © Ofer Shapira