Skip to content

Commit 71120d5

Browse files
authored
Various small wording and punctuation changes
1 parent 2a01424 commit 71120d5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

1-js/13-modules/02-import-export/article.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ Mostly, the second approach is preferred, so that every "thing" resides in its o
162162

163163
Naturally, that requires a lot of files, as everything wants its own module, but that's not a problem at all. Actually, code navigation becomes easier if files are well-named and structured into folders.
164164
165-
Modules provide special `export default` ("the default export") syntax to make the "one thing per module" way look better.
165+
Modules provide a special `export default` ("the default export") syntax to make the "one thing per module" way look better.
166166
167167
Put `export default` before the entity to export:
168168
@@ -216,9 +216,9 @@ export default function(user) { // no function name
216216
export default ['Jan', 'Feb', 'Mar','Apr', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
217217
```
218218
219-
Not giving a name is fine, because `export default` is only one per file, so `import` without curly braces knows what to import.
219+
Not giving a name is fine, because there is only one `export default` per file, so `import` without curly braces knows what to import.
220220
221-
Without `default`, such export would give an error:
221+
Without `default`, such an export would give an error:
222222
223223
```js
224224
export class { // Error! (non-default export needs a name)
@@ -241,7 +241,7 @@ function sayHi(user) {
241241
export {sayHi as default};
242242
```
243243
244-
Or, another situation, let's say a module `user.js` exports one main "default" thing and a few named ones (rarely the case, but happens):
244+
Or, another situation, let's say a module `user.js` exports one main "default" thing, and a few named ones (rarely the case, but it happens):
245245

246246
```js
247247
// 📁 user.js
@@ -277,9 +277,9 @@ new User('John');
277277
278278
### A word against default exports
279279
280-
Named exports are explicit. They exactly name what they import, so we have that information from them, that's a good thing.
280+
Named exports are explicit. They exactly name what they import, so we have that information from them; that's a good thing.
281281

282-
Named exports enforce us to use exactly the right name to import:
282+
Named exports force us to use exactly the right name to import:
283283

284284
```js
285285
import {User} from './user.js';
@@ -321,7 +321,7 @@ export {default as User} from './user.js'; // re-export default
321321
322322
Why would that be needed? Let's see a practical use case.
323323

324-
Imagine, we're writing a "package": a folder with a lot of modules, with some of the functionality exported outside (tools like NPM allow to publish and distribute such packages), and many modules are just "helpers", for the internal use in other package modules.
324+
Imagine, we're writing a "package": a folder with a lot of modules, with some of the functionality exported outside (tools like NPM allow us to publish and distribute such packages), and many modules are just "helpers", for internal use in other package modules.
325325
326326
The file structure could be like this:
327327
```

0 commit comments

Comments
 (0)