Skip to content

Commit

Permalink
refacotr: extract for TomlType empty issue
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Jan 5, 2024
1 parent d64b477 commit 0490377
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions chapi-parser-toml/src/main/kotlin/chapi/parser/toml/TomlType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,18 @@ enum class TomlType {
}
}

fun fromString(type: String): TomlType {
return when (type) {
"String" -> String_
"Int" -> Int
"Float" -> Float
"Bool" -> Bool
"Date" -> Date
"Array" -> Array
"InlineTable" -> InlineTable
else -> None
companion object {
fun fromString(type: String): TomlType? {
return when (type) {
"String" -> String_
"Int" -> Int
"Float" -> Float
"Bool" -> Bool
"Date" -> Date
"Array" -> Array
"InlineTable" -> InlineTable
else -> null
}
}
}
}

0 comments on commit 0490377

Please sign in to comment.