Use same lock values as mobile clients
[ProtonMail-WebClient.git] / packages / shared / lib / calendar / urlify.ts
blobc538d64801dee01de2506003f19f3ee91697a3f0
1 // eslint-disable-next-line no-useless-escape
2 const URL_REGEX = /(\b(?:https|ftps|file|mailto|tel|sms):(?:(?!["<>\^`{|}])\S)+)/gi;
3 const A_TAG_REGEX = /(<a[^>]+>.+?<\/a>)/gi;
5 const urlify = (string: string) =>
6     string
7         .split(A_TAG_REGEX)
8         .map((piece) => {
9             if (piece.match(A_TAG_REGEX)) {
10                 return piece;
11             }
13             return piece.replace(URL_REGEX, '<a href="$1">$1</a>');
14         })
15         .join('');
17 export default urlify;