number-intl
TypeScript icon, indicating that this package has built-in type declarations

1.2.2 • Public • Published

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

Package Sidebar

Install

npm i number-intl

Weekly Downloads

13

Version

1.2.2

License

MIT

Unpacked Size

4.62 MB

Total Files

2477

Last publish

Collaborators

  • chuyik