From 77dc1ba4b3bdabf44e6ecfbd8bc672c5523c3e80 Mon Sep 17 00:00:00 2001 From: Ilya Kantor Date: Sat, 21 Sep 2019 22:12:08 +0300 Subject: [PATCH] fix --- .../2-async-iterators-generators/article.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 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 94d6e281..554b2d48 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 @@ -345,20 +345,18 @@ When we expect the data to come asynchronously, with delays, their async counter Syntax differences between async and regular iterators: -| | Iterators | Async iterators | +| | Iterable | Async Iterable | |-------|-----------|-----------------| -| Object method to provide iterator | `Symbol.iterator` | `Symbol.asyncIterator` | -| `next()` return value is | any value | `Promise` | +| Method to provide iterator | `Symbol.iterator` | `Symbol.asyncIterator` | +| `next()` return value is | `{value:…, done: true/false}` | `Promise` that resolves to `{value:…, done: true/false}` | Syntax differences between async and regular generators: | | Generators | Async generators | |-------|-----------|-----------------| | Declaration | `function*` | `async function*` | -| `generator.next()` returns | `{value:…, done: true/false}` | `Promise` that resolves to `{value:…, done: true/false}` | +| `next()` return value is | `{value:…, done: true/false}` | `Promise` that resolves to `{value:…, done: true/false}` | In web-development we often meet streams of data, when it flows chunk-by-chunk. For instance, downloading or uploading a big file. -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. +We can use async generators to process such data. It's also noteworthy that in some environments, such as browsers, 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).