react-number-format
react-number-format copied to clipboard
Format function should support decimal
On our project we had a problem with your library - for some reason with typeof props.format === "function"
library worked only with integers, with this PR it'll also support decimal values.
@s-yadav hey sorry if I disturb you but what do you think about this?
I don't think we should handle prefix / suffix, and other formatting props if format prop is defined as function. If we do so that will lead to lots of corner case which is not meant to be solved by here.
We can look for some regex instead which allows all the valid character of a number and let the format method handle the cases.
Also, If a user needs to have more control on removing formatting he can pass removeFormat method. I guess we can work on improving the documentation of format (as function) and removeFormatting method, so people are aware of it while using custom format function. What do you say?