elm-format-number
elm-format-number copied to clipboard
feature request/question: Reversing the formatting of a number?
Thanks for the library, it's used extensively in our app but I wanted to find out if the unformatting of a number has been considered or if it is perhaps out of scope?
Would be great to have a parse
-like function to obtain a Float from a formatted number in String representation. We have some internal code currently that is doing this and would gladly contribute it.
Hum… interesting.
Personally, I must say I have never thought about it — but something like that might make sense (drawing from the README.md
example):
import FormatNumber exposing (unparse)
import FormatNumber.Locales exposing (Decimals(..), Locale, usLocale)
sharesLocale : Locale
sharesLocale =
{ usLocale
| decimals = Exact 3
, negativePrefix = "("
, negativeSuffix = ")"
}
unparse sharesLocale "(3.142)" --> -3.142
Surely we have to be clear in the docs about precision, but that is not a blocker IMHO.
In other news, I am not sure when I can work on that, but I am happy to code review contributions — feel free to draft a PR : )
@cuducos Update on this. I have a first working version of code but, it is ugly. I am re-factoring the same. Will create a PR once it is done.