(username: string, realname: string)
| 44 | } |
| 45 | |
| 46 | export function isUsernameAlreadyFullName(username: string, realname: string): boolean { |
| 47 | // Normalize both strings |
| 48 | username = username |
| 49 | .replaceAll('-', '') |
| 50 | .toLowerCase(); |
| 51 | realname = realname |
| 52 | .normalize('NFD') |
| 53 | // Remove diacritics, punctuation and spaces |
| 54 | // https://stackoverflow.com/a/37511463/288906 |
| 55 | // https://www.freecodecamp.org/news/what-is-punct-in-regex-how-to-match-all-punctuation-marks-in-regular-expressions/ |
| 56 | .replaceAll(/[\s\p{Diacritic}\p{Punctuation}]/gu, '') |
| 57 | .toLowerCase(); |
| 58 | |
| 59 | return username === realname; |
| 60 | } |
| 61 | |
| 62 | const validVersion = /^[rv]?\d+(?:\.\d+)+/; |
| 63 | const isPrerelease = /^[rv]?\d+(?:\.\d+)+-\d/; |
no outgoing calls
no test coverage detected