Skip to content

Instantly share code, notes, and snippets.

@craiglonsdale
Created January 19, 2016 08:04
Show Gist options
  • Save craiglonsdale/6db57622b0d5e7b8687f to your computer and use it in GitHub Desktop.
Save craiglonsdale/6db57622b0d5e7b8687f to your computer and use it in GitHub Desktop.
/**
* Returns a string which represents the current temperature
* @return {String} Text ready for the katification matrix
*/
getTemperatureText(temperature) {
const keyText = findLastKey(weatherConfig.temperature, (keyTemperature) => {
let normalizedTemp = Math.max(weatherConfig.temperatureMin, temperature);
normalizedTemp = Math.min(weatherConfig.temperatureMax, normalizedTemp);
return normalizedTemp >= keyTemperature;
});
return Array.isArray(keyText) ? keyText[keyText.length - 1] : keyText;
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment