UNPKG

datum-focus

Version:

Data shape, model, metadata, JSON, JSON Schema, GraphQL, MongoDB query and aggregations, iterator generators

7 lines (6 loc) 250 B
export function format(n: number, fixed?: number): string { const s = typeof fixed === "number" ? n.toFixed(fixed) : n.toString(); var parts = s.split("."); parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ","); return parts.join("."); }