github →

Request

Issue #66

draft pr open
Verification
Verification failed

A check exited non-zero in the sandbox. See the failing script + logs below.

Likely addresses the issue (95% 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 diff adds `pMapWhile` in `index.js` which repeatedly spawns `fn` concurrently up to `concurrency` while `condition()` is true, pauses when the condition is false and pending work is done, and uses `setTimeout(trySpawn, interval)` to re-check and resume if `interval` is provided—exactly matching the requested pause/resume behavior. The types (`WhileOptions` in `index.d.ts`) and docs (`readme.md`) confirm the feature covers concurrency, condition evaluation, and the interval-based polling mechanism described in the issue.

  • testfailed · exit 1 · 10.4s
    > p-map@7.0.4 test
    > xo && ava && tsd
    
    
      ✔ test › handles empty iterable
      ✔ test › asyncIterator - handles empty iterable
      ✔ test › pMapIterable - empty
      ✔ test › pMapWhile - invalid fn
      ✔ test › pMapWhile - invalid condition
      ✔ test › pMapWhile - invalid concurrency
      ✔ test › invalid mapper
      ✔ test › already aborted signal
      ✔ test › pMapIterable - iterable that throws
      ✔ test › pMapSkip
      ✔ test › pMapIterable - mapper that throws
      ✔ test › pMapWhile - fn throws
      ✔ test › pMapWhile - condition throws
      ✔ 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 (112ms)
      ✔ test › asyncIterator - all pMapSkips
      ✔ test › abort by AbortController (101ms)
      ✔ test › pMapWhile - abort by AbortController (102ms)
      ✔ test › no unhandled rejected promises from mapper throws - infinite concurrency (140ms)
      ✔ test › no unhandled rejected promises from mapper throws - concurrency 1 (141ms)
      ✘ [fail]: multiple-pmapskips-performance › multiple pMapSkips - algorithmic complexity 3.0302076000000002 ≤ 43.952503 ≰ 37.877595
      ✔ test › asyncIterator - multiple pMapSkips (172ms)
      ✔ test › pMapIterable - stop on error (119ms)
      ✔ test › pMapWhile - basic (159ms)
      ✔ test › async with concurrency: 2 (random time sequence) (282ms)
      ✔ test › async with concurrency: 2 (out of order time sequence) (283ms)
      ✔ test › async with concurrency: 2 (problematic time sequence) (288ms)
      ✔ test › asyncIterator - async with concurrency: 2 (out of order time sequence) (291ms)
      ✔ test › asyncIterator - async with concurrency: 2 (problematic time sequence) (337ms)
      ✔ test › main (391ms)
      ✔ test › pMapIterable (339ms)
      ✔ test › pMapIterable - async input, backpressure > concurrency (317ms)
      ✔ test › catches exception from source iterator - 1st item (346ms)
      ✔ test › asyncIterator - main (392ms)
      ✔ test › pMapIterable - concurrency: 2 (365ms)
      ✔ test › asyncIterator - async with concurrency: 2 (random time sequence) (459ms)
      ✔ test › catches exception from source iterator - 2nd item (440ms)
      ✔ test › catches exception from source iterator - 2nd item after 1st item mapper throw (440ms)
      ✔ test › pMapWhile - concurrency (417ms)
      ✔ test › asyncIterator - get the correct exception after stop-on-error (499ms)
      ✔ test › incorrect input type (500ms)
      ✔ test › pMapWhile - persistent with interval (500ms)
      ✔ test › immediately rejects when stopOnError is true (606ms)
      ✔ test › asyncIterator - immediately rejects when stopOnError is true (652ms)
      ✔ test › all mappers should run when concurrency is infinite, even after stop-on-error happened (678ms)
      ✔ test › concurrency: 1 (687ms)
      ✔ test › pMapIterable - concurrency: 1 (614ms)
      ✔ test › pMapIterable - index in mapper (640ms)
      ✔ test › asyncIterator - all mappers should run when concurrency is infinite, even after stop-on-error happened (655ms)
      ✔ test › asyncIterator - concurrency: 1 (714ms)
      ✔ test › pMapIterable - backpressure (1s)
      ✔ test › aggregate errors when stopOnError is false (1.3s)
      ✔ test › asyncIterator - aggregate errors when stopOnError is false (1.4s)
      ✔ test › concurrency: 4 (3.2s)
      ✔ test › asyncIterator - concurrency: 4 (3.3s)
      ─
    
      multiple-pmapskips-performance › multiple pMapSkips - algorithmic complexity
    
      test-multiple-pmapskips-performance.js:35
    
       34:     // on the number of `pMapSkip` items in the input.                   
       35:     assertInRange(t, longerDuration, {start: 1.2 * smallerDuration, end:…
       36:   }                                                                      
    
      3.0302076000000002 ≤ 43.952503 ≰ 37.877595
    
      › assertInRange (file://assert-in-range.js:8:5)
      › file://test-multiple-pmapskips-performance.js:35:3
    
      ─
    
      1 test failed

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

Ran 6/4/2026, 1:37:44 AM · npm

Get the code

Pull this branch
With gh CLI
gh pr checkout 8 --repo kamransiddiqui/p-map
Raw git
git fetch https://github.com/kamransiddiqui/p-map.git gitgot/issue-66
git checkout -b gitgot/issue-66 FETCH_HEAD

Fork-mode request: the branch lives on kamransiddiqui/p-map (your fork), not sindresorhus/p-map, so the commands above target the fork.

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 sindresorhus/p-map, addressing issue #66.

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

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.