Miss any of our Open RFC calls?Watch the recordings here! »

typographic-numbers

2.0.3 • Public • Published

typographic-numbers Build Status

Micro module for formatting numbers

Install

npm install --save typographic-numbers

Usage

Use typographic numbers depending on your locale for proper thousand separator and decimal point. Use ISO 639 codes to specify locale, example en-uk, ru-ru, da. This module is based on typographic-numbers-l10n-db and choosing proper symbols for every locale.

import numbers from 'typographic-numbers';
 
numbers('15215', { locale: 'en-us' }); // 15,215
numbers('9015215.215', { locale: 'en-us' }); // 9,015,215.215
numbers('15215 and 15215,215', { locale: 'en-us' }); // 15,215 and 15,215.215
numbers('9015215.215', { locale: 'ru-ru' }); // 9 015 215,215

API

numbers(input, options)

input

Type: string

Text for transform.

options

Type: object

Options to pass locale for proper separator and point symbols.

License

MIT

Install

npm i typographic-numbers

DownloadsWeekly Downloads

65

Version

2.0.3

License

MIT

Last publish

Collaborators

  • avatar