Add types for url-regex 4.0.0 (#14067)

This commit is contained in:
Daniel Perez Alvarez
2017-01-17 21:10:39 +01:00
committed by Mohamed Hegazy
parent c4e848741d
commit bc12eadd2d
4 changed files with 44 additions and 0 deletions

12
url-regex/index.d.ts vendored Normal file
View 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
View 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
View File

@@ -0,0 +1 @@
{ "extends": "../tslint.json" }

View 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());