You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 1-js/03-code-quality/06-polyfills/article.md
-4Lines changed: 0 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,12 +23,8 @@ Actually, there are two parts in Babel:
23
23
24
24
2. Second, the polyfill.
25
25
26
-
<<<<<<< HEAD
27
-
The transpiler rewrites the code, so syntax features are covered. But for new functions we need to write a special script that implements them. JavaScript is a highly dynamic language, scripts may not just add new functions, but also modify built-in ones, so that they behave according to the modern standard.
28
-
=======
29
26
New language features may include not only syntax constructs, but also built-in functions.
30
27
The transpiler rewrites the code, transforming syntax constructs into older ones. But as for new built-in functions, we need to implement them. JavaScript is a highly dynamic language, scripts may add/modify any functions, so that they behave according to the modern standard.
31
-
>>>>>>> dccca58f268ad6d5a6f2160613a8ea3c5cd53a2d
32
28
33
29
There's a term "polyfill" for scripts that "fill in" the gap and add missing implementations.
Copy file name to clipboardExpand all lines: 1-js/08-prototypes/01-prototype-inheritance/article.md
-8Lines changed: 0 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,11 +12,7 @@ In JavaScript, objects have a special hidden property `[[Prototype]]` (as named
12
12
13
13

14
14
15
-
<<<<<<< HEAD
16
-
That `[[Prototype]]` has a "magical" meaning. When we want to read a property from `object`, and it's missing, JavaScript automatically takes it from the prototype. In programming, such thing is called "prototypal inheritance". Many cool language features and programming techniques are based on it.
17
-
=======
18
15
When we read a property from `object`, and it's missing, JavaScript automatically takes it from the prototype. In programming, such thing is called "prototypal inheritance". And soon we'll study many examples of such inheritance, as well as cooler language features built upon it.
19
-
>>>>>>> dccca58f268ad6d5a6f2160613a8ea3c5cd53a2d
20
16
21
17
The property `[[Prototype]]` is internal and hidden, but there are many ways to set it.
Copy file name to clipboardExpand all lines: 1-js/11-async/06-promisify/article.md
-8Lines changed: 0 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,11 +46,7 @@ let loadScriptPromise = function(src) {
46
46
// loadScriptPromise('path/script.js').then(...)
47
47
```
48
48
49
-
<<<<<<< HEAD
50
-
Now `loadScriptPromise` fits well in our promise-based code.
51
-
=======
52
49
As we can see, the new function is a wrapper around the original `loadScript` function. It calls it providing its own callback that translates to promise `resolve/reject`.
53
-
>>>>>>> dccca58f268ad6d5a6f2160613a8ea3c5cd53a2d
54
50
55
51
Now `loadScriptPromise` fits well in promise-based code. If we like promises more than callbacks (and soon we'll see more reasons for that), then we will use it instead.
56
52
@@ -90,14 +86,10 @@ Here, `promisiefy` assumes that the original function expects a callback with ex
90
86
91
87
But what if the original `f` expects a callback with more arguments `callback(err, res1, res2)`?
92
88
93
-
<<<<<<< HEAD
94
-
Here's a modification of `promisify` that returns an array of multiple callback results:
95
-
=======
96
89
We can improve our helper. Let's make a more advanced version of `promisify`.
97
90
98
91
- When called as `promisify(f)` it should work similar to the version above.
99
92
- When called as `promisify(f, true)`, it should return the promise that resolves with the array of callback results. That's exactly for callbacks with many arguments.
Copy file name to clipboardExpand all lines: 1-js/13-modules/02-import-export/article.md
+1-19Lines changed: 1 addition & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -321,11 +321,7 @@ export {default as User} from './user.js'; // reexporta o default
321
321
322
322
Por que isso seria necessário? Vamos ver um caso de uso prático.
323
323
324
-
<<<<<<<HEAD
325
-
Imagine que estamos escrevendo um "pacote": uma pasta com muitos módulos, com algumas funcionalidades exportadas (ferramentas como NPM permitem publicar e distribuir esses pacotes), e muitos módulos são apenas "auxiliares", para uso interno em outro pacote de módulos.
326
-
=======
327
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, but we don't have to use them), and many modules are just "helpers", for internal use in other package modules.
328
-
>>>>>>> dccca58f268ad6d5a6f2160613a8ea3c5cd53a2d
329
325
330
326
A estrutura de arquivos pode ser assim:
331
327
```
@@ -382,11 +378,7 @@ export {default as User} from './user.js';
382
378
383
379
O export default precisa de um tratamento separado ao reexportar.
384
380
385
-
<<<<<<< HEAD
386
-
Vamos dizer que temos `user.js` com o `export default class User`, e gostaríamos de o reexportar:
387
-
=======
388
381
Let's say we have `user.js` with the `export default class User` and would like to re-export it:
389
-
>>>>>>> dccca58f268ad6d5a6f2160613a8ea3c5cd53a2d
390
382
391
383
```js
392
384
// 📁 user.js
@@ -395,14 +387,8 @@ export default class User {
395
387
}
396
388
```
397
389
398
-
<<<<<<< HEAD
399
-
Podemos encontrar dois problemas:
400
-
=======
401
390
We can come across two problems with it:
402
391
403
-
1.`export User from './user.js'` won't work. That would lead to a syntax error.
404
-
>>>>>>> dccca58f268ad6d5a6f2160613a8ea3c5cd53a2d
405
-
406
392
1.`export User from './user.js'` não funcionará. Isso levaria a um erro de sintaxe.
407
393
408
394
Para reexportar o export default, nós temos que escrever `export {default as User}`, como no exemplo acima.
@@ -415,11 +401,7 @@ We can come across two problems with it:
415
401
export {default} from'./user.js'; // para reexportar o export default
416
402
```
417
403
418
-
<<<<<<<HEAD
419
-
Essas esquisitices de reexportar o exportdefaultsão um dos motivos pelos quais alguns desenvolvedores não gostam de default exports e preferem os nomeados.
420
-
=======
421
-
Such oddities of re-exporting a default exportareoneofthereasonswhysomedevelopersdon't like default exports and prefer named ones.
422
-
>>>>>>> dccca58f268ad6d5a6f2160613a8ea3c5cd53a2d
404
+
Essas esquisitices de reexportar um default exportsãoumdosmotivospelosquaisalgunsdesenvolvedoresnãogostamdedefaultexportsepreferemosnomeados.
0 commit comments