Remove unused random.

pull/25/head
Pontus Alexander 2017-12-10 18:44:24 +01:00
parent aae6d547bb
commit e3ebee4557
1 changed files with 0 additions and 20 deletions

View File

@ -1,20 +0,0 @@
const crypto = require('crypto');
const ID_LENGTH = 12;
const URL_SAFE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
function generateRandomString(len = 6, chars = URL_SAFE) {
let cursor = 0;
return crypto.randomBytes(len).reduce((string, byte) => {
cursor += byte;
return string + chars[cursor % chars.length];
}, '');
}
function createId() {
return generateRandomString(ID_LENGTH);
}
module.exports = {
createId,
};