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

8 lines
253 B
TypeScript

import { isDefined } from './isDefined';
export const isDomain = (url: string | undefined | null) =>
isDefined(url) &&
/^((?!-))(xn--)?[a-z0-9][a-z0-9-_]{0,61}[a-z0-9]{0,1}\.(xn--)?([a-z0-9-]{1,61}|[a-z0-9-]{1,30}\.[a-z]{2,})$/.test(
url,
);