sanniassin / react-input-mask

Input masking component for React. Made with attention to UX.
MIT License
2.22k stars 258 forks source link

Export formatValue util #193

Open jMalojlo opened 4 years ago

jMalojlo commented 4 years ago

Hello!

Feature request

Export formatValue function from the main module

Why?

I have a postal code that needs to be formatted using this format: '999-99'. Works great if you render an input, but in some places I just want to render some text and format it in exactly same manner. My hacky solution for now is that I copied the formatValue function from the github repo along with some other functions it depends on and used it like this:

const formattedValue = formatValue(parseMask('999-99', '', defaultFormatChars), '11221');

This works 'fine' for now, but feels really bad for obvious reasons.

I could provide provide new type definitions if the above could be done 👍