11-- | This module defines bindings to the Node URL and Query String APIs.
22
33module Node.URL where
4-
4+
55import Data.Nullable
6-
6+
77-- | A query object is a JavaScript object whose values are strings or arrays of strings.
88-- |
99-- | It is intended that the user coerce values of this type to/from some trusted representation via
1010-- | e.g. `Data.Foreign` or `Unsafe.Coerce`..
1111data Query
12-
12+
1313-- | A URL object.
1414-- |
15- -- | All fields are nullable, and will be missing if the URL string passed to
15+ -- | All fields are nullable, and will be missing if the URL string passed to
1616-- | `parse` did not contain the appropriate URL part.
17- type URL =
17+ type URL =
1818 { protocol :: Nullable String
19- , slashes :: Nullable Boolean
20- , host :: Nullable String
21- , auth :: Nullable String
19+ , slashes :: Nullable Boolean
20+ , host :: Nullable String
21+ , auth :: Nullable String
2222 , hostname :: Nullable String
23- , port :: Nullable String
23+ , port :: Nullable String
2424 , pathname :: Nullable String
25- , search :: Nullable String
26- , path :: Nullable String
27- , query :: Nullable String
28- , hash :: Nullable String
25+ , search :: Nullable String
26+ , path :: Nullable String
27+ , query :: Nullable String
28+ , hash :: Nullable String
2929 }
30-
30+
3131-- | Parse a URL string into a URL object.
3232foreign import parse :: String -> URL
33-
33+
3434-- | Format a URL object as a URL string.
3535foreign import format :: URL -> String
3636
@@ -41,4 +41,4 @@ foreign import resolve :: String -> String -> String
4141foreign import parseQueryString :: String -> Query
4242
4343-- | Convert a query string to an object.
44- foreign import toQueryString :: Query -> String
44+ foreign import toQueryString :: Query -> String
0 commit comments