GitShow/sindresorhus/p-map
sindresorhus

p-map

Map over promises concurrently

by sindresorhus
asyncasync-awaitasync-functionsawaitconcurrencyiterationjavascriptmapper
Star on GitHubForknpm

JavaScript

1.5k stars76 forks20 contributorsActive · 1mo agoSince 2016v7.0.6MIT

Meet the team

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

Languages

View on GitHub →
JavaScript91.6%
TypeScript8.4%

Commit activity

Last 12 weeks · 4 commits

Full graph →

Community health

4 of 6 standards met

Community profile →
85
✓README✓License✓Contributing✓Code of Conduct○Issue Template○PR Template

Recent PRs & issues

Active · 5 in progress · Last activity 1mo ago
See all on GitHub →
roemdevs
Add default concurrency and a way to set it up globallyOpenPR

Fixes #93. Set a default concurrency of (as before) Added 2 new functions: and : globally overrides (used in and ) returns the current value of

roemdevs · 19h ago
roemdevs
Add a way to globally set the default concurrency numberOpenIssue

I think it would be useful to have a way to configure a default concurrency limit globally, rather than having to specify it on every call. Currently, if an application wants to avoid the default Infinity concurrency, users have to explicitly pass the option every time they use pMap or pMapIterable: This can become repetitive in larger applications, and it also makes it easy to forget to set the limit on a new call site. A global default would allow applications to define their concurrency policy once during initialization, for example: After that, calls without an explicit concurrency option would use the configured default: The important part is that this would remain backwards-compatible: the current behavior would be preserved by default, and an explicitly provided concurrency value would still take precedence over the global default. I’ve created PR #92 implementing this approach. The PR keeps the existing behavior intact while allowing users to configure a global globalConcurrency default. I’d be interested to hear your thoughts on whether this is something you’d consider adding to the package, and if you have any concerns about the API or implementation, I’d be happy to adjust the PR.

roemdevs · 19h ago
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 · 5mo ago

Recent fixes

View closed PRs →
rajanpanth
Fix abort listener cleanup for already-aborted signalsMergedPR

Summary stop setup after rejecting an already-aborted signal verify that no abort listener remains attached after rejection Problem When receives an already-aborted signal, it rejects and runs listener cleanup before the listener has been registered. Execution then continues and registers the listener after the returned promise has already settled, leaving it attached to a reused signal. Fix Return immediately after rejecting the already-aborted signal. The existing listener setup and cleanup behavior for active signals is unchanged. Testing full AVA suite on Node.js 18.20.8 full AVA suite on Node.js 20.20.2

rajanpanth · 1mo ago
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 · 1mo 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 · 2mo ago
Structured data for AI agents

Repository: sindresorhus/p-map. Description: Map over promises concurrently Stars: 1509, Forks: 76. Primary language: JavaScript. Languages: JavaScript (91.6%), TypeScript (8.4%). License: MIT. Topics: async, async-await, async-functions, await, concurrency, iteration, javascript, mapper, nodejs, parallel, promise, promises. Latest release: v7.0.6 (1mo ago). Open PRs: 5, open issues: 9. Last activity: 1mo ago. Community health: 85%. Top contributors: sindresorhus, Richienb, huntharo, parro-it, BendingBender, furudean, noamokman, papb, hong4rc, chrisblossom and others.

·@ofershap

Replace github.com with gitshow.dev