Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strict formatting #28

Open
Crusader2010 opened this issue Jul 10, 2020 · 1 comment
Open

Strict formatting #28

Crusader2010 opened this issue Jul 10, 2020 · 1 comment

Comments

@Crusader2010
Copy link

Crusader2010 commented Jul 10, 2020

Hi,

I found your library to be extremely useful, except for one case that doesn't really have a solution without doing some hacky stuff that i hate. I need a way to allow strict matching of numbers (when other characters are present

var doubleFormat = wNumb({ mark: ',', thousand: '.', decimals: 2 }); console.log(doubleFormat.from('thisStillReturnsAValidNumber1.231,1231'));

I would like an option such that the previous code returns the text itself, not just the number from it, since it cannot be directly converted to a number.

@leongersen
Copy link
Owner

I'm not entirely sure what you'd like to do here, but if I understand it correctly you could implement this by using the decoder option (which applies before all other formatting), and invalidate the number there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants