Skip to content

v7.1.0

Latest

Choose a tag to compare

@sindresorhus sindresorhus released this 09 Oct 19:57

New

  • Add pMapSettled, pMapKeyed, and pMapSettledKeyed (#70) a05fd50
    • pMapSettled is like Promise.allSettled(), with a mapper and a concurrency limit
    • pMapKeyed and pMapSettledKeyed map the values of an object or a Map, like Promise.allKeyed() and Promise.allSettledKeyed()
  • Add pMapStop to stop iterating from the mapper, like break in a loop (#31) 27606f0
  • Add preserveOrder option to pMapIterable (#72) 2c0934b
    • Set it to false to get each result as soon as it is ready, instead of in input order
  • Make pMapIterable read ahead while the mappers run when backpressure is above concurrency (#78) cada71d
    • A slow input no longer leaves a mapper waiting for its next element. With the default backpressure, nothing changes

Improvements

  • Keep the caller in the stack trace of mapper errors (#34) 595754b
  • Make pMapIterable consume its results in linear time 7d5b6e1
    • It was O(n²) when backpressure let many results wait, which is the default
  • Reduce the per-element promise overhead ef82ce6
  • Give a nullish input the same TypeError as any other invalid input 6f4643d

Fixes

  • Fix handling of a source that settles its next() calls out of call order 415a474
    • The index and the result position now follow the order of the next() calls
    • With stopOnError: false, the errors in the AggregateError are now in input order, not in the order they happened
  • Fix pMapIterable dropping earlier results when a mapper throws while they are still being read 27606f0
    • The results before the error are now yielded first, like in a loop
  • Fix pMapSkip results not counting toward backpressure in pMapIterable 7d5b6e1
    • A mapper that skips most elements no longer reads further ahead than backpressure allows
  • Fix pMapIterable pulling and mapping input after return() or throw() while a next() call is pending 5f2c01d

v7.0.8...v7.1.0