-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
74 lines (37 loc) · 2.81 KB
/
test.js
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
defangjs v1.0.7
@Repository: https://github.com/edoardottt/defangjs
@Author: edoardottt, https://www.edoardoottavianelli.it
@License: https://github.com/edoardottt/defangjs/blob/main/LICENSE
npm test OR node test.js
*/
var defangjs = require('./index.js');
console.log("[ HTTPS:// ]: " + defangjs.Url("https://github.com/edoardottt/defangjs") + "\n");
console.log("[ HTTPS:// ]: " + defangjs.Url("https://www.edoardoottavianelli.it") + "\n");
console.log("[ HTTPS:// ]: " + defangjs.Url("https://very.bad.url.com:666/") + "\n");
console.log("[ HTTP:// ]: " + defangjs.Url("http://github.com/edoardottt/defangjs") + "\n");
console.log("[ HTTP:// ]: " + defangjs.Url("http://www.edoardoottavianelli.it") + "\n");
console.log("[ HTTP:// ]: " + defangjs.Url("http://very.bad.url.com:666/") + "\n");
console.log("[ FTP:// ]: " + defangjs.Url("ftp://github.com/edoardottt/defangjs") + "\n");
console.log("[ FTP:// ]: " + defangjs.Url("ftp://www.edoardoottavianelli.it") + "\n");
console.log("[ FTP:// ]: " + defangjs.Url("ftp://very.bad.url.com:666/") + "\n");
console.log("[ FILE:// ]: " + defangjs.Url("file:///etc/hosts") + "\n");
console.log("[ :// ]: " + defangjs.Url("://github.com/edoardottt/defangjs") + "\n");
console.log("[ :// ]: " + defangjs.Url("://www.edoardoottavianelli.it") + "\n");
console.log("[ :// ]: " + defangjs.Url("://very.bad.url.com:666/") + "\n");
console.log("[ // ]: " + defangjs.Url("//github.com/edoardottt/defangjs") + "\n");
console.log("[ // ]: " + defangjs.Url("//www.edoardoottavianelli.it") + "\n");
console.log("[ // ]: " + defangjs.Url("//very.bad.url.com:666/") + "\n");
console.log("[ NO PROTOCOL ]: " + defangjs.Url("github.com/edoardottt/defangjs") + "\n");
console.log("[ NO PROTOCOL ]: " + defangjs.Url("www.edoardoottavianelli.it") + "\n");
console.log("[ NO PROTOCOL ]: " + defangjs.Url("very.bad.url.com:666/") + "\n");
console.log("[ IPv4 ]: " + defangjs.Ip("8.8.8.8") + "\n");
console.log("[ SHORT IPv4 ]: " + defangjs.Ip("127.1") + "\n");
console.log("[ IPv4 ]: " + defangjs.Ip("8.8.8.8:53") + "\n");
console.log("[ SHORT IPv4 ]: " + defangjs.Ip("127.1:80") + "\n");
console.log("[ IPv6 ]: " + defangjs.Ip("2001:0db8:85a3:0000:0000:8a2e:0370:7334") + "\n");
console.log("[ SHORT IPv6 ]: " + defangjs.Ip("2001:0db8:85a3::8a2e:0370:7334") + "\n");
console.log("[ IPv6 ]: " + defangjs.Ip("[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:8080") + "\n");
console.log("[ SHORT IPv6 ]: " + defangjs.Ip("[2001:0db8:85a3::8a2e:0370:7334]:8080") + "\n");
console.log("[ EMAIL ]: " + defangjs.Email("edoardott@gmail.com") + "\n");
console.log("[ EMAIL ]: " + defangjs.Email("mailto:edoardott@gmail.com") + "\n");