mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
Added declarations for 'urlparser'
This commit is contained in:
Vendored
+38
@@ -0,0 +1,38 @@
|
||||
// Type definitions for urlparser 0.2
|
||||
// Project: https://github.com/kaerus-component/urlparser
|
||||
// Definitions by: OpenByteDev <https://github.com/OpenByteDev>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
interface UrlData {
|
||||
host: {
|
||||
protocol: string;
|
||||
username: string;
|
||||
password: string;
|
||||
hostname: string;
|
||||
port: string|number;
|
||||
};
|
||||
path: {
|
||||
base: string;
|
||||
name: string;
|
||||
hash: string;
|
||||
};
|
||||
query: {
|
||||
parts: string[];
|
||||
params: object;
|
||||
};
|
||||
toString: () => string;
|
||||
}
|
||||
|
||||
interface UrlParser {
|
||||
url: (o: UrlData|undefined) => string;
|
||||
host: (o: UrlData|undefined) => string;
|
||||
path: (o: UrlData|undefined) => string;
|
||||
query: (o: UrlData|undefined) => string;
|
||||
parse: (parse: string) => UrlData;
|
||||
}
|
||||
|
||||
declare const urlParser: UrlParser;
|
||||
|
||||
export = urlParser;
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"urlparser-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import url = require('urlparser');
|
||||
|
||||
const u = url.parse('http://user:pass@kaerus.com/login?x=42');
|
||||
u.host.hostname = 'database.kaerus.com';
|
||||
u.host.password = 'secret';
|
||||
u.host.port = 8529;
|
||||
u.query.parts.push('a=13');
|
||||
u.toString();
|
||||
Reference in New Issue
Block a user