I would like to generate a short unique alphanumeric value to be used as confirmation codes for online purchases. I\'ve looking into https://github.com/broofa/node-uuid but the
based on this https://www.npmjs.com/package/randomstring
var randomstring = require("randomstring");
randomstring.generate();
// >> "XwPp9xazJ0ku5CZnlmgAx2Dld8SHkAeT"
randomstring.generate(7);
// >> "xqm5wXX"
randomstring.generate({
length: 12,
charset: 'alphabetic'
});
// >> "AqoTIzKurxJi"
randomstring.generate({
charset: 'abc'
});
// >> "accbaabbbbcccbccccaacacbbcbbcbbc"
you can do this
randomstring.generate({
length: 8,
charset: 'alphabetic'
});