github →

Request

Issue #1

draft pr open
What we changed

Add a throwOnError option (defaulting to true) to pMap in index.js. When both throwOnError and stopOnError are false, the function resolves with a settledResults array—containing objects with {status: 'fulfilled', value: ...} or {status: 'rejected', reason: ...}—instead of throwing an AggregateError. Items matching pMapSkip are omitted from this array. The Options type in index.d.ts is updated with throwOnError?: boolean and overloaded signatures so that throwOnError: false narrows the return type to Promise<Array<{status: 'fulfilled'; value: Exclude<NewElement, typeof pMapSkip>} | {status: 'rejected'; reason: unknown}>>. Runtime coverage is added in test.js and type assertions in index.test-d.ts.

Verification
Verified — checks passed

We installed dependencies and ran test in a sandbox — all passed.

Could not tell if it addresses the issue (100% confidence)

An AI estimate of whether the change actually fixes the issue — the checks themselves only confirm nothing broke. It's a hint for review, not a pass/fail check.

Why?

The GitHub issue has no title and an empty body, so there are no stated requirements to evaluate whether the diff resolves it.

  • testpassed · 10.3s
    > p-map@7.0.4 test
    > xo && ava && tsd
    
    
      ✔ test › handles empty iterable
      ✔ test › asyncIterator - handles empty iterable
      ✔ test › pMapIterable - empty
      ✔ test › invalid mapper
      ✔ test › already aborted signal
      ✔ test › pMapIterable - iterable that throws
      ✔ test › pMapSkip
      ✔ test › pMapIterable - mapper that throws
      ✔ test › throwOnError: false with pMapSkip
      ✔ test › all pMapSkips
      ✔ test › multiple pMapSkips
      ✔ test › pMapIterable - pMapSkip
      ✔ test › enforce number in options.concurrency
      ✔ test › asyncIterator - enforce number in options.concurrency
      ✔ test › asyncIterator - pMapSkip
      ✔ test › asyncIterator - throwOnError: false with pMapSkip
      ✔ test › asyncIterator - all pMapSkips
      ✔ test › asyncIterator - multiple pMapSkips
      ✔ test › abort by AbortController (102ms)
      ✔ test › no unhandled rejected promises from mapper throws - infinite concurrency (104ms)
      ✔ test › no unhandled rejected promises from mapper throws - concurrency 1 (105ms)
      ✔ test › pMapIterable - stop on error (106ms)
      ✔ multiple-pmapskips-performance › multiple pMapSkips - algorithmic complexity (126ms)
      ✔ test › async with concurrency: 2 (out of order time sequence) (209ms)
      ✔ test › async with concurrency: 2 (problematic time sequence) (215ms)
      ✔ test › asyncIterator - async with concurrency: 2 (out of order time sequence) (213ms)
      ✔ test › asyncIterator - async with concurrency: 2 (problematic time sequence) (258ms)
      ✔ test › asyncIterator - async with concurrency: 2 (random time sequence) (293ms)
      ✔ test › main (311ms)
      ✔ test › pMapIterable (302ms)
      ✔ test › catches exception from source iterator - 1st item (310ms)
      ✔ test › pMapIterable - async input, backpressure > concurrency (307ms)
      ✔ test › asyncIterator - main (315ms)
      ✔ test › returns settled results when throwOnError is false and stopOnError is false (328ms)
      ✔ test › throwOnError: true (default) still throws AggregateError (328ms)
      ✔ test › async with concurrency: 2 (random time sequence) (342ms)
      ✔ test › pMapIterable - concurrency: 2 (352ms)
      ✔ test › asyncIterator - returns settled results when throwOnError is false and stopOnError is false (365ms)
      ✔ test › catches exception from source iterator - 2nd item (405ms)
      ✔ test › catches exception from source iterator - 2nd item after 1st item mapper throw (405ms)
      ✔ test › asyncIterator - get the correct exception after stop-on-error (500ms)
      ✔ test › incorrect input type (500ms)
      ✔ test › immediately rejects when stopOnError is true (529ms)
      ✔ test › asyncIterator - immediately rejects when stopOnError is true (574ms)
      ✔ test › pMapIterable - index in mapper (602ms)
      ✔ test › concurrency: 1 (610ms)
      ✔ test › returns all fulfilled when throwOnError is false and no errors (608ms)
      ✔ test › pMapIterable - concurrency: 1 (602ms)
      ✔ test › all mappers should run when concurrency is infinite, even after stop-on-error happened (608ms)
      ✔ test › asyncIterator - all mappers should run when concurrency is infinite, even after stop-on-error happened (613ms)
      ✔ test › asyncIterator - concurrency: 1 (636ms)
      ✔ test › pMapIterable - backpressure (1s)
      ✔ test › aggregate errors when stopOnError is false (1.2s)
      ✔ test › asyncIterator - aggregate errors when stopOnError is false (1.3s)
      ✔ test › concurrency: 4 (2.7s)
      ✔ test › asyncIterator - concurrency: 4 (3.2s)
      ─
    
      56 tests passed
    
    npm warn Unknown env config "verify-deps-before-run". This will stop working in the next major version of npm. See `npm help npmrc` for supported config options.
    npm warn Unknown user config "dangerously-allow-all-builds". This will stop working in the next major version of npm. See `npm help npmrc` for supported config options.
    npm warn Unknown user config "verify-deps-before-run". This will stop working in the next major version of npm. See `npm help npmrc` for supported config options.

lint, typecheck, and build are not defined separately in this repo.

Ran 6/12/2026, 11:19:44 PM · npm

Get the code

Pull this branch
With gh CLI
gh pr checkout 20
Raw git
git fetch origin gitgot/issue-1-542da939
git checkout gitgot/issue-1-542da939
Drive locally

Paste this into your local coding agent (Claude Code, Cursor, etc.) to continue iterating with full repo context.

Context prompt
You are continuing work on a draft PR for kamransiddiqui/p-map, addressing issue #1.

First, check out the branch with gitgot's first-pass change (run from a clone of the repo):
  gh pr checkout 20

Then review the diff and:
- run the project's lint/typecheck/test commands and fix anything broken
- if the diff is wrong-headed, revert it and start fresh from the issue
- keep the change tight; do not refactor unrelated code
PR thread
  • No comments on the PR yet. Use the form below to start the thread.