npm.io
2.0.0 • Published 7 years ago

@njc/url

Licence
ISC
Version
2.0.0
Deps
0
Size
8 kB
Vulns
0
Weekly
0

@njc/url

Simple url parser following RFC 3986, section 3 (2005), Does not depend on other libraries.

Usage

interface Url {

    readonly schema: string;
    readonly userinfo: string;
    readonly host: string;
    readonly port: number;
    readonly path: string;
    readonly query: string;
    readonly fragment: string;

}

/* Uses the base authority and schema with the specified path */
function UrlFrom(base: Url, path: string) : Url
function ParseUrl(url: string): Url
function UrlToString(url: Url): string

Future versions

  • Error checking on the provided string
  • Query as a list and userinfo split

Keywords