Download src/utils/generateCode.js from Mbonea/WifiBiz: direct link, hf CLI and curl.
- Browser
- Download file 334 Bytes
-
https://huggingface.co/spaces/Mbonea/WifiBiz/resolve/main/src/utils/generateCode.js
- Command line
-
hf download hf://spaces/Mbonea/WifiBiz/src/utils/generateCode.js
-
curl -L -o generateCode.js https://huggingface.co/spaces/Mbonea/WifiBiz/resolve/main/src/utils/generateCode.js
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 }; | |