export function clamp(v: number, min: number, max: number): number { return Math.min(max, Math.max(min, v)) } /** * Log-scale rounding used to bucket large counts (e.g. follower counts) into a * small "clout" number for display. Formerly lived in the analytics module. */ export function toClout(n: number | null | undefined): number | undefined { if (n == null) { return undefined } else { return Math.max(0, Math.round(Math.log(n))) } }