es2020 or smth

This commit is contained in:
Flummi 2024-01-20 04:55:08 +01:00
parent de0ae352cb
commit bd243ec115
Signed by: Flummi
GPG Key ID: AA2AEF822A6F4817

View File

@ -3,23 +3,17 @@ const colors = [
'#718d00', '#6fa100', '#5c8000', '#498000', '#080'
];
function batteryColor(batteryPercent) {
return colors[({
const batteryColor = batteryPercent => colors[({
"-2": 9,
"-1": 0
})[batteryPercent] ?? ~~(batteryPercent / 10 + 0.5) - 1];
}
})[batteryPercent] ?? ~~(batteryPercent / 10 + 0.5) - 1];
function batteryLevel(batteryPercent) {
return ({
const batteryLevel = batteryPercent => ({
"-2": "not connected",
"-1": "charging"
})[batteryPercent] ?? batteryPercent + "%";
}
})[batteryPercent] ?? batteryPercent + "%";
function batteryIcon(batteryPercent) {
return ({
const batteryIcon = batteryPercent => ({
"-2": "action-unavailable",
"-1": "battery-ac-adapter"
})[batteryPercent] ?? "audio-headphones-symbolic";
}
})[batteryPercent] ?? "audio-headphones-symbolic";