Fix typo that caused ischarging to be innaccurate

This commit is contained in:
Jorge Gonzalez 2018-02-13 11:23:40 -05:00 committed by GitHub
parent 7f830ec338
commit 3a1251976e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -100,7 +100,7 @@ module.exports = function (callback) {
exec('ioreg -n AppleSmartBattery -r | egrep "CycleCount|IsCharging|MaxCapacity|CurrentCapacity";pmset -g batt | grep %', function (error, stdout) {
let lines = stdout.toString().replace(/ +/g, '').replace(/"+/g, '').replace(/-/g, '').split('\n');
result.cyclecount = parseInt('0' + util.getValue(lines,'cyclecount', '='), 10);
result.ischarging = util.getValue(lines,'ischarging', '=').toLowerCase === 'yes';
result.ischarging = util.getValue(lines,'ischarging', '=').toLowerCase() === 'yes';
result.maxcapacity = parseInt('0' + util.getValue(lines,'maxcapacity', '='), 10);
result.currentcapacity = parseInt('0' + util.getValue(lines,'currentcapacity', '='), 10);
let percent = -1;