Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 | 1x 1x 1x 11x 11x 11x 11x 11x 11x 11x 11x | import type { Salary } from "../types/job";
export function formatSalary(salary: Salary): string {
const fmt = (n: number) => n.toLocaleString("en-US");
const range =
salary.min !== null && salary.max !== null && salary.min !== salary.max
? `${fmt(salary.min)}–${fmt(salary.max)}`
: fmt(salary.min ?? salary.max ?? 0);
const currency = salary.currency ? `${salary.currency} ` : "";
const period = salary.period ? ` / ${salary.period}` : "";
return `${currency}${range}${period}`;
}
|