-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathindex.d.ts
60 lines (46 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/**
Check if `string` is IPv6 or IPv4.
@example
```
import {isIP} from 'is-ip';
isIP('1:2:3:4:5:6:7:8');
//=> true
isIP('192.168.0.1');
//=> true
```
*/
export function isIP(string: string): boolean; // eslint-disable-line @typescript-eslint/naming-convention
/**
Check if `string` is IPv6.
@example
```
import {isIPv6} from 'is-ip';
isIPv6('1:2:3:4:5:6:7:8');
//=> true
```
*/
export function isIPv6(string: string): boolean; // eslint-disable-line @typescript-eslint/naming-convention
/**
Check if `string` is IPv4.
@example
```
import {isIPv4} from 'is-ip';
isIPv4('192.168.0.1');
//=> true
```
*/
export function isIPv4(string: string): boolean; // eslint-disable-line @typescript-eslint/naming-convention
/**
@returns `6` if `string` is IPv6, `4` if `string` is IPv4, or `undefined` if `string` is neither.
@example
```
import {ipVersion} from 'is-ip';
ipVersion('1:2:3:4:5:6:7:8');
//=> 6
ipVersion('192.168.0.1');
//=> 4
ipVersion('abc');
//=> undefined
```
*/
export function ipVersion(string: string): 6 | 4 | undefined;