Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

Commit

Permalink
⚡ Better filter for hardwareInspector data
Browse files Browse the repository at this point in the history
  • Loading branch information
GitSquared committed Mar 22, 2019
1 parent 99b70f4 commit 56d1b78
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/classes/hardwareInspector.class.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,19 @@ class HardwareInspector {
}
updateInfo() {
window.si.system().then(d => {
document.getElementById("mod_hardwareInspector_manufacturer").innerText = this._trimDataString(d.manufacturer);
document.getElementById("mod_hardwareInspector_model").innerText = this._trimDataString(d.model);
});
window.si.chassis().then(d => {
document.getElementById("mod_hardwareInspector_chassis").innerText = d.type;
window.si.chassis().then(e => {
document.getElementById("mod_hardwareInspector_manufacturer").innerText = this._trimDataString(d.manufacturer);
document.getElementById("mod_hardwareInspector_model").innerText = this._trimDataString(d.model, d.manufacturer, e.type);
document.getElementById("mod_hardwareInspector_chassis").innerText = e.type;
});
});
}
_trimDataString(str) {
return str.split(" ").slice(0, 2).join(" ");
_trimDataString(str, ...filters) {
return str.trim().split(" ").filter(word => {
if (typeof filters !== "object") return true;

return !filters.includes(word);
}).slice(0, 2).join(" ");
}
}

Expand Down

0 comments on commit 56d1b78

Please sign in to comment.