wnumb
wnumb copied to clipboard
Strict formatting
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.
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.