1.1.121 • Published 4 months ago

convert-to-compact v1.1.121

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

convert-to-compact

convert-to-compact is a utility package that converts large numbers into a more readable format using abbreviations like K (for thousands), M (for millions), and B (for billions).

This package is perfect for simplifying large numbers in user interfaces, reports, or analytics, making them more digestible.

Installation

You can install convert-to-compact via NPM:

npm install convert-to-compact

Usage TypeScript

import { convertToKMB } from 'convert-to-compact';

const result1 = convertToKMB(224000);
console.log(result1); // Output: '224K'

const result2 = convertToKMB(1500000);
console.log(result2); // Output: '1.5M'

const result3 = convertToKMB(5000000000);
console.log(result3); // Output: '5B'

Usage JavaScript

const {convertToKMB} = require("convert-to-compact");

const result1 = convertToKMB(224000);
console.log(result1); // Output: '224K'

const result2 = convertToKMB(1500000);
console.log(result2); // Output: '1.5M'

const result3 = convertToKMB(5000000000);
console.log(result3); // Output: '5B'
1.1.121

4 months ago

1.1.120

4 months ago

1.1.12

4 months ago

1.1.11

4 months ago

1.1.10

4 months ago

1.1.1

4 months ago

1.1.0

4 months ago

1.0.4

4 months ago

1.0.3

4 months ago

1.0.2

4 months ago

1.0.1

4 months ago

1.0.0

4 months ago