Files
twenty/packages/twenty-front/src/utils/is-url.ts
2023-12-10 18:10:54 +01:00

8 lines
239 B
TypeScript

import { isDefined } from './isDefined';
export const isURL = (url: string | undefined | null) =>
isDefined(url) &&
url.match(
/^(https?:\/\/)?(www.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/i,
);