Update url-regex for strict option. (#27487)

* Update url-regex/index.d.ts

* Add my name as comment

* Increase the version number

* Remove patch version
This commit is contained in:
Sosuke Suzuki
2018-07-31 01:34:35 +09:00
committed by Andy
parent 8b576a265d
commit 3228beff2f
2 changed files with 6 additions and 1 deletions

View File

@@ -1,12 +1,15 @@
// Type definitions for url-regex 4.0
// Type definitions for url-regex 4.1
// Project: https://github.com/kevva/url-regex
// Definitions by: Daniel Perez Alvarez <https://github.com/unindented>
// sosukesuzuki <https://github.com/sosukesuzuki>
// 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;
/** Force URLs to start with a valid protocol or www. If set to false it'll match the TLD against a list of valid TLDs(https://github.com/stephenmathieson/node-tlds). */
strict?: boolean;
}): RegExp;
export = urlRegex;

View File

@@ -8,4 +8,6 @@ urlRegex({exact: true}).test('https://github.com foo bar');
urlRegex({exact: true}).test('https://github.com');
urlRegex({exact: true, strict: false}).test('github.com');
'foo https://github.com bar //google.com'.match(urlRegex());