(length)
| 216 | |
| 217 | // `generateId` generates a random alphanumeric ID of specified length. |
| 218 | export function generateId(length) { |
| 219 | const characters = |
| 220 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; |
| 221 | let result = ""; |
| 222 | const charactersLength = characters.length; |
| 223 | |
| 224 | for (let i = 0; i < length; i++) { |
| 225 | result += characters.charAt(Math.floor(Math.random() * charactersLength)); |
| 226 | } |
| 227 | return result; |
| 228 | } |
| 229 | |
| 230 | /** |
| 231 | * Removes a trailing path segment from a URL string, if present. |
no outgoing calls
no test coverage detected