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
stream: add iterator helper find #41849
stream: add iterator helper find #41849
Conversation
Review requested: |
on the stream at once. **Default:** `1`. | ||
* `signal` {AbortSignal} allows destroying the stream if the signal is | ||
aborted. | ||
* Returns: {Promise} a promise evaluating to the first chunk for which `fn` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it "chunk" or "item"? Let's choose one and use that throughout documentation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want me to change if for every/some as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might as well! Fits in this PR because it already touches those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed item
to chunk
in all places except in one unrelated place.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Continue iterator-helpers work by adding `find` to readable streams.
Landed in 42ad413 |
It looks to me that this should be labelled as Also @Linkgoron should this be marked as a |
Some and every were, so I assume that it should be. |
Continue iterator-helpers work by adding `find` to readable streams. PR-URL: #41849 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Notable changes: lib: * (SEMVER-MINOR) add fetch (Michaël Zasso) #41749 module: * unflag esm json modules (Geoffrey Booth) #41736 node-api: * (SEMVER-MINOR) add node_api_symbol_for() (Darshan Sen) #41329 stream: * (SEMVER-MINOR) add iterator helper find (linkgoron) #41849 * (SEMVER-MINOR) add toArray (Benjamin Gruenbaum) #41553 * (SEMVER-MINOR) add forEach method (Benjamin Gruenbaum) #41445 * (SEMVER-MINOR) support some and every (Benjamin Gruenbaum) #41573 deps: * upgrade npm to 8.4.1 (npm team) [#41836](#41836)
Notable changes: lib: * (SEMVER-MINOR) add fetch (Michaël Zasso) #41749 module: * unflag esm json modules (Geoffrey Booth) #41736 node-api: * (SEMVER-MINOR) add node_api_symbol_for() (Darshan Sen) #41329 stream: * (SEMVER-MINOR) add iterator helper find (linkgoron) #41849 * (SEMVER-MINOR) add toArray (Benjamin Gruenbaum) #41553 * (SEMVER-MINOR) add forEach method (Benjamin Gruenbaum) #41445 * (SEMVER-MINOR) support some and every (Benjamin Gruenbaum) #41573 deps: * upgrade npm to 8.4.1 (npm team) [#41836](#41836)
Notable changes: lib: * (SEMVER-MINOR) add fetch (Michaël Zasso) #41749 module: * unflag esm json modules (Geoffrey Booth) #41736 node-api: * (SEMVER-MINOR) add node_api_symbol_for() (Darshan Sen) #41329 stream: * (SEMVER-MINOR) add iterator helper find (linkgoron) #41849 * (SEMVER-MINOR) add toArray (Benjamin Gruenbaum) #41553 * (SEMVER-MINOR) add forEach method (Benjamin Gruenbaum) #41445 * (SEMVER-MINOR) support some and every (Benjamin Gruenbaum) #41573 deps: * upgrade npm to 8.4.1 (npm team) [#41836](#41836)
Notable changes: lib: * (SEMVER-MINOR) add fetch (Michaël Zasso) #41749 module: * unflag esm json modules (Geoffrey Booth) #41736 node-api: * (SEMVER-MINOR) add node_api_symbol_for() (Darshan Sen) #41329 stream: * (SEMVER-MINOR) add iterator helper find (linkgoron) #41849 * (SEMVER-MINOR) add toArray (Benjamin Gruenbaum) #41553 * (SEMVER-MINOR) add forEach method (Benjamin Gruenbaum) #41445 * (SEMVER-MINOR) support some and every (Benjamin Gruenbaum) #41573 deps: * upgrade npm to 8.4.1 (npm team) [#41836](#41836) PR-URL: #41897
Notable changes: lib: * (SEMVER-MINOR) add fetch (Michaël Zasso) #41749 module: * unflag esm json modules (Geoffrey Booth) #41736 node-api: * (SEMVER-MINOR) add node_api_symbol_for() (Darshan Sen) #41329 stream: * (SEMVER-MINOR) add iterator helper find (linkgoron) #41849 * (SEMVER-MINOR) add toArray (Benjamin Gruenbaum) #41553 * (SEMVER-MINOR) add forEach method (Benjamin Gruenbaum) #41445 * (SEMVER-MINOR) support some and every (Benjamin Gruenbaum) #41573 deps: * upgrade npm to 8.4.1 (npm team) [#41836](#41836) PR-URL: #41897
Add find from the iterator-helper tc39 proposal.
I've also simplified some other things:
some
now usesfilter
, and doesn't create an additional abort controllerthis.map
calls replaced withmap.call
<- as callingthis.map
creates an additionalReadable
There is a behaviour change to some/every where
stream.destroyed
isn't marked as destroyed synchronously, but needs an additional tick.