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": {
"elm-community/maybe-extra": "4.0.0 <= v < 5.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-version": "0.18.0 <= v < 0.19.0"

View file

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

View file

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