From 306be41a012b89bfcaffaf93100dbfda2f983e3c Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Thu, 5 Apr 2018 22:46:53 +0200 Subject: [PATCH] another optimization battery().ischarging for macOS --- CHANGELOG.md | 1 + lib/battery.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3cd23fe..98413b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -100,6 +100,7 @@ Other changes | Version | Date | Comment | | -------------- | -------------- | -------- | +| 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()` | | 3.37.8 | 2018-03-25 | optimized `networkDefaultInterface()` detection, fixed network `operstate` MacOS | diff --git a/lib/battery.js b/lib/battery.js index 5566033..c39f7f2 100644 --- a/lib/battery.js +++ b/lib/battery.js @@ -117,7 +117,7 @@ module.exports = function (callback) { } } if (parts && parts[1]) { - result.ischarging = parts[1].trim() !== 'discharging'; + result.ischarging = parts[1].trim() !== 'charged'; } else { result.ischarging = util.getValue(lines, 'ischarging', '=').toLowerCase() === 'yes'; }