openweather-api-node
Version:
Simple package that makes it easy to work with OpenWeather API
17 lines (16 loc) • 526 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const names = ["", "Good", "Fair", "Moderate", "Poor", "Very Poor"];
function singleParser(data) {
const element = data.list[0];
return {
lat: data.coord.lat,
lon: data.coord.lon,
dt: new Date(element.dt * 1000),
dtRaw: element.dt,
aqi: element.main.aqi,
aqiName: names[element.main.aqi],
components: { ...element.components },
};
}
exports.default = singleParser;
;