DefinitelyTyped/types/url-parse/url-parse-tests.ts
wd39 5669dfcdbc Adding type definitions for url-parse npm package (#20233)
* Adding typings for url-parse

* Fixup! import URLSearchParams types

* Adding typings for parse function

* Changes to tsconfig and tslint

* Fixes to the type definitions

* Adding missing tslint file

* Fixing the typos in the header

* Exporting object in a diferent way, adding one more constructor signature and relevant tests

* Removing unnecessary lines from typedef
2017-10-04 11:14:33 -07:00

19 lines
553 B
TypeScript

import parse = require("url-parse");
const url1 = new URL("foo/bar", "https://github.com/");
const url2 = parse("https://github.com/foo/bar?baz=true");
const url3 = parse("https://github.com/foo/bar", true, true);
const url4 = parse("foo/bar", "https://github.com/");
const url5 = parse("foo/bar", "https://github.com/", () => "queryParserOverride");
url2.hash;
url2.hostname;
url2.query.baz;
url3.slashes;
url3.set("protocol", "http://");
parse.extractProtocol("https://github.com/foo/bar");
parse.location("https://github.com/foo/bar");
parse.qs;