mirror of
https://github.com/outline/outline.git
synced 2026-11-21 13:34:02 +03:00
13 lines
208 B
TypeScript
13 lines
208 B
TypeScript
export default function isUrl(text: string) {
|
|
if (text.match(/\n/)) {
|
|
return false;
|
|
}
|
|
|
|
try {
|
|
const url = new URL(text);
|
|
return url.hostname !== "";
|
|
} catch (err) {
|
|
return false;
|
|
}
|
|
}
|