A javascript function that looks to the weather to decide what you should wear when going outside.
The project is API-agnostic and should be used on top of a weather api. For testing, I've decided to use darksky api.
yarn install clothes-by-weather
const cbw = require('../src/clothes-by-weather') // Module.exports
import cbw from 'clothes-by-weather' // Import/Export/es6 modules
const output = cbw({
temperature: 10, // 10 deg celsius
pop: 0.70, // 70% chance of precipitation
description: 'cloudy', // Description from the weather API
windGust: 5, // 5 meter per second
})
/* output = {
upperbody: [ 'warm jacket', 'sweater' ],
lowerbody: 'pants',
shoes: 'boots',
misc: [ 'umbrella' ]
}
*/
Feel free to contribute. Take a look under the issues. Perhaps you can adjust the parameters for which clothes to pick for what occasion?
MIT.
Using github actions to lint and test
The function expects a few inputs to function properly
A string, a summary of the day. Like Possible light rain
.
The temperature, in celsuis
The wind gust, in m/s
Percentage of precipitation(chance/risk of raining)
An object of strings.
{
"upperbody": ["windbreaker|rain jacket|jacker warm jacket|coat|sweater|shirt"],
"misc": ["umbrella|gloves|hat|warm socks|sunglasses"],
"lowerbody": "pants|shorts",
"shoes": "boots|rain boots|sneakers"
}
Spawned by this reddit thread.