Back to Explore

sindresorhus/p-map

GitHub
3 updates · last 90 days1 watchersOpen source

Last release:

p-map (sindresorhus/p-map) is a JavaScript utility for mapping over promises concurrently. It’s useful for running async functions over many inputs while controlling concurrency, handling errors (stop on first error or collect all errors), and optionally using an AbortSignal to cancel.

Project status

  • Actively maintained: The repo shows recent activity (upstream push on 2026-08-27) and multiple recent updates in 2026 (v7.0.7, v7.0.6, v7.0.5), indicating ongoing maintenance.
  • Update cadence: In mid 2026, updates landed fairly frequently (roughly every 3 to 5 weeks between v7.0.5, v7.0.6, and v7.0.7). There was a longer quieter period before that (for example, the last update before v7.0.4 was v7.0.3 in 2024).

AI summary generated

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • v7.0.7

    v7.0.7 fixes an unhandled rejection scenario in `pMapIterable` when a consumer stops early while an in-flight `iterator.next()` is still pending. The change ensures that errors from abandoned workers are handled deterministically rather than surfacing as unhandled promise rejections.

  • v7.0.6

    This release (v7.0.6) fixes an abort handling edge case in p-map when the provided AbortSignal is already aborted. The change prevents an unnecessary abort event listener from being registered in that scenario, aligning runtime behavior with the intended cleanup.

  • v7.0.5

    This release, v7.0.5, fixes an issue in `pMapIterable` where the `index` passed to the mapper could be incorrect when the input is a list of promises that settle out of order. The implementation change ensures indices are assigned in the order items are pulled, not in the order their awaited promises resolve. Release notes also include small documentation updates and a new test covering out-of-order settlement.

  • v7.0.4

    v7.0.4 contains a targeted fix to concurrency control in `pMapIterable`. The code change adjusts how the in-flight work count is tracked so that backpressure and concurrency are enforced correctly for async iterables, and it adds a regression test for the case where `backpressure > concurrency`.

  • v7.0.3

    v7.0.3 makes a targeted fix for how pMap handles AbortController abort events, specifically around cleaning up the abort listener. It updates the promise resolution/rejection flow to remove the abort listener after the operation settles.

  • v7.0.2

    v7.0.2 updates p-map to supply an `index` argument to the mapper function used by `pMapIterable`. The release notes describe the change, and the code and tests confirm it was implemented.

  • v7.0.1

    v7.0.1 is a small patch release focused on fixing pMapIterable when the iterator yields async values (promises). The runtime change ensures the mapper receives resolved values, alongside minor docs/test updates.

  • v7.0.0

    v7.0.0 raises the minimum supported Node.js version to 18 and introduces a new streaming API, pMapIterable, for mapping over (async) iterables with concurrency control. The implementation also adds an additional backpressure option to limit how many mapper results are buffered ahead of the consumer.

    BreakingFeatures
  • v6.0.0

    v6.0.0 raises the minimum supported Node.js version to 16 and changes the aggregated error implementation used when `stopOnError: false`. The release notes also indicate a behavioral difference in the aggregated error message compared to the previously used `aggregate-error` package.

    Breaking
  • v5.5.0

    Release v5.5.0 updates the public TypeScript typings for p-map. The main documented change is that `Mapper` can now return `pMapSkip` to signal that an item should be skipped.

    Features
  • v5.4.0

    Release v5.4.0 adds support for aborting `pMap` operations via `AbortController` by introducing an optional `signal` option. The core implementation wires the provided `AbortSignal` into `pMap` so it rejects when aborted.

    Features