# Context To enable search records sorting by ts_rank_cd / ts_rank, we have decided to add a new search resolver serving `GlobalSearchRecordDTO`. ----- - [x] Test to add - work in progress closes https://github.com/twentyhq/core-team-issues/issues/357
15 lines
402 B
TypeScript
15 lines
402 B
TypeScript
export const sanitizeURL = (link: string | null | undefined) => {
|
|
return link
|
|
? link.replace(/(https?:\/\/)|(www\.)/g, '').replace(/\/$/, '')
|
|
: '';
|
|
};
|
|
|
|
export const getLogoUrlFromDomainName = (
|
|
domainName?: string,
|
|
): string | undefined => {
|
|
const sanitizedDomain = sanitizeURL(domainName);
|
|
return sanitizedDomain
|
|
? `https://twenty-icons.com/${sanitizedDomain}`
|
|
: undefined;
|
|
};
|