P-Map is a JavaScript utility for mapping over synchronous or asynchronous iterables while controlling concurrent promise execution. It is useful when the same async operation must process many inputs without starting every task at once. Unlike Promise.all, developers can set an explicit concurrency limit and choose how mapping errors should be handled. The library preserves input ordering in its returned results while allowing work to proceed concurrently. Its pMapIterable API streams completed mapped values through an async iterable and supports backpressure control. Operations can also be canceled with AbortSignal, while pMapSkip lets individual mapped values be omitted from the result. These controls make it suitable for network requests, queues, batch processing, and other resource-sensitive workloads.
Features
- Configurable promise concurrency
- Synchronous and asynchronous iterable support
- Ordered concurrent result mapping
- Async iterable streaming with backpressure
- AbortSignal cancellation support
- Optional result skipping and aggregate error handling