Last 12 weeks · 4 commits
4 of 6 standards met
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.
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.
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
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).
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.*
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.