npm / p-map
p-map
What changed in p-map 7, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-17.
2 breaking5 new APIs and options2 performance1 behavior and defaults18 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initp-map 728 changes
Breaking changes 2
Nullish input now produces the same
TypeErroras any other invalid input.When a source settles
next()calls out of call order, the index and result position now follow the order of those calls; withstopOnError: false,AggregateErrorerrors are in input order.
New APIs and options 5
Adds
preserveOrder; set it tofalseto receive each result as soon as it is ready instead of in input order.Adds mapping of the values of an object or a
Map.Adds a mapper-based settled mapping API with a concurrency limit.
Adds settled mapping of the values of an object or a
Map.Adds a way to stop iterating from the mapper, like
breakin a loop.
Performance 2
Reduces promise overhead for each element.
Consumes results in linear time instead of O(n²) when backpressure lets many results wait.
Behavior and default changes 1
Reads ahead while mappers run when
backpressureis aboveconcurrency; with the defaultbackpressure, behavior is unchanged.
Fixes and other changes 18
Subscribe only once to a thenable returned by an async source next() call.
Mapper errors now keep the caller in the stack trace.
pMapSkipresults now count toward backpressure, preventing further reads beyond the allowed limit when a mapper skips most elements.Results before a mapper error are yielded first instead of being dropped while they are still being read.
Stops pulling and mapping input after
return()orthrow()while anext()call is pending.No longer hangs when the source blocks in next() after it is exhausted.
Does not settle early when the source iterator throws with stopOnError set to false.
Uses the async iterator when the input provides both sync and async iterators.
Closes the source iterator when the mapper rejects.
No longer calls next() on an exhausted source iterator.
Does not call the mapper for input arriving after iteration has stopped.
Does not call return() on an exhausted source iterator.
Closes the source iterator when iteration stops early.
Stops pulling input after the consumer stops iterating.
Fixes an unhandled rejection when an abandoned pMapIterable worker's next() rejects.
Fixes cleanup of abort listeners when signals are already aborted.
Fixes the mapper index for out-of-order promise inputs.
Concurrency control in pMapIterable is fixed.