mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Add type definitions for ale-url-parser package
This commit is contained in:
parent
974c120127
commit
fd7d98e19d
22
types/ale-url-parser/ale-url-parser-tests.ts
Normal file
22
types/ale-url-parser/ale-url-parser-tests.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { parse, stringify } from 'ale-url-parser';
|
||||
|
||||
let url;
|
||||
let urlObject;
|
||||
|
||||
url = stringify({});
|
||||
console.log(url);
|
||||
|
||||
url = stringify({
|
||||
protocol: 'protocol',
|
||||
host: 'host',
|
||||
path: ['foo', 'bar', 'baz'],
|
||||
hash: 'hash',
|
||||
query: {
|
||||
foo: 1,
|
||||
bar: [2, '3']
|
||||
}
|
||||
});
|
||||
console.log(url);
|
||||
|
||||
urlObject = parse('//any.dom.ain.co.m/foo/bar?test=1&test=2#hash');
|
||||
console.log(urlObject);
|
||||
29
types/ale-url-parser/index.d.ts
vendored
Normal file
29
types/ale-url-parser/index.d.ts
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
// Type definitions for ale-url-parser 0.10
|
||||
// Project: https://github.com/msn0/ale-url-parser#readme
|
||||
// Definitions by: Michał Jezierski <https://github.com/msn0>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
export interface QueryParams {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export interface UrlObject {
|
||||
protocol?: string;
|
||||
host?: string;
|
||||
path?: string[];
|
||||
query?: QueryParams;
|
||||
hash?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse url string into url object.
|
||||
* @return UrlObject
|
||||
*/
|
||||
export function parse(url: string): UrlObject;
|
||||
|
||||
/**
|
||||
* Stringify url object into url string.
|
||||
* @return string
|
||||
*/
|
||||
export function stringify(urlObject: UrlObject): string;
|
||||
24
types/ale-url-parser/tsconfig.json
Normal file
24
types/ale-url-parser/tsconfig.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ale-url-parser-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/ale-url-parser/tslint.json
Normal file
1
types/ale-url-parser/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user