Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for AsyncIterable as input #46

Merged
merged 6 commits into from Sep 24, 2021

Commits on Sep 12, 2021

  1. Implement sindresorhus#20 - Async Iterable

    - Expand capabilities to handle both async and sync iterables
    - There is a problem in the original functionality around the `stop-on-error` test that needs to be resolved
      - The test has a bug in that neither p-map nor the test mapper function, which is provided for that specific test and is not the common version, await the calling of the delay() function for item 2
      - This means that item 2 will only ever return a Promise, never a value
      - When this is fixed to await the function call, it causes the returned results to change from `[1, 3]` to `[1, 3, 2]`
      - Fixing this test makes it clear that the `concurrency setup` loop does not wait for mappers, so the only way to make this test fail would be to have enough items that eventually the initial iteration could not reach the last items in the test array before the 100 ms delay on the exception expires
      - With `concurrency = 1` this test behaves as expected since there are not unlimited unawaited promises created
      - Let me know your thoughts on how to resolve this as it becomes more apparent with the behavior changes needed for asyncIterable (where the concurrency setup iteration of asyncIterable has to be awaited to prevent inifinte runners from being created)
      - The test, in the state it's in in this PR, does not actually demonstrate that stop on error works as intended
    huntharo committed Sep 12, 2021
    Copy the full SHA
    56a3bca View commit details
    Browse the repository at this point in the history
  2. Update index.js

    Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
    huntharo and sindresorhus committed Sep 12, 2021
    Copy the full SHA
    8477a7a View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    d5a0b26 View commit details
    Browse the repository at this point in the history

Commits on Sep 16, 2021

  1. Rename per request

    huntharo committed Sep 16, 2021
    Copy the full SHA
    6d4156d View commit details
    Browse the repository at this point in the history
  2. Update readme to document async iterables

    - Also distinguish from items returning a promise
    - Update the TS types to indicate that iterated items can actually be a `Promise`
    huntharo committed Sep 16, 2021
    Copy the full SHA
    8b6e6f0 View commit details
    Browse the repository at this point in the history

Commits on Sep 23, 2021

  1. Copy the full SHA
    c9e7112 View commit details
    Browse the repository at this point in the history