This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{ | |
"title": "Chamadas", | |
"data": [{ | |
"id": "1", | |
"date": "14 de abril de 2018", | |
"status": "calling", | |
"ticketNumber": "N45", | |
"place": "Hospital Unimed", | |
"estimatedTime": "45 minutos" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var myArray = [15,30,35] | |
const doubles = myArray.map(item => item * 2) | |
console.log(doubles) | |
// [30,60,70] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const users = [ | |
{ | |
id: 1, | |
name: "Allan", | |
age: 27, | |
profilePicture: "http://…", | |
city: "São Paulo" | |
}, | |
{ | |
id: 2, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Criamos um array | |
var myArray = [15,30,35] | |
// Criamos a função que será passada ao map | |
function double(item) { | |
return item * 2 | |
} | |
// Criamos o array que irá receber o resultado da função double | |
let doubles = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Criamos um array | |
var myArray = [15,30,35] | |
// Criamos a função que será passada ao map | |
function double(item) { | |
return item * 2 | |
} | |
// Atribuímos o resultado do map a uma variável | |
const doubles = myArray.map(double) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
filtered_users = filter(lambda user: user["age"] > 27, users) | |
list(filtered_users) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Crie a função que irá filtrar a lista | |
def users_over_27(user): | |
return user["age"] > 27 | |
# Filtramos os usuários utilizando o método filter | |
filtered_users = filter(users_over_27, users) | |
list(filtered_users) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
users = [ | |
{ | |
"id": 1, | |
"name": "Allan", | |
"age": 27, | |
"profile_picture": "http://…", | |
"city": "São Paulo" | |
}, | |
{ | |
"id": 2, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Para CPF | |
/^\d{3}\.\d{3}\.\d{3}\-\d{2}$/ | |
Para CNPJ | |
/^\d{2}\.\d{3}\.\d{3}\/\d{4}\-\d{2}$/ | |
Para ambos ao mesmo tempo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
axios.interceptors.response.use((response) => { | |
// Do something with response data | |
return response; | |
},(error) => { | |
// Do something with response error | |
// You can even test for a response code | |
// and try a new request before rejecting the promise | |
if (error.response.status === 401) { | |
const requestConfig = error.config; |