mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-07-31 12:56:08 +00:00
11 lines
361 B
TypeScript
11 lines
361 B
TypeScript
![]() |
const generateRandomId = (length: number): string => {
|
||
|
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
||
|
let result = '';
|
||
|
for (let i = 0; i < length; i++) {
|
||
|
result += characters.charAt(Math.floor(Math.random() * characters.length));
|
||
|
}
|
||
|
return result;
|
||
|
};
|
||
|
|
||
|
export const nanoid = jest.fn(() => generateRandomId(8));
|