WifiBiz / src /utils /generateCode.js
Mbonea's picture
Initial commit — multi-tenant WiFi hotspot monetization platform
c33bf01
raw
history blame contribute delete
334 Bytes
// Readable code chars — no 0/O, 1/I confusion
const CHARS = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789';
function generateCode() {
const part = (n) =>
Array.from({ length: n }, () => CHARS[Math.floor(Math.random() * CHARS.length)]).join('');
return `${part(4)}-${part(4)}`; // e.g. AB3K-9X2M
}
module.exports = { generateCode };