From 57eb0e300af5143c63c0df47b8b0aa6a7463b803 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Bevacqua?= Date: Sun, 13 Aug 2017 12:12:47 -0300 Subject: [PATCH] Pass-through for generator stars in code. --- ch04.asciidoc | 2 +- ch08.asciidoc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ch04.asciidoc b/ch04.asciidoc index 57a4a7d..6342cf1 100644 --- a/ch04.asciidoc +++ b/ch04.asciidoc @@ -1068,7 +1068,7 @@ Generators ((("generators", id="gen4")))are a new feature in ES6. The way they w We ((("generators", "fundamentals", id="gen4f")))already examined iterators in the previous section, learning how their `.next()` method is called one at a time to pull values from a sequence. Instead of a `next` method whenever you return a value, generators use the `yield` ((("yield")))keyword to add values into the sequence. -Here is an example generator function. Note the `+*+` after `function`. That's ((("function*")))not a typo, that's how you mark a generator function as a generator. +Here is an example generator function. Note the pass:[*] after `function`. That's ((("function*")))not a typo, that's how you mark a generator function as a generator. [source,javascript] ---- diff --git a/ch08.asciidoc b/ch08.asciidoc index f78e604..b0fc93f 100644 --- a/ch08.asciidoc +++ b/ch08.asciidoc @@ -45,7 +45,7 @@ console.log(union([1, 2], 2)) ==== We can omit the ((("CommonJS", "file extension use")))file extension as long as it's _.js_ or _.json_, but this is discouraged. -While the file extension is optional for `require` statements and when using the `node` CLI, we should strongly consider getting into the habit of including it nevertheless. https://html.spec.whatwg.org/multipage/webappapis.html#integration-with-the-javascript-module-system[Browser implementations of ESM] won't have this luxury, since that'd entail extra roundtrips to figure out the correct endpoint for a JavaScript module HTTP resource. +While the file extension is optional for `require` statements and when using the `node` CLI, we should strongly consider getting into the habit of including it nevertheless. https://html.spec.whatwg.org/multipage/webappapis.html#integration-with-the-javascript-module-system[Browser implementations of ESM] won't have this luxury, since that'd entail extra roundtrips to figure out the correct endpoint for a JavaScript module HTTP resource. ==== We could run `_app.js_` in its current state through the CLI for Node.js, `node`, as seen in the next snippet. @@ -507,7 +507,7 @@ Lastly, there are also namespace ((("import statements", "named exports", startr ===== Wildcard import statements -We can ((("import statements", "wildcards")))((("wildcard import statements")))import the namespace object for a module by using a wildcard. Instead of importing the named exports or the default value, it imports everything at once. Note that the `*` must be followed by an alias where all the bindings will be placed. If there was a `default` export, it'll be placed in the namespace binding ((("ES6 modules", "import statements", startref="esm8is")))((("import statements", startref="is8")))as well. +We can ((("import statements", "wildcards")))((("wildcard import statements")))import the namespace object for a module by using a wildcard. Instead of importing the named exports or the default value, it imports everything at once. Note that the pass:[*] must be followed by an alias where all the bindings will be placed. If there was a `default` export, it'll be placed in the namespace binding ((("ES6 modules", "import statements", startref="esm8is")))((("import statements", startref="is8")))as well. [source,javascript]