format number
npm install @p12/numeral
Name | Type | Default | Description |
---|---|---|---|
type | NumeralType | NumeralType.Token | format input |
decimalPlaces | number? | undefined | format decimal places |
enum NumeralType {
GameCoin,
Token,
Transfer,
Balance,
USD,
}
import {numeral, NumeralType} from '@p12/numeral';
const format1 = numeral('1028').format(NumeralType.GameCoin); // 1.028K
const format2 = numeral('1028').format(NumeralType.GameCoin, 2); // 1.03K