Merge pull request #110 from jorgegonzalez/master
Fix typo that caused ischarging to be inaccurate
This commit is contained in:
commit
9674479c32
@ -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) {
|
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');
|
let lines = stdout.toString().replace(/ +/g, '').replace(/"+/g, '').replace(/-/g, '').split('\n');
|
||||||
result.cyclecount = parseInt('0' + util.getValue(lines,'cyclecount', '='), 10);
|
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.maxcapacity = parseInt('0' + util.getValue(lines,'maxcapacity', '='), 10);
|
||||||
result.currentcapacity = parseInt('0' + util.getValue(lines,'currentcapacity', '='), 10);
|
result.currentcapacity = parseInt('0' + util.getValue(lines,'currentcapacity', '='), 10);
|
||||||
let percent = -1;
|
let percent = -1;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user