random game IDs
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import { customAlphabet } from 'nanoid';
|
||||
import getRandomItems from '@/tools/getRandomItems';
|
||||
|
||||
const alphabet =
|
||||
'0123456789abcdefghijklmnopqrstuvwxyz';
|
||||
|
||||
const generateID = (length: number = 6) => customAlphabet(alphabet, length);
|
||||
const generateID = (length: number = 6) => {
|
||||
return getRandomItems(alphabet.split(''), length).join('');
|
||||
};
|
||||
|
||||
export default generateID;
|
||||
|
||||
Reference in New Issue
Block a user