Use lowerCamelCase for field names.

This commit is contained in:
Dillon Kearns 2021-06-03 11:58:35 -07:00
parent 0cc6757507
commit 2177d2bf1d
2 changed files with 7 additions and 7 deletions

View File

@ -25,7 +25,7 @@ type alias Msg =
type alias RouteParams = type alias RouteParams =
{ pokedexnumber : String } { pokedexNumber : String }
page : Page RouteParams Data page : Page RouteParams Data
@ -35,11 +35,11 @@ page =
, routes = routes , routes = routes
, data = data , data = data
, handleFallback = , handleFallback =
\{ pokedexnumber } -> \{ pokedexNumber } ->
let let
asNumber : Int asNumber : Int
asNumber = asNumber =
String.toInt pokedexnumber |> Maybe.withDefault -1 String.toInt pokedexNumber |> Maybe.withDefault -1
in in
DataSource.succeed DataSource.succeed
(asNumber > 0 && asNumber <= 150) (asNumber > 0 && asNumber <= 150)
@ -58,7 +58,7 @@ data routeParams =
(DataSource.Http.get (Secrets.succeed "https://elm-pages-pokedex.netlify.app/.netlify/functions/time") (DataSource.Http.get (Secrets.succeed "https://elm-pages-pokedex.netlify.app/.netlify/functions/time")
Decode.string Decode.string
) )
(DataSource.Http.get (Secrets.succeed ("https://pokeapi.co/api/v2/pokemon/" ++ routeParams.pokedexnumber)) (DataSource.Http.get (Secrets.succeed ("https://pokeapi.co/api/v2/pokemon/" ++ routeParams.pokedexNumber))
(Decode.map2 Pokemon (Decode.map2 Pokemon
(Decode.field "forms" (Decode.index 0 (Decode.field "name" Decode.string))) (Decode.field "forms" (Decode.index 0 (Decode.field "name" Decode.string)))
(Decode.field "types" (Decode.list (Decode.field "type" (Decode.field "name" Decode.string)))) (Decode.field "types" (Decode.list (Decode.field "type" (Decode.field "name" Decode.string))))
@ -111,7 +111,7 @@ view maybeUrl sharedModel static =
] ]
, text (static.data.pokemon.abilities |> String.join ", ") , text (static.data.pokemon.abilities |> String.join ", ")
, img , img
[ src <| "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/" ++ static.routeParams.pokedexnumber ++ ".png" [ src <| "https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/" ++ static.routeParams.pokedexNumber ++ ".png"
] ]
[] []
, p [] , p []

View File

@ -203,10 +203,10 @@ function routeVariant(name) {
} }
/** /**
* @param {string } name * @param {string} name
*/ */
function toFieldName(name) { function toFieldName(name) {
return name.toLowerCase(); return name.charAt(0).toLowerCase() + name.slice(1);
} }
module.exports = { module.exports = {