-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
30 lines (22 loc) · 744 Bytes
/
app.js
File metadata and controls
30 lines (22 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const colors = require('colors');
const lugar = require('./lugar/lugar');
const clima = require('./clima/clima');
const argv = require('./yargs/yargs').argv;
const { getLugarLatLng } = require('./lugar/lugar');
const { getClima } = require('./clima/clima');
let getInfoClima = async(direccion) => {
try {
let coors = await getLugarLatLng(direccion);
let temp = await getClima(coors.lat, coors.lng);
return `El clima en ${coors.direccion} es de ${temp} °C`;
} catch (error) {
return `No se pudo determinar el clima en '${direccion}'`;
}
}
getInfoClima(argv.direccion)
.then((respuesta) => {
console.log(respuesta);
})
.catch((error) => {
console.log(error);
})