Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 1-js/05-data-types/12-json/1-serialize-object/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ importance: 5

---

# Turn the object into JSON and back
# Transforme o objeto em JSON e de volta

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"e de volta" fica incompleto em português (de volta para quê?). Sugestão:

Suggested change
# Transforme o objeto em JSON e de volta
# Converta o objeto em JSON e de volta para objeto


Turn the `user` into JSON and then read it back into another variable.
Transforme o `user` em JSON e depois leia-o de volta em outra variável.

```js
let user = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

```js run

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remoção da linha em branco inicial/final não faz parte da tradução e gera ruído no diff contra o upstream (dificulta sync futuro). Considere reverter as mudanças só de whitespace.

let room = {
number: 23
Expand Down Expand Up @@ -26,5 +25,4 @@ alert( JSON.stringify(meetup, function replacer(key, value) {
*/
```

Here we also need to test `key==""` to exclude the first call where it is normal that `value` is `meetup`.

Aqui também precisamos testar `key==""` para excluir a primeira chamada, em que é normal que `value` seja `meetup`.
14 changes: 7 additions & 7 deletions 1-js/05-data-types/12-json/2-serialize-event-circular/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ importance: 5

---

# Exclude backreferences
# Excluir referências cíclicas

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Título "referências cíclicas" destoa do corpo/artigo, que usam "referências circulares" em todo lugar. Sugestão para manter a terminologia consistente:

Suggested change
# Excluir referências cíclicas
# Excluir referências circulares


In simple cases of circular references, we can exclude an offending property from serialization by its name.
Em casos simples de referências circulares, podemos excluir uma propriedade problemática da serialização pelo seu nome.

But sometimes we can't just use the name, as it may be used both in circular references and normal properties. So we can check the property by its value.
Mas às vezes não podemos simplesmente usar o nome, já que ele pode ser usado tanto em referências circulares quanto em propriedades normais. Então podemos verificar a propriedade pelo seu valor.

Write `replacer` function to stringify everything, but remove properties that reference `meetup`:
Escreva uma função `replacer` para transformar tudo em string, mas removendo propriedades que referenciam `meetup`:

```js run
let room = {
Expand All @@ -22,16 +22,16 @@ let meetup = {
};

*!*
// circular references
// referências circulares
room.occupiedBy = meetup;
meetup.self = meetup;
*/!*

alert( JSON.stringify(meetup, function replacer(key, value) {
/* your code */
/* seu código */
}));

/* result should be:
/* o resultado deve ser:
{
"title":"Conference",
"occupiedBy":[{"name":"John"},{"name":"Alice"}],
Expand Down
Loading