()
| 1 | export const createRandomString = () => { |
| 2 | if ( |
| 3 | !('crypto' in window) || |
| 4 | typeof window.crypto?.randomUUID !== 'function' |
| 5 | ) { |
| 6 | return legacyCreateRandomString(); |
| 7 | } |
| 8 | |
| 9 | return 'a_' + crypto.randomUUID(); // ids must start with letters |
| 10 | }; |
| 11 | |
| 12 | function legacyCreateRandomString() { |
| 13 | const USE_HEX = 36; |
no test coverage detected