MCPcopy Create free account
hub / github.com/BrasilAPI/BrasilAPI / getCurrentCapitalWeatherData

Function getCurrentCapitalWeatherData

services/cptec/weather.js:64–79  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

62 * @returns {Array}
63 */
64export const getCurrentCapitalWeatherData = async () => {
65 const currentData = await axios.get(
66 `${CPTEC_URL}/capitais/condicoesAtuais.xml`,
67 {
68 responseType: 'application/xml',
69 responseEncoding: 'utf-8',
70 }
71 );
72
73 const parsed = parser.parse(currentData.data);
74
75 if (parsed.capitais.metar) {
76 return parsed.capitais.metar.map(formatMetar);
77 }
78 return [];
79};
80
81/**
82 * Get current weather data for a Brazilian Airport by ICAO code

Callers 1

getCapitalWeatherFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected