Add types for url-regex 4.0.0 (#14067)

This commit is contained in:
Daniel Perez Alvarez
2017-01-17 12:10:39 -08:00
committed by Mohamed Hegazy
parent c4e848741d
commit bc12eadd2d
4 changed files with 44 additions and 0 deletions
+12
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
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
View File
@@ -0,0 +1 @@
{ "extends": "../tslint.json" }
+11
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());