import { stringifyUrl } from "https://deno.land/x/querystring@v1.0.2/types.d.ts";
Stringify an object into a URL with a query string and sorting the keys. The inverse of .parseUrl()
Query items in the query
property overrides queries in the url
property.
The fragmentIdentifier
property overrides the fragment identifier in the url
property.
Examples
Example 1
Example 1
queryString.stringifyUrl({url: 'https://foo.bar', query: {foo: 'bar'}});
//=> 'https://foo.bar?foo=bar'
queryString.stringifyUrl({url: 'https://foo.bar?foo=baz', query: {foo: 'bar'}});
//=> 'https://foo.bar?foo=bar'
queryString.stringifyUrl({
url: 'https://foo.bar',
query: {
top: 'foo'
},
fragmentIdentifier: 'bar'
});
//=> 'https://foo.bar?top=foo#bar'
Parameters
object: UrlObject
optional
options: StringifyOptions