# Introduction Avoid having multiple `isDefined` definition across our pacakges Also avoid importing `isDefined` from `twenty-ui` which exposes a huge barrel for a such little util function ## In a nutshell Removed own `isDefined.ts` definition from `twenty-ui` `twenty-front` and `twenty-server` to move it to `twenty-shared`. Updated imports for each packages, and added explicit dependencies to `twenty-shared` if not already in place Related PR https://github.com/twentyhq/twenty/pull/9941
15 lines
453 B
TypeScript
15 lines
453 B
TypeScript
import { Company } from '@/companies/types/Company';
|
|
import { isDefined } from 'twenty-shared';
|
|
|
|
// temporary, to remove once domainName has been fully migrated to Links type
|
|
export const getCompanyDomainName = (company: Company) => {
|
|
if (!isDefined(company.domainName)) {
|
|
return company.domainName;
|
|
}
|
|
if (typeof company.domainName === 'string') {
|
|
return company.domainName;
|
|
} else {
|
|
return company.domainName.primaryLinkUrl;
|
|
}
|
|
};
|