another optimization battery().ischarging for macOS

This commit is contained in:
Sebastian Hildebrandt 2018-04-05 23:16:38 +02:00
parent 6d30c351fc
commit c912bdc6fe
2 changed files with 2 additions and 1 deletions

View File

@ -100,6 +100,7 @@ Other changes
| Version | Date | Comment |
| -------------- | -------------- | -------- |
| 3.37.12 | 2018-04-05 | another optimization `battery().ischarging` for macOS |
| 3.37.11 | 2018-04-05 | another optimization `battery().ischarging` for macOS |
| 3.37.10 | 2018-04-05 | `battery().ischarging` optimized for macOS |
| 3.37.9 | 2018-04-03 | optimized `processes()`, bugfix `networkInterfaceDefault()` |

View File

@ -117,7 +117,7 @@ module.exports = function (callback) {
}
}
if (parts && parts[1]) {
result.ischarging = parts[1].trim() !== 'charged';
result.ischarging = !(parts[1].trim() === 'charged' || parts[1].trim() === 'discharging');
} else {
result.ischarging = util.getValue(lines, 'ischarging', '=').toLowerCase() === 'yes';
}