surendra kumar
deploy
47b4127
Raw
History Blame Contribute Delete
972 Bytes
import type { AttributedValue } from "@fello/contracts";
export function formatValue(field: AttributedValue | undefined | null): string {
if (!field || field.value === null || field.value === undefined || field.value === "") {
return "Unknown";
}
return String(field.value);
}
export function formatScore(value: number | null | undefined): string {
if (value === null || value === undefined) {
return "Unavailable";
}
return value.toFixed(1);
}
export function formatConfidence(value: number | null | undefined): string {
if (value === null || value === undefined) {
return "0%";
}
return `${Math.round(value * 100)}%`;
}
export function toCompanyLines(
companies: Array<{ company_name: string; partial_domain?: string | null }>,
): string {
return companies
.map((company) =>
company.partial_domain
? `${company.company_name}, ${company.partial_domain}`
: company.company_name,
)
.join("\n");
}