Initial
This commit is contained in:
1 parent
94f4d8959d
commit
402bf6782a
25 files changed
+1323
-103
No files matched your search
@@ -0,0 +1,16 @@
|
||||
export const OS_FAMILIES = ['windows', 'linux', 'other'];
|
||||
|
||||
export function normalizeOsFamily(value, fallback = 'other') {
|
||||
const text = String(value || '').trim().toLowerCase();
|
||||
if (!text) return fallback;
|
||||
if (['win', 'windows', 'windows server', 'microsoft windows'].includes(text) || text.includes('windows')) return 'windows';
|
||||
if (['linux', 'unix'].includes(text) || /ubuntu|debian|rhel|red hat|centos|fedora|suse|oracle linux|rocky|alma|amazon linux|arch|kali/.test(text)) return 'linux';
|
||||
return 'other';
|
||||
}
|
||||
|
||||
export function osFamilyLabel(value) {
|
||||
const normalized = normalizeOsFamily(value);
|
||||
if (normalized === 'windows') return 'Windows';
|
||||
if (normalized === 'linux') return 'Linux';
|
||||
return 'Other';
|
||||
}
|
||||
Reference in new issue
Block a user