-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.d.ts
45 lines (41 loc) · 1.02 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
declare namespace onionRegex {
interface Options {
/**
Only match an exact string. By default, it matches any onion links in a string. Useful with `RegExp#test()` to check if a string is an onion link.
@default false
*/
readonly exact?: boolean;
}
}
declare const onionRegex: {
/**
Returns a regex for matching version 2 (v2) onion links.
@example
```
import onionRegex = require('onion-regex');
onionRegex.v2({exact: true}).test('xmh57jrzrnw6insl.onion');
//=> true
```
*/
v2: (options?: onionRegex.Options) => RegExp;
/**
Returns a regex for matching version 3 (v3) onion links.
@example
```
onionRegex.v3({exact: true}).test('vww6ybal4bd7szmgncyruucpgfkqahzddi37ktceo3ah7ngmcopnpyyd.onion');
//=> true
```
*/
v3: (options?: onionRegex.Options) => RegExp;
/**
Returns a regex for matching onion links.
@example
```
import onionRegex = require('onion-regex');
onionRegex().test('nodejsrocks xmh57jrzrnw6insl.onion');
//=> true
```
*/
(options?: onionRegex.Options): RegExp;
};
export = onionRegex;