Micro module for formatting numbers
npm install --save typographic-numbers
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
Type: string
Text for transform.
Type: object
Options to pass locale for proper separator and point symbols.
MIT