From ab8a3879981a68eccb58e762dd8ff6acb99a769e Mon Sep 17 00:00:00 2001 From: James Prevett Date: Sun, 13 Oct 2024 15:57:52 -0500 Subject: [PATCH] Added `formatCompact` --- src/numbers.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/numbers.ts b/src/numbers.ts index 5b81b1f..cd6adfe 100644 --- a/src/numbers.ts +++ b/src/numbers.ts @@ -13,3 +13,7 @@ export function toDegrees(radians: number): number { export function toRadians(degrees: number): number { return (degrees / 180) * Math.PI; } + +const __formatter = Intl.NumberFormat('en', { notation: 'compact' }); + +export const formatCompact = __formatter.format.bind(__formatter);