(length?: number, charSet?: string)
| 1 | export function randomString(length?: number, charSet?: string) { |
| 2 | const result: string[] = []; |
| 3 | length = length || 16; |
| 4 | charSet = charSet || 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; |
| 5 | |
| 6 | while (length--) { |
| 7 | result.push(charSet[Math.floor(Math.random() * charSet.length)]); |
| 8 | } |
| 9 | return result.join(''); |
| 10 | } |
| 11 | |
| 12 | /** |
| 13 | * split string to array |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…