mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-04 17:20:09 +00:00
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:
5
types/url-regex/index.d.ts
vendored
5
types/url-regex/index.d.ts
vendored
@@ -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;
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user