minor
This commit is contained in:
parent
b753823786
commit
39309e6a07
19 changed files with 60 additions and 35 deletions
|
@ -239,8 +239,8 @@ function* generateSequence(start, end) {
|
|||
|
||||
Now we'd like to reuse it for generation of a more complex sequence:
|
||||
- first, digits `0..9` (with character codes 48..57),
|
||||
- followed by alphabet letters `a..z` (character codes 65..90)
|
||||
- followed by uppercased letters `A..Z` (character codes 97..122)
|
||||
- followed by alphabet letters `A..Z` (character codes 65..90)
|
||||
- followed by uppercased letters `a..z` (character codes 97..122)
|
||||
|
||||
We can use this sequence e.g. to create passwords by selecting characters from it (could add syntax characters as well), but let's generate it first.
|
||||
|
||||
|
|
|
@ -283,7 +283,7 @@ for await (let commit of fetchCommits(repo)) {
|
|||
}
|
||||
```
|
||||
|
||||
We'd like a call, like `fetchCommits(repo)` to get commits for us, making requests whenever needed. And let it care about all pagination stuff, for us it'll be a simple `for await..of`.
|
||||
We'd like to make a function `fetchCommits(repo)` that gets commits for us, making requests whenever needed. And let it care about all pagination stuff, for us it'll be a simple `for await..of`.
|
||||
|
||||
With async generators that's pretty easy to implement:
|
||||
|
||||
|
@ -361,4 +361,4 @@ In web-development we often meet streams of data, when it flows chunk-by-chunk.
|
|||
|
||||
We can use async generators to process such data, but it's also worth to mention that there's also another API called Streams, that provides special interfaces to work with such streams, to transform the data and to pass it from one stream to another (e.g. download from one place and immediately send elsewhere).
|
||||
|
||||
Streams API is not a part of JavaScript language standard.
|
||||
Streams API is not a part of JavaScript language standard.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue