-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- correctly type normalization options - correctly type parsed url - add type tests via tsd - add types for ES6 module export
- Loading branch information
1 parent
a75e66f
commit e16fd98
Showing
5 changed files
with
2,144 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import parseUrl = require("./index"); | ||
|
||
export type ParsedUrl = parseUrl.ParsedUrl; | ||
export type NormalizeOptions = parseUrl.NormalizeOptions; | ||
export type ParsingError = parseUrl.ParsingError; | ||
|
||
export default parseUrl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,21 @@ | ||
declare interface ParsedUrl { | ||
protocols: string[]; | ||
protocol: string; | ||
port?: string; | ||
resource: string; | ||
user: string; | ||
pathname: string; | ||
hash: string; | ||
search: string; | ||
href: string; | ||
query: { | ||
[key: string]: any; | ||
} | ||
import parsePath = require("parse-path"); | ||
import normalizeUrl = require("normalize-url"); | ||
|
||
declare namespace parseUrl { | ||
const MAX_INPUT_LENGTH: 2048; | ||
|
||
type NormalizeOptions = normalizeUrl.Options; | ||
|
||
type ParsedUrl = parsePath.ParsedPath; | ||
|
||
interface ParsingError extends Error { | ||
readonly subject_url: string; | ||
} | ||
} | ||
|
||
declare function parseUrl(url: string, normalize?: boolean | Object): ParsedUrl; | ||
declare function parseUrl( | ||
url: string, | ||
normalize?: boolean | parseUrl.NormalizeOptions | ||
): parseUrl.ParsedUrl; | ||
|
||
export = parseUrl | ||
export = parseUrl; |
Oops, something went wrong.