Clean up code and remove unused dependencies

This commit is contained in:
Correl Roush 2018-02-08 16:33:08 -05:00
parent da45f3f94a
commit 385d9d242a
3 changed files with 8 additions and 13 deletions

View file

@ -12,7 +12,6 @@
"dependencies": { "dependencies": {
"elm-community/maybe-extra": "4.0.0 <= v < 5.0.0", "elm-community/maybe-extra": "4.0.0 <= v < 5.0.0",
"elm-lang/core": "5.1.1 <= v < 6.0.0", "elm-lang/core": "5.1.1 <= v < 6.0.0",
"elm-lang/html": "2.0.0 <= v < 3.0.0",
"elm-lang/http": "1.0.0 <= v < 2.0.0" "elm-lang/http": "1.0.0 <= v < 2.0.0"
}, },
"elm-version": "0.18.0 <= v < 0.19.0" "elm-version": "0.18.0 <= v < 0.19.0"

View file

@ -37,7 +37,6 @@ import Char
import Dict exposing (Dict) import Dict exposing (Dict)
import Http import Http
import Json.Decode exposing (Decoder) import Json.Decode exposing (Decoder)
import Maybe.Extra
import Paginated.Util import Paginated.Util
import Task exposing (Task) import Task exposing (Task)
import Time import Time
@ -214,18 +213,13 @@ fromResponse options response =
(Json.Decode.list options.decoder) (Json.Decode.list options.decoder)
response.body response.body
normalize : Dict String String -> Dict String String
normalize =
Dict.toList
>> Dict.fromList
nextPage : Maybe String nextPage : Maybe String
nextPage = nextPage =
header "Link" response.headers header "Link" response.headers
|> Maybe.map Paginated.Util.links |> Maybe.map Paginated.Util.links
|> Maybe.andThen (Dict.get "next") |> Maybe.andThen (Dict.get "next")
in in
case Debug.log "nextPage" nextPage of case nextPage of
Nothing -> Nothing ->
Result.map Complete items Result.map Complete items

View file

@ -25,11 +25,13 @@ links s =
_ -> _ ->
Nothing Nothing
in in
Regex.find Regex.find Regex.All linkPattern s
Regex.All
(Regex.regex "<(.*?)>; rel=\"(.*?)\"")
s
|> List.map .submatches |> List.map .submatches
|> List.map toTuples |> List.map toTuples
|> Maybe.Extra.values |> Maybe.Extra.values
|> Dict.fromList |> Dict.fromList
linkPattern : Regex.Regex
linkPattern =
Regex.regex "<(.*?)>; rel=\"(.*?)\""