UNPKG

hd-utils

Version:

A handy utils for modern JS developers

9 lines (8 loc) 283 B
/** * @description it will format numbers to string if its bigger than 1000 with a K, million M and so on. * @example nFormatter(1000) => "1K" */ export default function nFormatter(num) { //@ts-ignore return Intl.NumberFormat('en', { notation: 'compact' }).format(num); }