Files
twenty/packages/twenty-front/src/utils/is-url.ts
Lucas Bordeau 581dfafe11 Renamed nullable utils into isDefined and isUndefinedOrNull (#4402)
* Renamed nullable utils into isDefined and isUndefinedOrNull
2024-03-11 14:28:57 +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,
);