INNER CODE UNIT · JavaScript
normalizeDeviceId
bostrot/wsl2-distro-manager · n8n/licensing/seat_check.js:55
function normalizeDeviceId(value) {
if (typeof value !== 'string') return null;
const id = value.trim();
if (!id || id.length > 64 || !/^[A-Za-z0-9._:-]+$/.test(id)) return null;
return id;
}
function seatCount(row) {
const n = Math.floor(Number(row.seats));
return Number.isFinite(n) && n >= 1 ? n : 1;
}
function isActive(row) {
return row.active === true || row.active === 'true';
}
// Mirrors the old validator: a missing or unreadable date reads as expired,
// never as "never expires".