Package detail

number-intl

chuyik51MIT1.2.2

Tiny number formatter with Intl support, tailored CLDR data and tree-shaking ready.

number, format, intl, currency

readme

number-intl

Tiny number formatter with Intl support, tailored CLDR data and tree-shaking ready.

Install

yarn add number-intl

Usage

import { setLocale, format } from 'number-intl';

// import locale data on demand
import 'number-intl/locales/module/en';
import 'number-intl/locales/module/zh-Hans';
import 'number-intl/locales/module/id';

// set current locale to indonesian
setLocale('id');

// format number like to string
format(3.14); // --> 3,14
format(3.14, { style: 'currency', currency: 'CNY' }); // --> CN¥3,14
format('31415926.31415926', { useGrouping: true }); // --> 31.415.926,31415926

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

1.2.2 (2022-08-03)

Bug Fixes

  • integer should not have decimal symbol (4ef8e4c)

1.2.1 (2021-05-31)

1.2.0 (2021-05-28)

Features

  • support narrow symbol and IDR currency (e5d721b)

1.1.5 (2021-05-24)

1.1.4 (2021-05-24)

Bug Fixes

1.1.3 (2021-05-24)

1.1.2 (2021-05-24)

1.1.1 (2021-05-24)

1.1.0 (2021-05-24)

Features