0.2.3 • Published 1 year ago

number-js-formatter v0.2.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

number-js-formatter

Requirements

Make sure you have the following installed:

📦 Install

npm install number-js-formatter
# or
yarn add number-js-formatter
# or
pnpm add number-js-formatter

🚀 Quick start

This library is minimal and doesn't require any configuration.

import { friendlyFormat } from 'number-js-formatter';

const num1 = 1_923_500.156;
const num2 = 1_004_850_000.91332;
const num3 = 1105_830_000_302.9946;

friendlyFormat(num1, { noOfDigitsAfterDecimal: 3 }); // "1.924m"
friendlyFormat(num2, { noOfDigitsAfterDecimal: 4, form: '-ln' }); // "1.0049bln"
friendlyFormat(num3, { noOfDigitsAfterDecimal: 3 }); // "1.106tn"

⚒️ Methods

🔨 Args

💡 Features

  • Format options in different short forms.
  • Strongly typed; number-js-formatter is purely written in TypeScript.

Limitations

  • Doesn't support quadrillions numbers
  • Locale support comming soon

🔌 Contributing

Read through our contributing guidelines to learn about our submission process, coding rules, and more.