mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-24 11:29:30 +08:00
Move to uri namespace
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
/// <reference path="URI.d.ts" />
|
||||
|
||||
new URI();
|
||||
new URI('http://user:pass@example.org:80/foo/bar.html?foo=bar&bar=baz#frag');
|
||||
new URI({
|
||||
protocol: 'http',
|
||||
username: 'user',
|
||||
password: 'pass',
|
||||
hostname: 'example.org',
|
||||
port: '80',
|
||||
path: '/foo/bar.html',
|
||||
query: 'foo=bar&bar=baz',
|
||||
fragment: 'frag'
|
||||
});
|
||||
|
||||
var uri: uri.URI = $('a').uri();
|
||||
Vendored
+206
-171
@@ -1,186 +1,221 @@
|
||||
// Type definitions for URI.js
|
||||
// Project: https://github.com/medialize/URI.js
|
||||
// Definitions by: RodneyJT <https://github.com/RodneyJT>
|
||||
// Definitions by: RodneyJT <https://github.com/RodneyJT>, Brian Surowiec <https://github.com/xt0rted>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
interface URIOptions {
|
||||
protocol?: string;
|
||||
username?: string;
|
||||
password?: string;
|
||||
hostname?: string;
|
||||
port?: string;
|
||||
path?: string;
|
||||
query?: string;
|
||||
fragment?: string;
|
||||
}
|
||||
declare module uri {
|
||||
|
||||
declare class URI {
|
||||
constructor();
|
||||
constructor(uri: string);
|
||||
constructor(options: URIOptions);
|
||||
clone(): URI;
|
||||
href(): string;
|
||||
href(url: string): void;
|
||||
valueOf(): string;
|
||||
scheme(): string;
|
||||
protocol(): string;
|
||||
scheme(protocol: string): URI;
|
||||
protocol(protocol: string): URI;
|
||||
username(): string;
|
||||
username(uname: string): URI;
|
||||
password(): string;
|
||||
password(pw: string): URI;
|
||||
port(): string;
|
||||
port(port: string): URI;
|
||||
hostname(): string;
|
||||
hostname(hostname: string): URI;
|
||||
host(): string;
|
||||
host(host: string): URI;
|
||||
userinfo(): string;
|
||||
userinfo(userinfo: string): URI;
|
||||
authority(): string;
|
||||
authority(authority: string): URI;
|
||||
domain(): string;
|
||||
domain(domain: boolean): string;
|
||||
domain(domain: string): URI;
|
||||
subdomain(): string;
|
||||
subdomain(subdomain: string): URI;
|
||||
tld(): string;
|
||||
tld(tld: boolean): string;
|
||||
tld(tld: string): URI;
|
||||
path(): string;
|
||||
path(path: boolean): string;
|
||||
path(path: string): URI;
|
||||
pathname(): string;
|
||||
pathname(path: boolean): string;
|
||||
pathname(path: string): URI;
|
||||
directory(): string;
|
||||
directory(dir: boolean): string;
|
||||
directory(dir: string): URI;
|
||||
filename(): string;
|
||||
filename(file: boolean): string;
|
||||
filename(file: string): URI;
|
||||
suffix(): string;
|
||||
suffix(suffix: boolean): string;
|
||||
suffix(suffix: string): URI;
|
||||
segment(): string[];
|
||||
segment(segments: string[]): string;
|
||||
segment(position: number): string;
|
||||
segment(position: number, level: string): string;
|
||||
segment(level: string): string;
|
||||
search(): string;
|
||||
search(qry: string): URI;
|
||||
search(qry: boolean): any;
|
||||
search(qry: Object): URI;
|
||||
query(): string;
|
||||
query(qry: string): URI;
|
||||
query(qry: boolean): Object;
|
||||
query(qry: Object): URI;
|
||||
hash(): string;
|
||||
hash(hash: string): URI;
|
||||
fragment(): string;
|
||||
fragment(fragment: string): URI;
|
||||
resource(): string;
|
||||
resource(resource: string): URI;
|
||||
is(qry: string): boolean;
|
||||
addSearch(qry: string): URI;
|
||||
addSearch(qry: Object): URI;
|
||||
addQuery(qry: string): URI;
|
||||
addQuery(qry: Object): URI;
|
||||
removeSearch(qry: string): URI;
|
||||
removeSearch(qry: Object): URI;
|
||||
removeQuery(qry: string): URI;
|
||||
removeQuery(qry: Object): URI;
|
||||
addFragment(fragment: string): URI;
|
||||
//fragmentPrefix: string;
|
||||
fragmentPrefix(prefix: string): URI;
|
||||
normalize(): URI;
|
||||
normalizeProtocol(): URI;
|
||||
normalizeHostname(): URI;
|
||||
normalizePort(): URI;
|
||||
normalizePathname(): URI;
|
||||
normalizePath(): URI;
|
||||
normalizeSearch(): URI;
|
||||
normalizeQuery(): URI;
|
||||
normalizeHash(): URI;
|
||||
normalizeFragment(): URI;
|
||||
iso8859(): URI;
|
||||
unicode(): URI;
|
||||
readable(): string;
|
||||
relativeTo(path: string): URI;
|
||||
absoluteTo(path: string): URI;
|
||||
equals(): boolean;
|
||||
equals(url: string): boolean;
|
||||
static parse(url: string): {
|
||||
protocol: string;
|
||||
username: string;
|
||||
password: string;
|
||||
hostname: string;
|
||||
port: string;
|
||||
path: string;
|
||||
query: string;
|
||||
fragment: string;
|
||||
};
|
||||
static parseAuthority(url: string, parts: {
|
||||
interface URI {
|
||||
absoluteTo(path: string): URI;
|
||||
addFragment(fragment: string): URI;
|
||||
addQuery(qry: string): URI;
|
||||
addQuery(qry: Object): URI;
|
||||
addSearch(qry: string): URI;
|
||||
addSearch(qry: Object): URI;
|
||||
authority(): string;
|
||||
authority(authority: string): URI;
|
||||
|
||||
clone(): URI;
|
||||
|
||||
directory(): string;
|
||||
directory(dir: boolean): string;
|
||||
directory(dir: string): URI;
|
||||
domain(): string;
|
||||
domain(domain: boolean): string;
|
||||
domain(domain: string): URI;
|
||||
|
||||
equals(): boolean;
|
||||
equals(url: string): boolean;
|
||||
|
||||
filename(): string;
|
||||
filename(file: boolean): string;
|
||||
filename(file: string): URI;
|
||||
fragment(): string;
|
||||
fragment(fragment: string): URI;
|
||||
fragmentPrefix(prefix: string): URI;
|
||||
|
||||
hash(): string;
|
||||
hash(hash: string): URI;
|
||||
host(): string;
|
||||
host(host: string): URI;
|
||||
hostname(): string;
|
||||
hostname(hostname: string): URI;
|
||||
href(): string;
|
||||
href(url: string): void;
|
||||
|
||||
is(qry: string): boolean;
|
||||
iso8859(): URI;
|
||||
|
||||
normalize(): URI;
|
||||
normalizeFragment(): URI;
|
||||
normalizeHash(): URI;
|
||||
normalizeHostname(): URI;
|
||||
normalizePath(): URI;
|
||||
normalizePathname(): URI;
|
||||
normalizePort(): URI;
|
||||
normalizeProtocol(): URI;
|
||||
normalizeQuery(): URI;
|
||||
normalizeSearch(): URI;
|
||||
|
||||
password(): string;
|
||||
password(pw: string): URI;
|
||||
path(): string;
|
||||
path(path: boolean): string;
|
||||
path(path: string): URI;
|
||||
pathname(): string;
|
||||
pathname(path: boolean): string;
|
||||
pathname(path: string): URI;
|
||||
port(): string;
|
||||
port(port: string): URI;
|
||||
protocol(): string;
|
||||
protocol(protocol: string): URI;
|
||||
|
||||
query(): string;
|
||||
query(qry: string): URI;
|
||||
query(qry: boolean): Object;
|
||||
query(qry: Object): URI;
|
||||
|
||||
readable(): string;
|
||||
relativeTo(path: string): URI;
|
||||
removeQuery(qry: string): URI;
|
||||
removeQuery(qry: Object): URI;
|
||||
removeSearch(qry: string): URI;
|
||||
removeSearch(qry: Object): URI;
|
||||
resource(): string;
|
||||
resource(resource: string): URI;
|
||||
|
||||
scheme(): string;
|
||||
scheme(protocol: string): URI;
|
||||
search(): string;
|
||||
search(qry: string): URI;
|
||||
search(qry: boolean): any;
|
||||
search(qry: Object): URI;
|
||||
segment(): string[];
|
||||
segment(segments: string[]): string;
|
||||
segment(position: number): string;
|
||||
segment(position: number, level: string): string;
|
||||
segment(level: string): string;
|
||||
subdomain(): string;
|
||||
subdomain(subdomain: string): URI;
|
||||
suffix(): string;
|
||||
suffix(suffix: boolean): string;
|
||||
suffix(suffix: string): URI;
|
||||
|
||||
tld(): string;
|
||||
tld(tld: boolean): string;
|
||||
tld(tld: string): URI;
|
||||
|
||||
unicode(): URI;
|
||||
userinfo(): string;
|
||||
userinfo(userinfo: string): URI;
|
||||
username(): string;
|
||||
username(uname: string): URI;
|
||||
|
||||
valueOf(): string;
|
||||
}
|
||||
|
||||
interface URIOptions {
|
||||
protocol?: string;
|
||||
username?: string;
|
||||
password?: string;
|
||||
hostname?: string;
|
||||
port?: string;
|
||||
}): string;
|
||||
static parseUserinfo(url: string, parts: {
|
||||
username?: string;
|
||||
password?: string;
|
||||
}): string;
|
||||
static parseHost(url: string, parts: {
|
||||
hostname?: string;
|
||||
port?: string;
|
||||
}): string;
|
||||
static parseQuery(url: string): Object;
|
||||
static build(parts: {
|
||||
protocol: string;
|
||||
username: string;
|
||||
password: string;
|
||||
hostname: string;
|
||||
port: string;
|
||||
path: string;
|
||||
query: string;
|
||||
fragment: string;
|
||||
}): string;
|
||||
static buildAuthority(parts: {
|
||||
username?: string;
|
||||
password?: string;
|
||||
hostname?: string;
|
||||
port?: string;
|
||||
}): string;
|
||||
static buildUserinfo(parts: {
|
||||
username?: string;
|
||||
password?: string;
|
||||
}): string;
|
||||
static buildHost(parts: {
|
||||
hostname?: string;
|
||||
port?: string;
|
||||
}): string;
|
||||
static buildQuery(qry: Object): string;
|
||||
static buildQuery(qry: Object, duplicates: boolean): string;
|
||||
static encode(str: string): string;
|
||||
static decode(str: string): string;
|
||||
static encodeReserved(str: string): string;
|
||||
static encodeQuery(qry: string): string;
|
||||
static decodeQuery(qry: string): string;
|
||||
static addQuery(data: Object, prop: string, value: string): Object;
|
||||
static addQuery(data: Object, qryObj: Object): Object;
|
||||
static removeQuery(data: Object, prop: string, value: string): Object;
|
||||
static removeQuery(data: Object, props: string[]): Object;
|
||||
static removeQuery(data: Object, props: Object): Object;
|
||||
static commonPath(path1: string, path2: string): string;
|
||||
static withinString(source: string, func: (url: string) => string): string;
|
||||
static iso8859(): void;
|
||||
static unicode(): void;
|
||||
static expand(template: string, vals: Object): URI;
|
||||
path?: string;
|
||||
query?: string;
|
||||
fragment?: string;
|
||||
}
|
||||
|
||||
interface URIStatic {
|
||||
new (): URI;
|
||||
new (value: string | URIOptions): URI;
|
||||
|
||||
addQuery(data: Object, prop: string, value: string): Object;
|
||||
addQuery(data: Object, qryObj: Object): Object;
|
||||
|
||||
build(parts: {
|
||||
protocol: string;
|
||||
username: string;
|
||||
password: string;
|
||||
hostname: string;
|
||||
port: string;
|
||||
path: string;
|
||||
query: string;
|
||||
fragment: string;
|
||||
}): string;
|
||||
buildAuthority(parts: {
|
||||
username?: string;
|
||||
password?: string;
|
||||
hostname?: string;
|
||||
port?: string;
|
||||
}): string;
|
||||
buildHost(parts: {
|
||||
hostname?: string;
|
||||
port?: string;
|
||||
}): string;
|
||||
buildQuery(qry: Object): string;
|
||||
buildQuery(qry: Object, duplicates: boolean): string;
|
||||
buildUserinfo(parts: {
|
||||
username?: string;
|
||||
password?: string;
|
||||
}): string;
|
||||
|
||||
commonPath(path1: string, path2: string): string;
|
||||
|
||||
decode(str: string): string;
|
||||
decodeQuery(qry: string): string;
|
||||
|
||||
encode(str: string): string;
|
||||
encodeQuery(qry: string): string;
|
||||
encodeReserved(str: string): string;
|
||||
expand(template: string, vals: Object): URI;
|
||||
|
||||
iso8859(): void;
|
||||
|
||||
parse(url: string): {
|
||||
protocol: string;
|
||||
username: string;
|
||||
password: string;
|
||||
hostname: string;
|
||||
port: string;
|
||||
path: string;
|
||||
query: string;
|
||||
fragment: string;
|
||||
};
|
||||
parseAuthority(url: string, parts: {
|
||||
username?: string;
|
||||
password?: string;
|
||||
hostname?: string;
|
||||
port?: string;
|
||||
}): string;
|
||||
parseHost(url: string, parts: {
|
||||
hostname?: string;
|
||||
port?: string;
|
||||
}): string;
|
||||
parseQuery(url: string): Object;
|
||||
parseUserinfo(url: string, parts: {
|
||||
username?: string;
|
||||
password?: string;
|
||||
}): string;
|
||||
|
||||
removeQuery(data: Object, prop: string, value: string): Object;
|
||||
removeQuery(data: Object, props: string[]): Object;
|
||||
removeQuery(data: Object, props: Object): Object;
|
||||
|
||||
unicode(): void;
|
||||
|
||||
withinString(source: string, func: (url: string) => string): string;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
uri(): URI;
|
||||
uri(): uri.URI;
|
||||
}
|
||||
|
||||
declare var URI: uri.URIStatic;
|
||||
|
||||
declare module 'URI' {
|
||||
export = URI;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user