mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Add mdurl (#20581)
* Add mdurl * Add strictFunctionTypes property to tsconfig
This commit is contained in:
parent
265c894983
commit
7e936df852
7
types/mdurl/decode.d.ts
vendored
Normal file
7
types/mdurl/decode.d.ts
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
declare namespace decode {
|
||||
const defaultChars: string;
|
||||
const componentChars: string;
|
||||
}
|
||||
declare function decode(input: string, exclude?: string): string;
|
||||
|
||||
export = decode;
|
||||
7
types/mdurl/encode.d.ts
vendored
Normal file
7
types/mdurl/encode.d.ts
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
declare namespace encode {
|
||||
const defaultChars: string;
|
||||
const componentChars: string;
|
||||
}
|
||||
declare function encode(str: string, exclude?: string, keepEscaped?: boolean): string;
|
||||
|
||||
export = encode;
|
||||
5
types/mdurl/format.d.ts
vendored
Normal file
5
types/mdurl/format.d.ts
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
import { Url } from './'
|
||||
|
||||
declare function format(url: Url): string;
|
||||
|
||||
export = format;
|
||||
26
types/mdurl/index.d.ts
vendored
Normal file
26
types/mdurl/index.d.ts
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
// Type definitions for mdurl 1.0
|
||||
// Project: https://github.com/markdown-it/mdurl#readme
|
||||
// Definitions by: Junyoung Choi <https://github.com/rokt33r>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
import encode = require('./encode');
|
||||
import decode = require('./decode');
|
||||
import parse = require('./parse');
|
||||
import format = require('./format');
|
||||
|
||||
export interface Url {
|
||||
protocol: string;
|
||||
slashes: string;
|
||||
auth: string;
|
||||
port: string;
|
||||
hostname: string;
|
||||
hash: string;
|
||||
search: string;
|
||||
pathname: string;
|
||||
}
|
||||
|
||||
export {
|
||||
encode,
|
||||
decode,
|
||||
parse,
|
||||
format
|
||||
};
|
||||
32
types/mdurl/mdurl-tests.ts
Normal file
32
types/mdurl/mdurl-tests.ts
Normal file
@ -0,0 +1,32 @@
|
||||
import mdurl = require('mdurl');
|
||||
import { Url } from 'mdurl';
|
||||
|
||||
const encoded: string = mdurl.encode('%%%');
|
||||
// return '%25%25%25'
|
||||
|
||||
const decoded: string = mdurl.decode(encoded);
|
||||
// return '%%%'
|
||||
|
||||
const url: Url = mdurl.parse('HTTP://www.example.com/');
|
||||
// return {
|
||||
// 'protocol': 'HTTP:',
|
||||
// 'slashes': true,
|
||||
// 'hostname': 'www.example.com',
|
||||
// 'pathname': '/'
|
||||
// } as Url
|
||||
|
||||
const urlStr: string = mdurl.format(url);
|
||||
// 'HTTP://www.example.com/'
|
||||
|
||||
import encode = require('mdurl/encode');
|
||||
import decode = require('mdurl/decode');
|
||||
import parse = require('mdurl/parse');
|
||||
import format = require('mdurl/format');
|
||||
|
||||
const encoded2: string = encode('%%%');
|
||||
|
||||
const decoded2: string = decode(encoded);
|
||||
|
||||
const url2: Url = parse('HTTP://www.example.com/');
|
||||
|
||||
const urlStr2: string = format(url);
|
||||
5
types/mdurl/parse.d.ts
vendored
Normal file
5
types/mdurl/parse.d.ts
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
import { Url } from './'
|
||||
|
||||
declare function parse(input: string, slashesDenoteHost?: boolean): Url;
|
||||
|
||||
export = parse;
|
||||
23
types/mdurl/tsconfig.json
Normal file
23
types/mdurl/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strictFunctionTypes": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"mdurl-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/mdurl/tslint.json
Normal file
1
types/mdurl/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user