Python 64.6%
TypeScript 33.7%
CSS 0.8%
1export const fmtCAD = (v: number, digits = 0): string =>2 new Intl.NumberFormat('fr-CA', { style: 'currency', currency: 'CAD', maximumFractionDigits: digits }).format(v);34export const fmtNum = (v: number, digits = 2): string =>5 new Intl.NumberFormat('fr-CA', { maximumFractionDigits: digits }).format(v);67export const fmtPct = (v: number, digits = 1): string =>8 new Intl.NumberFormat('fr-CA', { style: 'percent', maximumFractionDigits: digits }).format(v);910export const m2ToPi2 = (m2: number): number => m2 * 10.7639;11export const pi2ToM2 = (pi2: number): number => pi2 / 10.7639;1213export function fmtDate(iso: string): string {14 const d = new Date(iso.endsWith('Z') || iso.includes('+') ? iso : iso + 'Z');15 const now = new Date();16 const sameDay = d.toDateString() === now.toDateString();17 if (sameDay) return `${String(d.getHours()).padStart(2, '0')}:${String(d.getMinutes()).padStart(2, '0')}`;18 return d.toLocaleDateString('fr-CA', { day: 'numeric', month: 'short' });19}2021export function fmtBytes(n: number): string {22 if (n < 1024) return `${n} o`;23 if (n < 1024 * 1024) return `${(n / 1024).toFixed(0)} Ko`;24 return `${(n / 1024 / 1024).toFixed(1)} Mo`;25}2627export function fmtDuration(ms: number): string {28 return ms < 1000 ? `${ms} ms` : `${(ms / 1000).toFixed(1)} s`;29}3031export function cellValue(v: unknown): string {32 if (v === null || v === undefined) return '';33 if (typeof v === 'number') return Number.isInteger(v) ? fmtNum(v, 0) : fmtNum(v, 2);34 return String(v);35}36