Skip to content

Commit e1c896a

Browse files
committed
new files added
1 parent 750de39 commit e1c896a

14 files changed

+150
-0
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

Diff for: exercicios-js/node/exportar.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
console.log(module.exports === this)
2+
console.log(module.exports === exports)
3+
4+
this.a = 1
5+
exports.b = 2
6+
module.exports.c = 3
7+
8+
exports = {
9+
nome: 'Teste'
10+
}
11+
12+
module.exports = { publico: true }

Diff for: exercicios-js/node/exportarCliente.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const exportar = require('./exportar')
2+
console.log(exportar)

Diff for: exercicios-js/node/funcionarios/funcionarios.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const url = 'http://files.cod3r.com.br/curso-js/funcionarios.json'
2+
const axios = require('axios')
3+
4+
// variavel que recebe uma arrow function para percorrer o pais dos funcionarios
5+
const chineses = f => f.pais === 'China'
6+
// função para percorres o genero dos funcionarios
7+
const mulheres = f => f.genero === 'F'
8+
// função para ser usada com o reduce afim de comparar e extrair o menor salário entre as funcionárias
9+
const menorSalario = (func, funcAtual) => {
10+
return func.salario < funcAtual.salario ? func : funcAtual
11+
}
12+
13+
14+
axios.get(url).then(response => {
15+
const funcionarios = response.data
16+
17+
const func = funcionarios.filter(chineses).filter(mulheres).reduce(menorSalario)
18+
19+
console.log(func)
20+
})
21+

Diff for: exercicios-js/node/funcionarios/package-lock.json

+37
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: exercicios-js/node/funcionarios/package.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "funcionarios",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"keywords": [],
10+
"author": "",
11+
"license": "ISC",
12+
"dependencies": {
13+
"axios": "^0.19.2"
14+
}
15+
}

Diff for: exercicios-js/node/moduloA.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
this.ola = 'Fala Pessoal'
2+
exports.bemVindo = 'Bem vindo ao node!'
3+
module.exports.ateLogo = 'Até Logo'

Diff for: exercicios-js/node/moduloB.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
bomDia: 'Bom dia',
3+
boaNoite() {
4+
return 'Boa noite'
5+
}
6+
}
7+

Diff for: exercicios-js/node/moduloCliente.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const moduloA = require('./moduloA')
2+
const moduloB = require('./moduloB')
3+
4+
console.log(moduloA.ola)
5+
console.log(moduloA.bemVindo)
6+
console.log(moduloA.ateLogo)
7+
8+
console.log(moduloB.bomDia)
9+
console.log(moduloB.boaNoite())
10+
console.log(moduloB)

Diff for: exercicios-js/node/pastaA/pastaB/acessarModulos.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const moduloA = require('../../moduloA')
2+
console.log(moduloA.ola)
3+
4+
const c = require('./pastaC')
5+
console.log(c.ola2)
6+
7+
// const http = require('http')
8+
// http.createServer((req, res) => {
9+
// res.write('Bom dia!')
10+
// res.end()
11+
// }).listen(8080)

Diff for: exercicios-js/node/pastaA/pastaB/pastaC/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
this.ola2 = 'Olá'

Diff for: exercicios-js/node/usandoModulosTerceiros.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const _ = require('lodash')
2+
setInterval(() => console.log(_.random(5, 10)), 500)

Diff for: exercicios-js/package-lock.json

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: exercicios-js/package.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "exercicios-js",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"keywords": [],
10+
"author": "",
11+
"license": "ISC",
12+
"dependencies": {
13+
"lodash": "^4.17.19"
14+
}
15+
}

0 commit comments

Comments
 (0)