mirror of
				https://github.com/AppFlowy-IO/AppFlowy.git
				synced 2025-10-31 10:03:18 +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)); |