1.1.121 • Published 11 months ago

convert-to-compact v1.1.121

Weekly downloads
-
License
MIT
Repository
github
Last release
11 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

11 months ago

1.1.120

11 months ago

1.1.12

11 months ago

1.1.11

11 months ago

1.1.10

11 months ago

1.1.1

11 months ago

1.1.0

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago