Skip to content

Commit 0806399

Browse files
committed
minor fixes
1 parent 0c8a4fe commit 0806399

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

1-js/02-first-steps/11-logical-operators/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Logical operators
1+
# Logical operators: ||, && and !
22

33
There are four logical operators in JavaScript: `||` (OR), `&&` (AND), `!` (NOT), '??' (Nullish Coalescing).
44

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -337,13 +337,19 @@ auth/
337337
...
338338
```
339339
340-
We'd like to expose the package functionality via a single entry point, the "main file" `auth/index.js`, to be used like this:
340+
We'd like to expose the package functionality via a single entry point.
341+
342+
In other words, a person who would like to use our package, should import only from the "main file" `auth/index.js`.
343+
344+
Like this:
341345
342346
```js
343347
import {login, logout} from 'auth/index.js'
344348
```
345349

346-
The idea is that outsiders, developers who use our package, should not meddle with its internal structure, search for files inside our package folder. We export only what's necessary in `auth/index.js` and keep the rest hidden from prying eyes.
350+
The "main file", `auth/index.js` exports all the functionality that we'd like to provide in our package.
351+
352+
The idea is that outsiders, other programmers who use our package, should not meddle with its internal structure, search for files inside our package folder. We export only what's necessary in `auth/index.js` and keep the rest hidden from prying eyes.
347353

348354
As the actual exported functionality is scattered among the package, we can import it into `auth/index.js` and export from it:
349355

@@ -366,14 +372,16 @@ The syntax `export ... from ...` is just a shorter notation for such import-expo
366372

367373
```js
368374
// 📁 auth/index.js
369-
// import login/logout and immediately export them
375+
// re-export login/logout
370376
export {login, logout} from './helpers.js';
371377

372-
// import default as User and export it
378+
// re-export the default export as User
373379
export {default as User} from './user.js';
374380
...
375381
```
376382

383+
The notable difference of `export ... from` compared to `import/export` is that re-exported modules aren't available in the current file. So inside the above example of `auth/index.js` we can't use re-exported `login/logout` functions.
384+
377385
### Re-exporting the default export
378386

379387
The default export needs separate handling when re-exporting.

0 commit comments

Comments
 (0)