rittenhop-ghost/versions/5.94.2/node_modules/express-hbs/lib/generate-id.js

17 lines
324 B
JavaScript
Raw Permalink Normal View History

'use strict';
var alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_';
function generateId(length) {
if (!length) {
length = 8;
}
var res = '';
for (var i = 0; i < length; ++i) {
res += alphabet[Math.floor(Math.random() * alphabet.length)];
}
return res;
}
module.exports = generateId;