15 lines
193 B
TypeScript
15 lines
193 B
TypeScript
const isLink = (text: string | null) => {
|
|
if (text === null) {
|
|
return false;
|
|
}
|
|
|
|
try {
|
|
new URL(text);
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
}
|
|
};
|
|
|
|
export default isLink;
|