GithubHelp home page GithubHelp logo

Comments (4)

RebeccaStevens avatar RebeccaStevens commented on June 26, 2024 1

What I'm getting at is the current toIterable supports more than just making promises iterable. It will also make single values into an iterable of one value.

If we simply use toIterable, we will be getting promise support but also other stuff; this would then make pipeAsync inconsistent with pipeSync.
Should pipeSync also get support for these other things or would it be better to make pipeAsync not also get that other stuff?

from iter-ops.

RebeccaStevens avatar RebeccaStevens commented on June 26, 2024

So just took a look at this and it seems really easy to do.
Just a few details we need to sort on how it should work:

  • Should it allow any promise or just promises that return an iterable (either sync or async)?
    • Allowing all promise types could be added in as single line (excluding typing updates).
      • Doing so would allow for single values to be used as iterable when returned by promises, but not if they aren't wrapped. If we go with this approach, we'd probably want to allow sync single values as well which would mean we should also make the change to sync pipeline as well.
    • Only allowing promises that return an iterable.
      • This wouldn't be hard either, but it would require some extra checks to be added to test the promise (no more than what toIterable is already doing).

from iter-ops.

vitaly-t avatar vitaly-t commented on June 26, 2024

The result of pipeAsync(promise) should be consistent with pipe(toIterable(promise)). If we decide to extend toIterable later, it would be another matter. For now, we should just use the existing toIterable to provide consistent result.

@RebeccaStevens ;)

from iter-ops.

vitaly-t avatar vitaly-t commented on June 26, 2024

You are right, there would be inconsistency, I forgot about simple values.

I think it is better then to close this issue, leave functionality as is, we do not want to create a discrepancy here.

from iter-ops.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.