| 4.17.2 |
2020-01-05 |
diff --git a/docs/index.html b/docs/index.html
index ece2dd4..7049e95 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -168,7 +168,7 @@
systeminformation
- Current Version: 4.17.2
+ Current Version: 4.17.3
diff --git a/lib/cpu.js b/lib/cpu.js
index 6a02400..b80d6e4 100644
--- a/lib/cpu.js
+++ b/lib/cpu.js
@@ -66,7 +66,6 @@ const AMDBaseFrequencies = {
'2373': '2.1',
'2374': '2.2',
'2376': '2.3',
- '2376': '2.3',
'2377': '2.3',
'2378': '2.4',
'2379': '2.4',
@@ -366,7 +365,7 @@ function cpuBrandManufacturer(res) {
function getAMDSpeed(brand) {
let result = '0.00';
for (let key in AMDBaseFrequencies) {
- if (AMDBaseFrequencies.hasOwnProperty(key)) {
+ if ({}.hasOwnProperty.call(AMDBaseFrequencies, key)) {
let parts = key.split('|');
let found = 0;
parts.forEach(item => {
@@ -695,7 +694,7 @@ function getCpuCurrentSpeedSync() {
if (cpus.length) {
for (let i in cpus) {
- if (cpus.hasOwnProperty(i)) {
+ if ({}.hasOwnProperty.call(cpus, i)) {
avgFreq = avgFreq + cpus[i].speed;
if (cpus[i].speed > maxFreq) maxFreq = cpus[i].speed;
if (cpus[i].speed < minFreq) minFreq = cpus[i].speed;
diff --git a/lib/docker.js b/lib/docker.js
index fa86bbe..1eef265 100644
--- a/lib/docker.js
+++ b/lib/docker.js
@@ -126,7 +126,7 @@ function dockerContainers(all, callback) {
if (docker_containers && Object.prototype.toString.call(docker_containers) === '[object Array]' && docker_containers.length > 0) {
// GC in _docker_container_stats
for (let key in _docker_container_stats) {
- if (_docker_container_stats.hasOwnProperty(key)) {
+ if ({}.hasOwnProperty.call(_docker_container_stats, key)) {
if (!inContainers(docker_containers, key)) delete _docker_container_stats[key];
}
}
@@ -166,7 +166,7 @@ function dockerContainers(all, callback) {
} catch (err) {
// GC in _docker_container_stats
for (let key in _docker_container_stats) {
- if (_docker_container_stats.hasOwnProperty(key)) {
+ if ({}.hasOwnProperty.call(_docker_container_stats, key)) {
if (!inContainers(docker_containers, key)) delete _docker_container_stats[key];
}
}
@@ -273,7 +273,7 @@ function docker_calcNetworkIO(networks) {
let tx;
for (let key in networks) {
// skip loop if the property is from prototype
- if (!networks.hasOwnProperty(key)) continue;
+ if (!{}.hasOwnProperty.call(networks, key)) continue;
/**
* @namespace
diff --git a/lib/filesystem.js b/lib/filesystem.js
index 18b699f..565dcb9 100644
--- a/lib/filesystem.js
+++ b/lib/filesystem.js
@@ -744,7 +744,7 @@ function diskLayout(callback) {
let devices = [];
try {
const outJSON = JSON.parse(out);
- if (outJSON && outJSON.hasOwnProperty('blockdevices')) {
+ if (outJSON && {}.hasOwnProperty.call(outJSON, 'blockdevices')) {
devices = outJSON.blockdevices.filter(item => { return item.group === 'disk' && item.size > 0 && item.model !== null; });
}
} catch (e) {
diff --git a/lib/graphics.js b/lib/graphics.js
index ccc2970..985af2d 100644
--- a/lib/graphics.js
+++ b/lib/graphics.js
@@ -648,7 +648,7 @@ function graphics(callback) {
function parseLinesWindowsControllers(sections) {
let controllers = [];
for (let i in sections) {
- if (sections.hasOwnProperty(i)) {
+ if ({}.hasOwnProperty.call(sections, i)) {
if (sections[i].trim() !== '') {
let lines = sections[i].trim().split('\r\n');
diff --git a/lib/index.js b/lib/index.js
index 07e62a0..fdb9ab2 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -296,7 +296,7 @@ function getAllData(srv, iface, callback) {
data = res;
getDynamicData(srv, iface).then(res => {
for (let key in res) {
- if (res.hasOwnProperty(key)) {
+ if ({}.hasOwnProperty.call(res, key)) {
data[key] = res[key];
}
}
diff --git a/lib/memory.js b/lib/memory.js
index 8a6bcdd..e4d1f7a 100644
--- a/lib/memory.js
+++ b/lib/memory.js
@@ -263,7 +263,7 @@ exports.mem = mem;
function memLayout(callback) {
function getManufacturer(manId) {
- if (OSX_RAM_manufacturers.hasOwnProperty(manId)) {
+ if ({}.hasOwnProperty.call(OSX_RAM_manufacturers, manId)) {
return (OSX_RAM_manufacturers[manId]);
}
return manId;
diff --git a/lib/network.js b/lib/network.js
index a697e4b..5bf73e9 100644
--- a/lib/network.js
+++ b/lib/network.js
@@ -46,7 +46,7 @@ function getDefaultNetworkInterface() {
// fallback - "first" external interface (sorted by scopeid)
for (let dev in ifaces) {
- if (ifaces.hasOwnProperty(dev)) {
+ if ({}.hasOwnProperty.call(ifaces, dev)) {
ifaces[dev].forEach(function (details) {
if (details && details.internal === false) {
ifacenameFirst = ifacenameFirst || dev; // fallback if no scopeid
@@ -77,7 +77,7 @@ function getDefaultNetworkInterface() {
});
if (defaultIp) {
for (let dev in ifaces) {
- if (ifaces.hasOwnProperty(dev)) {
+ if ({}.hasOwnProperty.call(ifaces, dev)) {
ifaces[dev].forEach(function (details) {
if (details && details.address && details.address === defaultIp) {
ifacename = dev;
@@ -186,7 +186,7 @@ exports.networkInterfaceDefault = networkInterfaceDefault;
function parseLinesWindowsNics(sections, nconfigsections) {
let nics = [];
for (let i in sections) {
- if (sections.hasOwnProperty(i)) {
+ if ({}.hasOwnProperty.call(sections, i)) {
if (sections[i].trim() !== '') {
@@ -244,19 +244,19 @@ function getWindowsDNSsuffixes() {
const longPrimaryDNS = element.split('\r\n').filter((element) => {
return element.toUpperCase().includes('DNS');
});
- const primaryDNS = longPrimaryDNS[0].substring(longPrimaryDNS[0].lastIndexOf(":") + 1);
+ const primaryDNS = longPrimaryDNS[0].substring(longPrimaryDNS[0].lastIndexOf(':') + 1);
dnsSuffixes.primaryDNS = primaryDNS.trim();
if (!dnsSuffixes.primaryDNS) dnsSuffixes.primaryDNS = 'Not defined';
}
if (index > 1) {
if (index % 2 == 0) {
- const name = element.substring(element.lastIndexOf(" ") + 1).replace(':', '');
+ const name = element.substring(element.lastIndexOf(' ') + 1).replace(':', '');
iface.name = name;
} else {
const connectionSpecificDNS = element.split('\r\n').filter((element) => {
- return element.toUpperCase().includes('DNS')
+ return element.toUpperCase().includes('DNS');
});
- const dnsSuffix = connectionSpecificDNS[0].substring(connectionSpecificDNS[0].lastIndexOf(":") + 1);
+ const dnsSuffix = connectionSpecificDNS[0].substring(connectionSpecificDNS[0].lastIndexOf(':') + 1);
iface.dnsSuffix = dnsSuffix.trim();
dnsSuffixes.ifaces.push(iface);
iface = {};
@@ -273,7 +273,6 @@ function getWindowsDNSsuffixes() {
ifaces: [],
};
}
-
}
function getWindowsIfaceDNSsuffix(ifaces, ifacename) {
@@ -325,8 +324,8 @@ function getWindowsIEEE8021x(connectionType, iface, ifaces) {
};
if (ifaces === 'Disabled') {
- i8021x.state = "Disabled";
- i8021x.protocol = "Not defined";
+ i8021x.state = 'Disabled';
+ i8021x.protocol = 'Not defined';
return i8021x;
}
@@ -342,14 +341,14 @@ function getWindowsIEEE8021x(connectionType, iface, ifaces) {
});
if (state8021x.includes('Disabled')) {
- i8021x.state = "Disabled";
- i8021x.protocol = "Not defined";
+ i8021x.state = 'Disabled';
+ i8021x.protocol = 'Not defined';
} else if (state8021x.includes('Enabled')) {
const protocol8021x = arrayIface8021xInfo.find((element) => {
return element.includes('EAP');
});
i8021x.protocol = protocol8021x.split(':').pop();
- i8021x.state = "Enabled";
+ i8021x.state = 'Enabled';
}
} catch (error) {
// console.log('Error getting wired information:', error);
@@ -376,8 +375,8 @@ function getWindowsIEEE8021x(connectionType, iface, ifaces) {
} catch (error) {
// console.log('Error getting wireless information:', error);
if (error.status === 1 && error.stdout.includes('AutoConfig')) {
- i8021x.state = "Disabled";
- i8021x.protocol = "Not defined";
+ i8021x.state = 'Disabled';
+ i8021x.protocol = 'Not defined';
}
return i8021x;
}
@@ -472,14 +471,13 @@ function getDarwinNics() {
}
}
-
function getLinuxIfaceConnectionName(interfaceName) {
const cmd = `nmcli device status 2>/dev/null | grep ${interfaceName}`;
try {
const result = execSync(cmd).toString();
const resultFormat = result.replace(/\s+/g, ' ').trim();
- const connectionNameLines = resultFormat.split(" ").slice(3);
+ const connectionNameLines = resultFormat.split(' ').slice(3);
const connectionName = connectionNameLines.join(' ');
return connectionName != '--' ? connectionName : '';
} catch (e) {
@@ -492,18 +490,18 @@ function getLinuxIfaceDHCPstatus(connectionName) {
if (connectionName) {
const cmd = `nmcli connection show "${connectionName}" 2>/dev/null \| grep ipv4.method;`;
try {
- const result = execSync(cmd).toString();
- const resultFormat = result.replace(/\s+/g, ' ').trim();
+ const lines = execSync(cmd).toString();
+ const resultFormat = lines.replace(/\s+/g, ' ').trim();
- let dhcStatus = resultFormat.split(" ").slice(1).toString();
+ let dhcStatus = resultFormat.split(' ').slice(1).toString();
switch (dhcStatus) {
- case 'auto':
- result = true;
- break;
+ case 'auto':
+ result = true;
+ break;
- default:
- result = false;
- break;
+ default:
+ result = false;
+ break;
}
return result;
} catch (e) {
@@ -520,7 +518,7 @@ function getLinuxIfaceDNSsuffix(connectionName) {
try {
const result = execSync(cmd).toString();
const resultFormat = result.replace(/\s+/g, ' ').trim();
- const dnsSuffix = resultFormat.split(" ").slice(1).toString();
+ const dnsSuffix = resultFormat.split(' ').slice(1).toString();
return dnsSuffix == '--' ? 'Not defined' : dnsSuffix;
} catch (e) {
return 'Unknown';
@@ -536,7 +534,7 @@ function getLinuxIfaceIEEE8021xAuth(connectionName) {
try {
const result = execSync(cmd).toString();
const resultFormat = result.replace(/\s+/g, ' ').trim();
- const authenticationProtocol = resultFormat.split(" ").slice(1).toString();
+ const authenticationProtocol = resultFormat.split(' ').slice(1).toString();
return authenticationProtocol == '--' ? '' : authenticationProtocol;
@@ -640,7 +638,7 @@ function networkInterfaces(callback) {
let ieee8021xState = '';
let type = '';
- if (ifaces.hasOwnProperty(dev)) {
+ if ({}.hasOwnProperty.call(ifaces, dev)) {
let ifaceName = dev;
ifaces[dev].forEach(function (details) {
if (details.family === 'IPv4') {
@@ -869,9 +867,8 @@ function networkStatsSingle(iface) {
function parseLinesWindowsPerfData(sections) {
let perfData = [];
for (let i in sections) {
- if (sections.hasOwnProperty(i)) {
+ if ({}.hasOwnProperty.call(sections, i)) {
if (sections[i].trim() !== '') {
-
let lines = sections[i].trim().split('\r\n');
perfData.push({
name: util.getValue(lines, 'Name', '=').replace(/[()\[\] ]+/g, '').toLowerCase(),
diff --git a/lib/util.js b/lib/util.js
index 46f691b..131914e 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -65,7 +65,7 @@ function unique(obj) {
str += JSON.stringify(keys[j]);
str += JSON.stringify(obj[i][keys[j]]);
}
- if (!stringify.hasOwnProperty(str)) {
+ if (!{}.hasOwnProperty.call(stringify, str)) {
uniques.push(obj[i]);
stringify[str] = true;
}
diff --git a/lib/wifi.js b/lib/wifi.js
index bbb57ae..9253038 100644
--- a/lib/wifi.js
+++ b/lib/wifi.js
@@ -108,7 +108,7 @@ function wifiFrequencyFromChannel(channel) {
192: 4960,
196: 4980
};
- return frequencies.hasOwnProperty(channel) ? frequencies[channel] : -1;
+ return {}.hasOwnProperty.call(frequencies, channel) ? frequencies[channel] : -1;
}
function wifiNetworks(callback) {