mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-21 05:20:24 +08:00
Add types for url-regex 4.0.0 (#14067)
This commit is contained in:
committed by
Mohamed Hegazy
parent
c4e848741d
commit
bc12eadd2d
12
url-regex/index.d.ts
vendored
Normal file
12
url-regex/index.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
// Type definitions for url-regex 4.0
|
||||
// Project: https://github.com/kevva/url-regex
|
||||
// Definitions by: Daniel Perez Alvarez <https://github.com/unindented>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/** Regular expression for matching URLs. */
|
||||
declare function urlRegex(options?: {
|
||||
/** Only match an exact string. Useful with RegExp#test to check if a string is a URL. */
|
||||
exact?: boolean;
|
||||
}): RegExp;
|
||||
|
||||
export = urlRegex;
|
||||
20
url-regex/tsconfig.json
Normal file
20
url-regex/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"url-regex-tests.ts"
|
||||
]
|
||||
}
|
||||
1
url-regex/tslint.json
Normal file
1
url-regex/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
11
url-regex/url-regex-tests.ts
Normal file
11
url-regex/url-regex-tests.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import urlRegex = require('url-regex');
|
||||
|
||||
urlRegex().test('http://github.com foo bar');
|
||||
|
||||
urlRegex().test('www.github.com foo bar');
|
||||
|
||||
urlRegex({exact: true}).test('http://github.com foo bar');
|
||||
|
||||
urlRegex({exact: true}).test('http://github.com');
|
||||
|
||||
'foo http://github.com bar //google.com'.match(urlRegex());
|
||||
Reference in New Issue
Block a user