Final jsdoc comments

This commit is contained in:
rejas 2021-08-05 16:38:57 +02:00
parent f84f590f1d
commit 3a5052c871

View File

@ -102,7 +102,7 @@ WeatherProvider.register("smhi", {
* *
* @param {object} weatherData Weatherdata to convert * @param {object} weatherData Weatherdata to convert
* @param {object} coordinates Coordinates of the locations of the weather * @param {object} coordinates Coordinates of the locations of the weather
* @returns {WeatherObject} * @returns {WeatherObject} The converted weatherdata at the specified location
*/ */
convertWeatherDataToObject(weatherData, coordinates) { convertWeatherDataToObject(weatherData, coordinates) {
let currentWeather = new WeatherObject("metric", "metric", "metric"); //Weather data is only for Sweden and nobody in Sweden would use imperial let currentWeather = new WeatherObject("metric", "metric", "metric"); //Weather data is only for Sweden and nobody in Sweden would use imperial
@ -145,9 +145,9 @@ WeatherProvider.register("smhi", {
/** /**
* Takes all of the data points and converts it to one WeatherObject per day. * Takes all of the data points and converts it to one WeatherObject per day.
* *
* @param allWeatherData * @param {object[]} allWeatherData Array of weatherdata
* @param {object} coordinates * @param {object} coordinates Coordinates of the locations of the weather
* @returns {*[]} * @returns {WeatherObject[]} Array of weatherobjects
*/ */
convertWeatherDataGroupedByDay(allWeatherData, coordinates) { convertWeatherDataGroupedByDay(allWeatherData, coordinates) {
let currentWeather; let currentWeather;
@ -204,8 +204,8 @@ WeatherProvider.register("smhi", {
/** /**
* Checks if the weatherObject is at dayTime. * Checks if the weatherObject is at dayTime.
* *
* @param weatherObject * @param {WeatherObject} weatherObject The weatherObject to look at
* @returns {boolean} * @returns {boolean} true if it is at dayTime
*/ */
isDayTime(weatherObject) { isDayTime(weatherObject) {
return weatherObject.date.isBetween(weatherObject.sunrise, weatherObject.sunset, undefined, "[]"); return weatherObject.date.isBetween(weatherObject.sunrise, weatherObject.sunset, undefined, "[]");
@ -235,12 +235,11 @@ WeatherProvider.register("smhi", {
}, },
/** /**
* Helper method to fetch a property from the returned data set. * Helper method to get a property from the returned data set.
* The returned values is an array with always one value in it.
* *
* @param {object} weatherData Weatherdata to fetch from * @param {object} currentWeatherData Weatherdata to get from
* @param {string} name The name of the property * @param {string} name The name of the property
* @returns {unknown} * @returns {*} The value of the property in the weatherdata
*/ */
paramValue(currentWeatherData, name) { paramValue(currentWeatherData, name) {
return currentWeatherData.parameters.filter((p) => p.name === name).flatMap((p) => p.values)[0]; return currentWeatherData.parameters.filter((p) => p.name === name).flatMap((p) => p.values)[0];
@ -251,9 +250,9 @@ WeatherProvider.register("smhi", {
* Uses different icons depending if its daytime or nighttime. * Uses different icons depending if its daytime or nighttime.
* SHMI's description of what the numeric value means is the comment after the case. * SHMI's description of what the numeric value means is the comment after the case.
* *
* @param input * @param {number} input The smhi icon value
* @param isDayTime * @param {boolean} isDayTime True if the icon should be for daytime, false for nightime
* @returns {string|string} * @returns {string} The icon name for the MagicMirror
*/ */
convertWeatherType(input, isDayTime) { convertWeatherType(input, isDayTime) {
switch (input) { switch (input) {