forked from sindresorhus/get-urls
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
49 lines (35 loc) · 1.18 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import {Options as NormalizeUrlOptions} from 'normalize-url';
declare namespace getUrls {
interface Options extends NormalizeUrlOptions {
/**
Extract URLs that appear as query parameters in the found URLs.
@default false
*/
readonly extractFromQueryString?: boolean;
/**
Exclude URLs that match URLs in the given array.
@default []
*/
readonly exclude?: string[];
/**
Require URLs to have a scheme or leading `www.` to be considered an URL. When `false`, matches against a list of valid TLDs, so it will match URLs like `unicorn.education`.
Does not affect URLs in query parameters if using the `extractFromQueryString` option.
@default false
*/
readonly requireSchemeOrWww?: boolean;
}
}
/**
Get all URLs in a string.
The URLs will be [normalized](https://github.com/sindresorhus/normalize-url).
@returns A `Set` of URLs.
@example
```
import getUrls = require('get-urls');
const text = 'Lorem ipsum dolor sit amet, //sindresorhus.com consectetuer adipiscing http://yeoman.io elit.';
getUrls(text);
//=> Set {'http://sindresorhus.com', 'http://yeoman.io'}
```
*/
declare function getUrls(text: string, options?: getUrls.Options): Set<string>;
export = getUrls;