backend: generating guests

This commit is contained in:
muerwre 2018-11-29 16:18:02 +07:00
parent b6bd300e1b
commit 5025a43dbd
16 changed files with 1380 additions and 167 deletions

10
backend/utils/gen.js Normal file
View file

@ -0,0 +1,10 @@
module.exports.genRandomSequence = (length = 16) => {
let sequence = '';
const symbols = 'ABCDEFGHIJKLMOPQRSTUVXYZabcdefghijgmlopqrstuvxyz01234567890'
for (let i = 0; i < length; i += 1) {
sequence += symbols[parseInt(Math.random() * (symbols.length - 1), 10)];
}
return sequence;
};