systeminformation 6.0.0-beta.19 → 6.0.0-beta.20

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/dist/get.js CHANGED
@@ -103,7 +103,12 @@ const get = async (valueObject) => {
103
103
  const data = await Promise.all(keys.map((func) => {
104
104
  const value = valueObject[func];
105
105
  const params = value.substring(value.lastIndexOf('(') + 1, value.lastIndexOf(')'));
106
- return params ? lib[func](params) : lib[func]();
106
+ try {
107
+ return Promise.resolve(params ? lib[func](params) : lib[func]()).catch(() => null);
108
+ }
109
+ catch {
110
+ return Promise.resolve(null);
111
+ }
107
112
  }));
108
113
  const result = {};
109
114
  keys.forEach((key, i) => {
@@ -5,6 +5,7 @@ const common_1 = require("./common");
5
5
  const internet_1 = require("./common/internet");
6
6
  const inetPublicIp = async (timeout) => {
7
7
  await (0, common_1.nextTick)();
8
- return (0, internet_1.publicIp)(timeout);
8
+ const t = Number(timeout);
9
+ return (0, internet_1.publicIp)(Number.isFinite(t) && t > 0 ? t : undefined);
9
10
  };
10
11
  exports.inetPublicIp = inetPublicIp;
@@ -188,7 +188,7 @@ const matchesDrives = (fs, mount, drives) => {
188
188
  if (!drives.length) {
189
189
  return true;
190
190
  }
191
- return drives.some((drive) => fs.toLowerCase().indexOf(drive.toLowerCase()) >= 0 || mount.toLowerCase().indexOf(drive.toLowerCase()) >= 0);
191
+ return drives.some((drive) => typeof drive === 'string' && (fs.toLowerCase().indexOf(drive.toLowerCase()) >= 0 || mount.toLowerCase().indexOf(drive.toLowerCase()) >= 0));
192
192
  };
193
193
  const applyZfsUsage = async (data) => {
194
194
  if (!data.some((item) => item.type === 'zfs')) {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.networkInterfaces = void 0;
4
4
  const const_1 = require("./common/const");
5
5
  const networkInterfaces = async (defaultString = '', rescan = true) => {
6
- defaultString = '' + defaultString;
6
+ defaultString = typeof defaultString === 'string' ? defaultString : '';
7
7
  switch (true) {
8
8
  case const_1.LINUX || const_1.ANDROID:
9
9
  return (await import('./linux/network-interfaces.js')).networkInterfaces(defaultString, rescan);
package/dist/versions.js CHANGED
@@ -75,15 +75,14 @@ const versions = async (apps) => {
75
75
  };
76
76
  }
77
77
  if (!Array.isArray(apps)) {
78
- apps = apps.trim().toLowerCase().replace(/,+/g, '|').replace(/ /g, '|');
79
- apps = apps.split('|');
78
+ apps = typeof apps === 'string' ? apps.trim().toLowerCase().replace(/,+/g, '|').replace(/ /g, '|').split('|') : [];
80
79
  }
81
80
  const result = {
82
81
  versions: {},
83
82
  counter: 0
84
83
  };
85
84
  apps.forEach((el) => {
86
- if (el) {
85
+ if (el && typeof el === 'string') {
87
86
  for (const key in versionObject) {
88
87
  if (Object.keys(versionObject).includes(key)) {
89
88
  if (key.toLowerCase() === el.toLowerCase() && !Object.keys(result.versions).includes(key)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "6.0.0-beta.19",
3
+ "version": "6.0.0-beta.20",
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)",