diff --git a/url-regex/index.d.ts b/url-regex/index.d.ts new file mode 100644 index 0000000000..ed51c6e34d --- /dev/null +++ b/url-regex/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for url-regex 4.0 +// Project: https://github.com/kevva/url-regex +// Definitions by: Daniel Perez Alvarez +// 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; diff --git a/url-regex/tsconfig.json b/url-regex/tsconfig.json new file mode 100644 index 0000000000..944db02afc --- /dev/null +++ b/url-regex/tsconfig.json @@ -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" + ] +} diff --git a/url-regex/tslint.json b/url-regex/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/url-regex/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/url-regex/url-regex-tests.ts b/url-regex/url-regex-tests.ts new file mode 100644 index 0000000000..e7063604b6 --- /dev/null +++ b/url-regex/url-regex-tests.ts @@ -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());