| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d88c697 commit cd78c5e
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,7 +6,7 @@ const { Readable } = require('stream'); | |||
| 6 | 6 | const { strictEqual } = require('assert'); | |
| 7 | 7 | ||
| 8 | 8 | async function toReadableBasicSupport() { | |
| 9 | - async function * generate() { | ||
| 9 | + async function* generate() { | ||
| 10 | 10 | yield 'a'; | |
| 11 | 11 | yield 'b'; | |
| 12 | 12 | yield 'c'; | |
@@ -22,7 +22,7 @@ async function toReadableBasicSupport() { | |||
| 22 | 22 | } | |
| 23 | 23 | ||
| 24 | 24 | async function toReadableSyncIterator() { | |
| 25 | - function * generate() { | ||
| 25 | + function* generate() { | ||
| 26 | 26 | yield 'a'; | |
| 27 | 27 | yield 'b'; | |
| 28 | 28 | yield 'c'; | |
@@ -64,7 +64,7 @@ async function toReadableString() { | |||
| 64 | 64 | } | |
| 65 | 65 | ||
| 66 | 66 | async function toReadableOnData() { | |
| 67 | - async function * generate() { | ||
| 67 | + async function* generate() { | ||
| 68 | 68 | yield 'a'; | |
| 69 | 69 | yield 'b'; | |
| 70 | 70 | yield 'c'; | |
@@ -86,7 +86,7 @@ async function toReadableOnData() { | |||
| 86 | 86 | } | |
| 87 | 87 | ||
| 88 | 88 | async function toReadableOnDataNonObject() { | |
| 89 | - async function * generate() { | ||
| 89 | + async function* generate() { | ||
| 90 | 90 | yield 'a'; | |
| 91 | 91 | yield 'b'; | |
| 92 | 92 | yield 'c'; | |
@@ -109,24 +109,22 @@ async function toReadableOnDataNonObject() { | |||
| 109 | 109 | } | |
| 110 | 110 | ||
| 111 | 111 | async function destroysTheStreamWhenThrowing() { | |
| 112 | - async function * generate() { | ||
| 112 | + async function* generate() { | ||
| 113 | 113 | throw new Error('kaboom'); | |
| 114 | 114 | } | |
| 115 | 115 | ||
| 116 | 116 | const stream = Readable.from(generate()); | |
| 117 | 117 | ||
| 118 | 118 | stream.read(); | |
| 119 | 119 | ||
| 120 | - try { | ||
| 121 | - await once(stream, 'error'); | ||
| 122 | - } catch (err) { | ||
| 123 | - strictEqual(err.message, 'kaboom'); | ||
| 124 | - strictEqual(stream.destroyed, true); | ||
| 125 | - } | ||
| 120 | + const [err] = await once(stream, 'error'); | ||
| 121 | + strictEqual(err.message, 'kaboom'); | ||
| 122 | + strictEqual(stream.destroyed, true); | ||
| 123 | + | ||
| 126 | 124 | } | |
| 127 | 125 | ||
| 128 | 126 | async function asTransformStream() { | |
| 129 | - async function * generate(stream) { | ||
| 127 | + async function* generate(stream) { | ||
| 130 | 128 | for await (const chunk of stream) { | |
| 131 | 129 | yield chunk.toUpperCase(); | |
| 132 | 130 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments