feat: Projektgeruest und Spec-Grundlagen
This commit is contained in:
@@ -0,0 +1 @@
|
||||
document.querySelector('#app').textContent = 'RAM-Sortierhilfe';
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
// Reines Modul: kein window, kein document, kein localStorage.
|
||||
|
||||
/** Bekannte Werte. Der Erwartungsraum ist klein - das repariert OCR-Lesefehler. */
|
||||
export const KNOWN = {
|
||||
capacityGb: [4, 8, 16, 32, 64, 128, 256],
|
||||
speed: [
|
||||
'PC4-1600', 'PC4-1866', 'PC4-2133', 'PC4-2400',
|
||||
'PC4-2666', 'PC4-2933', 'PC4-3200',
|
||||
],
|
||||
formFactor: ['UDIMM', 'SODIMM', 'RDIMM', 'LRDIMM'],
|
||||
rank: ['1Rx8', '1Rx4', '2Rx8', '2Rx4', '4Rx4', '8Rx4', '2DRx4', '4DRx4', '2DRx8'],
|
||||
};
|
||||
|
||||
/** @returns {{capacityGb: null, formFactor: null, rank: null, speed: null, partNumber: null, dateCode: null}} */
|
||||
export function emptySpec() {
|
||||
return {
|
||||
capacityGb: null,
|
||||
formFactor: null,
|
||||
rank: null,
|
||||
speed: null,
|
||||
partNumber: null,
|
||||
dateCode: null,
|
||||
};
|
||||
}
|
||||
|
||||
/** Grossbuchstaben, ohne Rand-Leerzeichen, mit vereinheitlichten Bindestrichen. */
|
||||
export function normalizeToken(raw) {
|
||||
if (typeof raw !== 'string') return '';
|
||||
return raw
|
||||
.replace(/[‐-―−]/g, '-')
|
||||
.trim()
|
||||
.toUpperCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Merkmalskombination, die ueber die Stapelzugehoerigkeit entscheidet.
|
||||
* Der Datumscode gehoert bewusst nicht dazu.
|
||||
*/
|
||||
export function fingerprint(spec) {
|
||||
const parts = [
|
||||
spec.formFactor,
|
||||
spec.capacityGb,
|
||||
spec.rank,
|
||||
spec.speed,
|
||||
spec.partNumber,
|
||||
];
|
||||
return parts
|
||||
.map((value) => (value === null || value === undefined ? '?' : normalizeToken(String(value))))
|
||||
.join('|');
|
||||
}
|
||||
|
||||
/** Ohne Kapazitaet ist keine sinnvolle Zuordnung moeglich. */
|
||||
export function isUsable(spec) {
|
||||
return typeof spec.capacityGb === 'number' && Number.isFinite(spec.capacityGb);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
:root { color-scheme: dark; }
|
||||
body { margin: 0; font-family: system-ui, sans-serif; }
|
||||
Reference in New Issue
Block a user