growth-activities / src /lib /format.ts
3v324v23's picture
init: growth-activities for hf spaces
243dc36
Raw
History Blame Contribute Delete
274 Bytes
export function maskPhone(phone: string) {
const p = phone.replace(/\s+/g, "")
if (p.length < 7) return p
return `${p.slice(0, 3)}****${p.slice(-4)}`
}
export function formatPct(v: number) {
if (!Number.isFinite(v)) return "0%"
return `${Math.round(v * 100)}%`
}