GitShow/sindresorhus/p-map
sindresorhus

p-map

Map over promises concurrently

by sindresorhus
asyncasync-awaitasync-functionsawaitconcurrencyiterationjavascriptmapper
Star on GitHubForknpm

JavaScript

1.5k stars70 forks19 contributorsActive · 5d agoSince 2016MIT

Meet the team

See all 19 on GitHub →
sindresorhus
sindresorhus44 contributions
Richienb
Richienb4 contributions
huntharo
huntharo3 contributions
parro-it
parro-it2 contributions
BendingBender
BendingBender2 contributions
furudean
furudean2 contributions
noamokman
noamokman2 contributions
papb
papb2 contributions

Recent PRs & issues

Active · 4 in progress · Last activity 5d ago
See all on GitHub →
GrahamLea
Upgrade 'xo' to 1.2.3 (from 0.56) and Node to 20.17OpenPR

This results in the dependency tree summary moving from 6 high severity vulnerabilities to 3 low severity. xo 0.56 pulled in eslint 8, including several deprecated transitive deps with security and memory issues. xo 1.x moved to eslint 9, resolving those issues, but requiring Node 20. (Node 18 went EOL mid last year.) Bumped CI Node versions matrix to 20, 22, 24. Includes a few small code changes to satisfy new lint rules in the new xo.

GrahamLea · 3mo ago
sindresorhus
Improve mapper error stack tracesOpenPR

Fixes #34 It's opt-in since it does come with a tiny performance overhead. From a lot of research, this is the only way I managed to preserve the stack trace.

sindresorhus · 9mo ago

Recent fixes

View closed PRs →
hong4rc
Fix `pMapIterable` mapper index for out-of-order promise inputsMergedPR

hands the mapper the wrong when the input is promises that settle out of order. The index is meant to be the element's position in the source (the way does it), but it ends up numbered in the order the promises happen to resolve. returns the right indices for the same input. The reason is that runs as an argument to , so it's evaluated after : Workers are spawned in source order, but each one suspends on until its promise settles, so the shared counter gets read in settlement order instead. avoids this by capturing the index when it pulls the item off the iterator, before awaiting it. The fix is to do the same here — grab the index at spawn time: Only the index the mapper sees changes; output ordering, concurrency, backpressure, and are all untouched. I also added a test with out-of-order-settling promises that asserts the index follows source order (it fails before this change and passes after).

hong4rc · 1h ago
kamransiddiqui
[gitgot] First-pass fix for sindresorhus/p-map issue #34MergedPR

Closes #34. What gitgot did This is an AI-drafted first pass at the issue, generated inside a sandboxed working copy by gitgot. Treat it as a starting point — pull the branch and iterate locally if needed. Commit: Iterate View this request in gitgot to access the live sandbox shell, review the agent's prompt, and request revisions: 01468a9d-aace-4653-be3e-24668c22db94 Draft PR opened by gitgot. Mark ready for review once you've verified the change.*

kamransiddiqui · 1mo ago
vladshcherbin
Add convenient delay optionClosedIssue

Many times I need a delay between function execution, for example to do fetch request and not spam kill a server. Currently proposed solution in https://github.com/sindresorhus/p-map/issues/25 is not optimal: This has some flaws: also adds a delay after last function execution needs some kind of index check to prevent ^ duplicate delay/native timeout import instead of convenient option Would be awesome to have a convenient option 😊

vladshcherbin · 1mo ago
Structured data for AI agents

Repository: sindresorhus/p-map. Description: Map over promises concurrently Stars: 1501, Forks: 70. Primary language: JavaScript. License: MIT. Topics: async, async-await, async-functions, await, concurrency, iteration, javascript, mapper, nodejs, parallel, promise, promises. Open PRs: 4, open issues: 8. Last activity: 5d ago. Top contributors: sindresorhus, Richienb, huntharo, parro-it, BendingBender, furudean, noamokman, papb, hong4rc, chrisblossom and others.

·@ofershap

Replace github.com with gitshow.dev