systeminformation 5.28.5 → 5.28.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cli.js CHANGED
@@ -23,19 +23,31 @@ function capFirst(string) {
23
23
  return string[0].toUpperCase() + string.slice(1);
24
24
  }
25
25
 
26
+ function getValue(value) {
27
+ if (value === null || value === undefined) {
28
+ return '';
29
+ }
30
+ if (typeof value === 'object') {
31
+ return JSON.stringify(value);
32
+ }
33
+ return value.toString();
34
+ }
35
+
26
36
  function printLines(obj) {
27
37
  for (const property in obj) {
28
- console.log(capFirst(property) + ' '.substring(0, 17 - property.length) + ': ' + (obj[property] || ''));
38
+ console.log(`${capFirst(property) + ' '.substring(0, 17 - property.length)}: ${getValue(obj[property])}`);
29
39
  }
30
40
  console.log();
31
41
  }
32
42
 
33
43
  function info() {
34
44
  console.log('┌─────────────────────────────────────────────────────────────────────────────────────────┐');
35
- console.log('│ SYSTEMINFORMATION '.substring(0, 80 - lib_version.length) + 'Version: ' + lib_version + ' │');
45
+ console.log(
46
+ `${'│ SYSTEMINFORMATION '.substring(0, 80 - lib_version.length)}Version: ${lib_version} │`
47
+ );
36
48
  console.log('└─────────────────────────────────────────────────────────────────────────────────────────┘');
37
49
 
38
- si.osInfo().then(res => {
50
+ si.osInfo().then((res) => {
39
51
  console.log();
40
52
  console.log('Operating System:');
41
53
  console.log('──────────────────────────────────────────────────────────────────────────────────────────');
@@ -45,7 +57,7 @@ function info() {
45
57
  delete res.fqdn;
46
58
  delete res.uefi;
47
59
  printLines(res);
48
- si.system().then(res => {
60
+ si.system().then((res) => {
49
61
  console.log('System:');
50
62
  console.log('──────────────────────────────────────────────────────────────────────────────────────────');
51
63
  delete res.serial;
@@ -53,7 +65,7 @@ function info() {
53
65
  delete res.sku;
54
66
  delete res.uuid;
55
67
  printLines(res);
56
- si.cpu().then(res => {
68
+ si.cpu().then((res) => {
57
69
  console.log('CPU:');
58
70
  console.log('──────────────────────────────────────────────────────────────────────────────────────────');
59
71
  delete res.cache;
@@ -74,18 +86,15 @@ function info() {
74
86
  // ----------------------------------------------------------------------------------
75
87
  // Main
76
88
  // ----------------------------------------------------------------------------------
77
- (function () {
89
+ (() => {
78
90
  const args = process.argv.slice(2);
79
91
 
80
92
  if (args[0] === 'info') {
81
93
  info();
82
94
  } else {
83
- si.getStaticData().then(
84
- ((data) => {
85
- data.time = si.time();
86
- console.log(JSON.stringify(data, null, 2));
87
- }
88
- ));
95
+ si.getStaticData().then((data) => {
96
+ data.time = si.time();
97
+ console.log(JSON.stringify(data, null, 2));
98
+ });
89
99
  }
90
-
91
100
  })();
package/lib/network.js CHANGED
@@ -997,9 +997,9 @@ function networkInterfaces(callback, rescan, defaultString) {
997
997
  mtu = parseInt(util.getValue(lines, 'mtu'), 10);
998
998
  let myspeed = parseInt(util.getValue(lines, 'speed'), 10);
999
999
  speed = isNaN(myspeed) ? null : myspeed;
1000
- let wirelessspeed = util.getValue(lines, 'wirelessspeed').split('tx bitrate: ');
1001
- if (speed === null && wirelessspeed.length === 2) {
1002
- myspeed = parseFloat(wirelessspeed[1]);
1000
+ const wirelessspeed = util.getValue(lines, 'tx bitrate');
1001
+ if (speed === null && wirelessspeed) {
1002
+ myspeed = parseFloat(wirelessspeed);
1003
1003
  speed = isNaN(myspeed) ? null : myspeed;
1004
1004
  }
1005
1005
  carrierChanges = parseInt(util.getValue(lines, 'carrier_changes'), 10);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.28.5",
3
+ "version": "5.28.7",
4
4
  "description": "Advanced, lightweight system and OS information library",
5
5
  "license": "MIT",
6
6
  "author": "Sebastian Hildebrandt <hildebrandt@plus-innovations.com> (https://plus-innovations.com)",