Created
January 19, 2016 08:04
-
-
Save craiglonsdale/6db57622b0d5e7b8687f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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