(length = 6)
| 57 | } |
| 58 | |
| 59 | export function generateRandomCode(length = 6) { |
| 60 | const getRandomDigit = () => Math.floor(Math.random() * (10)); // 0-9 |
| 61 | |
| 62 | const codeDigits = Array.from({ length }).map(getRandomDigit); |
| 63 | |
| 64 | return codeDigits.join(''); |
| 65 | } |
| 66 | |
| 67 | /** This generates a random string, including unicode characters. */ |
| 68 | export function generateRandomString(length = 10) { |
no outgoing calls
no test coverage detected