Spaces:
Runtime error
Runtime error
| const alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz-' | |
| export function nanoid(size = 12): string { | |
| let id = '' | |
| const bytes = crypto.getRandomValues(new Uint8Array(size)) | |
| for (let i = 0; i < size; i++) { | |
| id += alphabet[bytes[i] & 63] | |
| } | |
| return id | |
| } |