Renamed to henriquecbuss/elm-mask. It is published under that name, and new versions come out there.
Versions published as NeoVier/elm-mask still install under that name. 2 versions of 6 come from the new location (see their notes). 4 versions could not be recovered and cannot be installed.
Rerouted (renamed, verified). The GitHub user or repository was renamed. The tag is still there, at the new name. The Lamdera package server serves a copy recovered from https://github.com/henriquecbuss/elm-mask.
What we checked: The repo moved to github.com/henriquecbuss/elm-mask. Rebuilt with git archive from commit 509c4817363c of https://github.com/henriquecbuss/elm-mask (zip prefix NeoVier-elm-mask-509c481/, America/Los_Angeles times): the zip is byte-identical to the one package.elm-lang.org recorded, SHA-1 50aad2b79f92f46f32c26620c64c14c1d6e36ea4.
The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.
Details · package.elm-lang.org's zip: https://github.com/NeoVier/elm-mask/zipball/2.0.0/
This library helps you mask Strings and Floats
Remove a mask applied by string. This is often needed if you
want to save just the value, and not the formatted/masked String.
remove { mask = "+1 ### ### ####", replace = '#' } "+1 123 456 7890"
--> "1234567890"
remove { mask = "+1 ### ### ####", replace = '#' } "1234567890"
-->"1234567890"When formatting with float and floatString, it can be useful to either use
exactly an amount of decimal digits, or just to limit it to a certain amount.
Mask a float to have a certain amount of DecimalDigits.
float (Precisely 2) { decimalSeparator = ".", thousandsSeparator = "" } 1234
--> "1234.00"
float (Precisely 2) { decimalSeparator = ",", thousandsSeparator = " " } 1234.5
--> "1 234,50"
float (Precisely 2) { decimalSeparator = ",", thousandsSeparator = "" } 123.4567
--> "123,45"
float (AtMost 2) { decimalSeparator = ".", thousandsSeparator = "," } 123
--> "123"
float (AtMost 2) { decimalSeparator = ".", thousandsSeparator = "," } 123.4
--> "123.4"
float (AtMost 2) { decimalSeparator = ".", thousandsSeparator = "," } 123.4567
--> "123.45"Mask a float to have a certain amount of DecimalDigits,
but using a String as an input. This is useful for input fields, where the
onInput event returns a String that can be run through floatString. In
case the input String is not a valid Float, this function returns Nothing,
and an empty String is automatically converted to 0.
floatString (Precisely 2) { decimalSeparator = ",", thousandsSeparator = " " } "1234.5"
--> Just "1 234,50"
floatString (Precisely 2) { decimalSeparator = ".", thousandsSeparator = "," } "12a.4"
--> Nothing
floatString (Precisely 2) { decimalSeparator = ",", thousandsSeparator = "." } ""
--> Just "0,00"Usually you'll want to use this function in your update like this:
update msg model =
case msg of
EnteredPrice price ->
{ model
| price =
price
|> Mask.floatString (Mask.Precisely 2)
|> Maybe.withDefault model.price
}Remove a mask applied by float or floatString
removeFloat { decimalSeparator = ",", thousandsSeparator = " " } "1 234,56"
--> "1234.56"A default value you can use for float and floatString.
Update a masked value you store in your Model. This is useful to provide a
better UX when using masked input fields. For more details, check out
this example on GitHub
or in this Ellie link, which uses a
custom element to
make it even better!
Apply a simple mask to a
String. You can customize the mask template and whichCharto replace.