Skip to content

Terremotos por consola con Nodejs#86

Open
codemcu wants to merge 1 commit intomasterfrom
dev-mau-node-earthquakes
Open

Terremotos por consola con Nodejs#86
codemcu wants to merge 1 commit intomasterfrom
dev-mau-node-earthquakes

Conversation

@codemcu
Copy link
Copy Markdown
Collaborator

@codemcu codemcu commented Mar 5, 2019

Terremotos por consola con Nodejs

@codemcu codemcu requested a review from UlisesGascon March 5, 2019 18:42
@UlisesGascon UlisesGascon mentioned this pull request May 31, 2019
46 tasks
Copy link
Copy Markdown
Contributor

@UlisesGascon UlisesGascon left a comment

Choose a reason for hiding this comment

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

Objetivo logrado, pero falta validar inputs y optimizar un poco las salidas por consola. 😉

@@ -0,0 +1,39 @@
const https = require('https');

const [,,grade, frecuency] = process.argv;
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.

Bueno... ,, no es un mal hack, pero según como sea el equipo ... igual alguien podría molestarse. Por lo general, la norma no escrita dice que la idea es saltar una única posición del array

const https = require('https');

const [,,grade, frecuency] = process.argv;

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.

⚠️ No validas que te hayan pasados parametros validos... grade podría ser cualquier cosa y generarte errores en la URL...

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.

Lo mismo se aplica para frecuency

console.log(new Date(parsed.metadata.generated).toLocaleString('es-ES'));
console.log('==============================');
parsed.features.forEach(feature => {
console.log(feature.properties.title);
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.

Sería más interesante montar un bloque de texto con toda la información y hacer console.log una vez por vuelta o al final del todo usando un map con un join

const text = parsed.features.map(lorem_ipsum).join(''); 
console.log(text)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants