From 537c33493a7cf11870b487d079cb00d5fd947f06 Mon Sep 17 00:00:00 2001 From: Peter Roche <46547072+paroche@users.noreply.github.com> Date: Thu, 6 Feb 2020 23:21:57 -0700 Subject: [PATCH] Update article.md Several punctuation changes, yielding: "1. We use the browser [fetch](info:fetch) method to download from a remote URL. It allows us to supply authorization and other headers if needed -- here GitHub requires `User-Agent`. 2. The fetch result is parsed as JSON. That's again a `fetch`-specific method. 3. We should get the next page URL from the `Link` header of the response. It has a special format, so we use a regexp for that. The next page URL may look like `https://api.github.com/repositories/93253246/commits?page=2`. It's generated by GitHub itself. 4. Then we yield all commits received, and when they finish, the next `while(url)` iteration will trigger, making one more request." --- .../2-async-iterators-generators/article.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/1-js/12-generators-iterators/2-async-iterators-generators/article.md b/1-js/12-generators-iterators/2-async-iterators-generators/article.md index 5edcc658..97cfdbe1 100644 --- a/1-js/12-generators-iterators/2-async-iterators-generators/article.md +++ b/1-js/12-generators-iterators/2-async-iterators-generators/article.md @@ -312,10 +312,10 @@ async function* fetchCommits(repo) { } ``` -1. We use the browser [fetch](info:fetch) method to download from a remote URL. It allows to supply authorization and other headers if needed, here GitHub requires `User-Agent`. -2. The fetch result is parsed as JSON, that's again a `fetch`-specific method. -3. We should get the next page URL from the `Link` header of the response. It has a special format, so we use a regexp for that. The next page URL may look like `https://api.github.com/repositories/93253246/commits?page=2`, it's generated by GitHub itself. -4. Then we yield all commits received, and when they finish -- the next `while(url)` iteration will trigger, making one more request. +1. We use the browser [fetch](info:fetch) method to download from a remote URL. It allows us to supply authorization and other headers if needed -- here GitHub requires `User-Agent`. +2. The fetch result is parsed as JSON. That's again a `fetch`-specific method. +3. We should get the next page URL from the `Link` header of the response. It has a special format, so we use a regexp for that. The next page URL may look like `https://api.github.com/repositories/93253246/commits?page=2`. It's generated by GitHub itself. +4. Then we yield all commits received, and when they finish, the next `while(url)` iteration will trigger, making one more request. An example of use (shows commit authors in console):