Comments (4)
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.
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).
- This wouldn't be hard either, but it would require some extra checks to be added to test the promise (no more than what
- Allowing all promise types could be added in as single line (excluding typing updates).
from iter-ops.
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.
from iter-ops.
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)
- Add support for infinite timeouts HOT 1
- Extend "last" operator with iteration state HOT 17
- "reduce" callback gets incorrect index HOT 1
- pipeSync should throw an error on any asynchronous input
- Add async callback support to operator "reduce" HOT 5
- Initial value delayed in waitRace operator HOT 17
- Operator waitRace should deactivate when cacheSize < 2 HOT 1
- start vs stop logic inconsistency HOT 11
- Operators "wait" and "waitRace" should simply forward in sync mode HOT 2
- Post-merge issues of decoupling the interface HOT 31
- toIterable() fails with completed iterators HOT 7
- Operator concurrencyFork should handle pipeline-construction errors HOT 1
- Review toIterable logic HOT 3
- Operator timeout should forward callback errors HOT 1
- Operator timeout should account for the first value. HOT 1
- Benchmark Readme statement about RXJS subscription is incorrect. HOT 3
- takeUntil takes iterates to one more elements HOT 1
- Further iterable extension with method `Add` HOT 1
- `flat` is not consistent with `Array.flat` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from iter-ops.