generated from tpl/purs
fix: pathFromString
This commit is contained in:
parent
b5f8ef0688
commit
57dc73d20b
@ -5,6 +5,7 @@ module Data.URL
|
||||
, (?)
|
||||
, Parts
|
||||
, Path(..)
|
||||
, pathFromString
|
||||
, URL
|
||||
, addHash
|
||||
, addQuery
|
||||
@ -174,22 +175,24 @@ setQuery qs u =
|
||||
in
|
||||
querySetAllImpl asRecord u
|
||||
|
||||
path :: URL -> Path
|
||||
path u =
|
||||
pathFromString :: String -> Path
|
||||
pathFromString s =
|
||||
let
|
||||
pathname = pathnameImpl u
|
||||
segments = filter (not <<< String.null) <<< String.split (wrap "/")
|
||||
in
|
||||
maybe PathEmpty PathAbsolute
|
||||
$ filter (not <<< Array.null)
|
||||
$ Just
|
||||
$ segments pathname
|
||||
$ segments s
|
||||
|
||||
pathSegments :: Path -> Array String
|
||||
pathSegments (PathEmpty) = []
|
||||
pathSegments (PathAbsolute s) = s
|
||||
pathSegments (PathRelative s) = s
|
||||
|
||||
path :: URL -> Path
|
||||
path = pathFromString <<< pathnameImpl
|
||||
|
||||
addSegment :: URL -> String -> URL
|
||||
addSegment u s = resolve (PathRelative [ s ]) u
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user