From 133b557eb6199ec3fc17e41c11a19952ad74c8ac Mon Sep 17 00:00:00 2001 From: Sebastian Hildebrandt Date: Thu, 2 Jan 2025 15:42:16 +0100 Subject: [PATCH] cpu() clean brand string --- README.md | 2 +- lib/cpu.js | 1 + lib/util.js | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0587246..e517669 100644 --- a/README.md +++ b/README.md @@ -1186,7 +1186,7 @@ All other trademarks are the property of their respective owners. [daviddm-url]: https://david-dm.org/sebhildebrandt/systeminformation [issues-img]: https://img.shields.io/github/issues/sebhildebrandt/systeminformation.svg?style=flat-square [issues-url]: https://github.com/sebhildebrandt/systeminformation/issues -[closed-issues-img]: https://img.shields.io/github/issues-closed-raw/sebhildebrandt/systeminformation.svg?style=flat-square&color=brightgreen +[closed-issues-img]: https://img.shields.io/github/issues-search?query=repo%3Asebhildebrandt/systeminformation+is%3Aclosed&style=flat-square&color=brightgreen&label=Issues+closed [closed-issues-url]: https://github.com/sebhildebrandt/systeminformation/issues?q=is%3Aissue+is%3Aclosed [new-issue]: https://github.com/sebhildebrandt/systeminformation/issues/new/choose [mmon-npm-url]: https://npmjs.org/package/mmon diff --git a/lib/cpu.js b/lib/cpu.js index dfe2c7b..8ce0ab9 100644 --- a/lib/cpu.js +++ b/lib/cpu.js @@ -737,6 +737,7 @@ function getCpu() { } modelline = util.getValue(lines, 'model name') || modelline; modelline = util.getValue(lines, 'bios model name') || modelline; + modelline = util.cleanString(modelline); const modellineParts = modelline.split('@'); result.brand = modellineParts[0].trim(); result.speed = modellineParts[1] ? parseFloat(modellineParts[1].trim()) : 0; diff --git a/lib/util.js b/lib/util.js index 09c60e5..dbbe09e 100644 --- a/lib/util.js +++ b/lib/util.js @@ -2535,6 +2535,9 @@ function checkWebsite(url, timeout = 5000) { }); }; +function cleanString(str) { + return str.replace(/To Be Filled By O.E.M./g, ''); +} function noop() { } exports.toInt = toInt; @@ -2591,3 +2594,4 @@ exports.getFilesInPath = getFilesInPath; exports.semverCompare = semverCompare; exports.getAppleModel = getAppleModel; exports.checkWebsite = checkWebsite; +exports.cleanString = cleanString;