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

refactor: export chunks in std/io #3497

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix
  • Loading branch information
bartlomieju committed Dec 14, 2019
commit 1061d1449da8440c64fca5f380f5b224b5fbb883
4 changes: 3 additions & 1 deletion std/io/bufio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -596,5 +596,7 @@ export async function* chunks(

/** Read from reader until EOF and emit lines */
export async function* lines(reader: Reader): AsyncIterableIterator<string> {
return chunks(reader, "\n");
for await (const line of chunks(reader, "\n")) {
yield line;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yield* chunks(reader, "\n");

}
2 changes: 1 addition & 1 deletion std/io/bufio_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ test(async function chunksAndLines(): Promise<void> {
lines_.push(l);
}

assertEquals(lines_.length, 3);
assertEquals(lines_.length, 10);
assertEquals(lines_, ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]);
});

Expand Down