Include complete API and frontend sources for unified deployment
This commit is contained in:
1 parent
627b0ae60e
commit
d8fcae32b0
93 files changed
+53270
-3
No files matched your search
@@ -0,0 +1,14 @@
|
||||
import crypto from 'crypto';
|
||||
|
||||
export default (howMany = 12, chars = 'abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789') => {
|
||||
const rnd = crypto.randomBytes(howMany),
|
||||
value = [],
|
||||
len = Math.min(256, chars.length),
|
||||
d = 256 / len;
|
||||
|
||||
for (let i = 0; i < howMany; i++) {
|
||||
value[i] = chars[Math.floor(rnd[i] / d)];
|
||||
}
|
||||
|
||||
return value.join('');
|
||||
};
|
||||
Reference in new issue
Block a user