a3c5abc4ad0da9b957a7a9bd1e802106b0c26450
1 function randString() {
2 return Math
.random().toString(36).substr(2); // remove `0.`
5 module
.exports = function(tokenLength
) {
7 // 10 = min length of a rand() string
8 const nbRands
= Math
.ceil(tokenLength
/10);
9 for (let i
= 0; i
< nbRands
; i
++) res
+= randString();
10 return res
.substr(0, tokenLength
);