(size = 8)
| 7 | * consistency with the app-level `generateShortId` utility. |
| 8 | */ |
| 9 | export function shortId(size = 8): string { |
| 10 | const bytes = new Uint8Array(size) |
| 11 | crypto.getRandomValues(bytes) |
| 12 | |
| 13 | let id = '' |
| 14 | for (let i = 0; i < size; i++) { |
| 15 | id += URL_SAFE_ALPHABET[bytes[i] & 63] |
| 16 | } |
| 17 | return id |
| 18 | } |
no outgoing calls
no test coverage detected