refactor with async/await

Trying to be more robust about error handling and failure.
This commit is contained in:
Roman Shtylman
2016-07-09 17:06:13 -07:00
parent f12f1c81b3
commit a2a58f4c6f
10 changed files with 290 additions and 221 deletions

View File

@@ -1,11 +1,11 @@
// all url safe
// can't use uppercase because hostnames are lowercased
var chars = 'abcdefghijklmnopqrstuvwxyz';
const chars = 'abcdefghijklmnopqrstuvwxyz';
module.exports = function rand_id() {
var randomstring = '';
export default function rand_id() {
let randomstring = '';
for (var i=0; i<10; ++i) {
var rnum = Math.floor(Math.random() * chars.length);
const rnum = Math.floor(Math.random() * chars.length);
randomstring += chars[rnum];
}