-
Notifications
You must be signed in to change notification settings - Fork 11
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
Dollar values not parsed as numbers #96
Comments
Hi, in general the algorithm of ´natural-orderby´ will sort a list of money values of the same (prefixed) currency correctly, if you are using the same currency prefix. If you have a list of mixed value types like in your example (money values and plain numbers), by design the algorithm considers the money value as an alphanumeric value. So the plain number always is going to be sorted in first place. |
Thanks for your response! That makes sense, and is the behavior I'm seeing. I should give a bit more context to my use-case: I'm not only using
Since I actually don't know a priori whether I'll be filtering data that is regular numeric values or currency values, it'd be handy to be able to compare currency values as numerics always. I can definitely do it manually by examining the data before I do some filtering, but I thought it was worth opening the discussion to see if it was something worth adding to the library. :-) Perhaps there are other use-cases that it is valuable for? By the way, thanks for a spiffy little library. It's really been great to use! |
I'm not sure that this is a design goal, but I see that dollar values (and presumably other currencies) are not parsed to be identical to plain numbers.
(See https://runkit.com/dahjelle/5dd552e003c3750014962150 for a runnable version of the above.)
I haven't dived in deep to see how the algorithm in this library works, but does it seem like this is a possible and desired feature?
The text was updated successfully, but these errors were encountered: