systeminformation 5.21.4 → 5.21.6

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.
Files changed (3) hide show
  1. package/README.md +2 -2
  2. package/lib/system.js +25 -19
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -29,11 +29,11 @@
29
29
  [![MIT license][license-img]][license-url]
30
30
 
31
31
  ## The Systeminformation Project
32
- This is amazing. Started as a small project just for myself, it now has > 15,000 lines of code, > 600 versions published, up to 6 mio downloads per month, > 150 mio downloads overall. #1 NPM ranking for backend packages. Thank you to all who contributed to this project!
32
+ This is amazing. Started as a small project just for myself, it now has > 15,000 lines of code, > 600 versions published, up to 8 mio downloads per month, > 200 mio downloads overall. #1 NPM ranking for backend packages. Thank you to all who contributed to this project!
33
33
 
34
34
  ## Please support this project ... ☕️
35
35
 
36
- Over the past few years I spent **over 2.000 hours** working on this project and invested in hardware to be able to test on different platforms. Currently I am working very hard on the next **new version 6.0** completely rewritten in TypeScript and with a lot of new features. Any support is highly appreciated - [Buy me a coffee](https://www.buymeacoffee.com/systeminfo).
36
+ Over the past few years I spent **more than 2.000 hours** working on this project and invested in hardware to be able to test on different platforms. Currently I am working very hard on the next **new version 6.0** completely rewritten in TypeScript and with a lot of new features. Any support is highly appreciated - [Buy me a coffee](https://www.buymeacoffee.com/systeminfo).
37
37
 
38
38
  **Your contribution** make it possible for me to keep working on this project, add new features and support more platforms. Thank you in advance!
39
39
 
package/lib/system.js CHANGED
@@ -317,6 +317,13 @@ function system(callback) {
317
317
 
318
318
  exports.system = system;
319
319
 
320
+ function cleanDefaults(s) {
321
+ const cmpStr = s.toLowerCase();
322
+ if (cmpStr.indexOf('o.e.m.') === -1 && cmpStr.indexOf('default string') === -1 && cmpStr !== 'default') {
323
+ return s || '';
324
+ }
325
+ return '';
326
+ }
320
327
  function bios(callback) {
321
328
 
322
329
  return new Promise((resolve) => {
@@ -418,7 +425,7 @@ function bios(callback) {
418
425
  }
419
426
  result.releaseDate = util.getValue(lines, 'releasedate', ':');
420
427
  result.revision = util.getValue(lines, 'buildnumber', ':');
421
- result.serial = util.getValue(lines, 'serialnumber', ':');
428
+ result.serial = cleanDefaults(util.getValue(lines, 'serialnumber', ':'));
422
429
  }
423
430
 
424
431
  if (callback) { callback(result); }
@@ -562,16 +569,16 @@ function baseboard(callback) {
562
569
  ).then((data) => {
563
570
  let lines = data.results[0] ? data.results[0].toString().split('\r\n') : [''];
564
571
 
565
- result.manufacturer = util.getValue(lines, 'manufacturer', ':');
566
- result.model = util.getValue(lines, 'model', ':');
572
+ result.manufacturer = cleanDefaults(util.getValue(lines, 'manufacturer', ':'));
573
+ result.model = cleanDefaults(util.getValue(lines, 'model', ':'));
567
574
  if (!result.model) {
568
- result.model = util.getValue(lines, 'product', ':');
575
+ result.model = cleanDefaults(util.getValue(lines, 'product', ':'));
569
576
  }
570
- result.version = util.getValue(lines, 'version', ':');
571
- result.serial = util.getValue(lines, 'serialnumber', ':');
572
- result.assetTag = util.getValue(lines, 'partnumber', ':');
577
+ result.version = cleanDefaults(util.getValue(lines, 'version', ':'));
578
+ result.serial = cleanDefaults(util.getValue(lines, 'serialnumber', ':'));
579
+ result.assetTag = cleanDefaults(util.getValue(lines, 'partnumber', ':'));
573
580
  if (!result.assetTag) {
574
- result.assetTag = util.getValue(lines, 'sku', ':');
581
+ result.assetTag = cleanDefaults(util.getValue(lines, 'sku', ':'));
575
582
  }
576
583
 
577
584
  // memphysical
@@ -688,22 +695,21 @@ function chassis(callback) {
688
695
  }
689
696
  if (_windows) {
690
697
  try {
691
- util.powerShell('Get-CimInstance Win32_SystemEnclosure | select Model,Manufacturer,ChassisTypes,Version,SerialNumber,PartNumber,SKU | fl').then((stdout, error) => {
698
+ util.powerShell('Get-CimInstance Win32_SystemEnclosure | select Model,Manufacturer,ChassisTypes,Version,SerialNumber,PartNumber,SKU,SMBIOSAssetTag | fl').then((stdout, error) => {
692
699
  if (!error) {
693
700
  let lines = stdout.toString().split('\r\n');
694
701
 
695
- result.manufacturer = util.getValue(lines, 'manufacturer', ':');
696
- result.model = util.getValue(lines, 'model', ':');
702
+ result.manufacturer = cleanDefaults(util.getValue(lines, 'manufacturer', ':'));
703
+ result.model = cleanDefaults(util.getValue(lines, 'model', ':'));
697
704
  const ctype = parseInt(util.getValue(lines, 'ChassisTypes', ':').replace(/\D/g, ''));
698
705
  result.type = (ctype && !isNaN(ctype) && ctype < chassisTypes.length) ? chassisTypes[ctype - 1] : '';
699
- result.version = util.getValue(lines, 'version', ':');
700
- result.serial = util.getValue(lines, 'serialnumber', ':');
701
- result.assetTag = util.getValue(lines, 'partnumber', ':');
702
- result.sku = util.getValue(lines, 'sku', ':');
703
- if (result.manufacturer.toLowerCase().indexOf('o.e.m.') !== -1) { result.manufacturer = '-'; }
704
- if (result.version.toLowerCase().indexOf('o.e.m.') !== -1) { result.version = '-'; }
705
- if (result.serial.toLowerCase().indexOf('o.e.m.') !== -1) { result.serial = '-'; }
706
- if (result.assetTag.toLowerCase().indexOf('o.e.m.') !== -1) { result.assetTag = '-'; }
706
+ result.version = cleanDefaults(util.getValue(lines, 'version', ':'));
707
+ result.serial = cleanDefaults(util.getValue(lines, 'serialnumber', ':'));
708
+ result.assetTag = cleanDefaults(util.getValue(lines, 'partnumber', ':'));
709
+ if (!result.assetTag) {
710
+ result.assetTag = cleanDefaults(util.getValue(lines, 'SMBIOSAssetTag', ':'));
711
+ }
712
+ result.sku = cleanDefaults(util.getValue(lines, 'sku', ':'));
707
713
  }
708
714
 
709
715
  if (callback) { callback(result); }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "systeminformation",
3
- "version": "5.21.4",
3
+ "version": "5.21.6",
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)",