zero-to-billion
v1.0.1
Published
a simple function to reduce a number to a short string.
Downloads
2
Readme
Number Formatter
A lightweight npm module to format large numbers with suffixes.
Installation
Install the package via npm:
Usage
In your JavaScript or TypeScript file, import the zeroToBillion
function from the package:
const { zeroToBillion } = require('zero-to-billion');
// or
import { zeroToBillion } from 'zero-to-billion';
console.log(zeroToBillion(500)); // Output: 500
console.log(zeroToBillion(1500)); // Output: 1.5K
console.log(zeroToBillion(1200000)); // Output: 1.2M
console.log(zeroToBillion(3500000000)); // Output: 3.5B