Skip to content

Commit

Permalink
style: ktFormat
Browse files Browse the repository at this point in the history
  • Loading branch information
murjune committed Oct 28, 2024
1 parent 80c04c0 commit 8d8ab58
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,32 @@ fun WildPokemon.toUi(): BiomePokemonUiModel =
grade = tier,
gymLeaderUrl = null,
type = null,
pokemons = pokemons.mapIndexed { index, biomePokemon ->
biomePokemon.toPokemonUiModel(index)
}
pokemons =
pokemons.mapIndexed { index, biomePokemon ->
biomePokemon.toPokemonUiModel(index)
},
)

fun BossPokemon.toUi(): BiomePokemonUiModel =
BiomePokemonUiModel(
grade = tier,
gymLeaderUrl = null,
type = null,
pokemons = pokemons.mapIndexed { index, biomePokemon ->
biomePokemon.toPokemonUiModel(index)
},
pokemons =
pokemons.mapIndexed { index, biomePokemon ->
biomePokemon.toPokemonUiModel(index)
},
)

fun GymPokemon.toUi(): BiomePokemonUiModel =
BiomePokemonUiModel(
grade = gymLeaderName,
gymLeaderUrl = gymLeaderImage,
type = gymLeaderTypeLogos.firstOrNull()?.toUi(),
pokemons = pokemons.mapIndexed { index, biomePokemon ->
biomePokemon.toPokemonUiModel(index)
},
pokemons =
pokemons.mapIndexed { index, biomePokemon ->
biomePokemon.toPokemonUiModel(index)
},
)

fun BiomePokemon.toPokemonUiModel(hashId: Int): PokemonUiModel =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,14 @@ fun PokemonResponse.toData(): Pokemon =
fun PokemonResponse2.toData(): Pokemon {
// TODO : 지금 포켓몬 이름을 보여주는거 모든 곳에서 통일이 안됨..
val pureName = name.substringBefore("_")
val pascalCaseFormName = formName.split("_").joinToString("") { original ->
if (original.isBlank()) {
original
} else {
original.replaceFirstChar { it.uppercase() }
val pascalCaseFormName =
formName.split("_").joinToString("") { original ->
if (original.isBlank()) {
original
} else {
original.replaceFirstChar { it.uppercase() }
}
}
}

val formattedName =
if (formName.isBlank() || formName.trim().lowercase() == "normal") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ fun BossPokemonResponse.toData(): BossPokemon =
pokemons = pokemons.toData(),
)

fun List<BossPokemonResponse>.toData(): List<BossPokemon> = filter {
it.pokemons.isNotEmpty()
}.map(BossPokemonResponse::toData)
fun List<BossPokemonResponse>.toData(): List<BossPokemon> =
filter {
it.pokemons.isNotEmpty()
}.map(BossPokemonResponse::toData)
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,4 @@ fun WildPokemonResponse.toData(): WildPokemon =
pokemons = pokemons.toData(),
)

fun List<WildPokemonResponse>.toData(): List<WildPokemon> =
filter { it.pokemons.isNotEmpty() }.map (WildPokemonResponse::toData)
fun List<WildPokemonResponse>.toData(): List<WildPokemon> = filter { it.pokemons.isNotEmpty() }.map(WildPokemonResponse::toData)

0 comments on commit 8d8ab58

Please sign in to comment.