1.0.7 • Published 10 months ago

react-format-number-shorten v1.0.7

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

Format number

Installation

npm i react-format-number-shorten

Usage

Import package

import formatNumber from 'react-format-number-shorten';

Basic usage

const pi = 3.14159265359;

console.log(formatNumber(pi)); // 3
console.log(formatNumber(pi, { fixed: 2 })); // 3.14

const price = 125000;
console.log(formatNumber(price)); // 125,000
console.log(formatNumber(price, { decimalSeparator: '.' })); // 125.000

Format with shorten

const money = 1000000;

console.log(formatNumber(money, { shorten: true })); // 1M
console.log(formatNumber(money, { fixed: 2, shorten: true })); // 1.00M
console.log(formatNumber(money, { fixed: 2, shorten: true,  decimalSeparator: ',' })); // 1,00M
1.0.7

10 months ago

1.0.6

11 months ago

1.0.5

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