Repository navigation
v1.23.0
Minor Changes
-
56d72fa:
react-smart-copy/number: numbers and amounts, pasted and copied exactly in any locale's format.parseNumber(text, { locale })reads one number from pasted text:- group separators
,.'and spaces (no-break and narrow ones too), in groups of three or lakh and crore grouping; wrong grouping givesnull; - the decimal separator the text shows is one; only a lone
1,234or1.234is settled bylocale, and flaggedambiguous; -,+,−, a trailing minus and accounting brackets; currency symbols and ISO codes before or after;%and‰; scientific notation; digits of any script.- It gives
value, andexactas a decimal string with every digit as written, for money.
- group separators
pasteAsNumber(event)inserts the number the way the field takes it:exactin<input type="number">, the locale's format in text fields with undo intact. Pastes that are not numbers are turned away.formatNumberandnumberPayloadwrite a number, bigint or exact decimal string for any locale, grouped or not, rounded tofractionDigitswithout float error.numberSymbols(locale)gives a locale's separators and grouping.