(value: unknown)
| 28 | |
| 29 | /** Strips protocol / path / leading `www.` from a domain-ish input. */ |
| 30 | export function normalizeDomain(value: unknown): string { |
| 31 | return str(value) |
| 32 | .toLowerCase() |
| 33 | .replace(/^https?:\/\//, '') |
| 34 | .replace(/^www\./, '') |
| 35 | .replace(/\/.*$/, '') |
| 36 | } |
| 37 | |
| 38 | /** Returns the first non-empty string in an array (or `undefined`). */ |
| 39 | export function firstNonEmpty(value: unknown): string | undefined { |
no test coverage detected