Skip to content

Commit

Permalink
♻️ Refactor Zero(Any) constructor (#676)
Browse files Browse the repository at this point in the history
This commit inlines the `Zero.Companion.PATTERN` constant in the `Zero(Any)` constructor for future removal.
  • Loading branch information
LVMVRQUXL committed Jul 15, 2024
1 parent 0960c50 commit 1787bca
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public class Zero {
*/
@ExperimentalSince(KotoolsTypesVersion.Unreleased)
public constructor(number: Any) {
val regex = Regex(PATTERN)
val regex = Regex("""^[+-]?0+(?:\.0+)?$""")
val numberMatchesRegex: Boolean = "$number".matches(regex)
require(numberMatchesRegex) {
"'$number' is not a valid representation of zero."
Expand Down

0 comments on commit 1787bca

Please sign in to comment.