Skip to content

Commit

Permalink
Fix Stream.take(n) not returning immediately after the last item
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexagon committed Jul 10, 2024
1 parent 76b72c8 commit d6a2210
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "everscale-inpage-provider",
"version": "0.3.65",
"version": "0.3.66",
"description": "Web3-like interface to the Everscale blockchain",
"repository": "https://github.com/broxus/everscale-inpage-provider",
"main": "dist/index.js",
Expand Down
3 changes: 2 additions & 1 deletion src/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,8 @@ class StreamImpl<P, T, F extends boolean> implements Stream<P, T, F> {
this.extractor(event, (item) => {
if (state.index < n) {
++state.index;
return handler(item);
// NOTE: Execute the handler and ensure that `false` is returned right after the Nth call
return handler(item) && state.index < n;
} else {
return false;
}
Expand Down

0 comments on commit d6a2210

Please sign in to comment.