@stacksjs/whois 0.66.0 → 0.67.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/types.ts DELETED
@@ -1,97 +0,0 @@
1
- /**
2
- * Response returned from whois function. Contains the raw text from WhoIs server and parsed/fornatted WhoIs data (if parsed is true)
3
- *
4
- * @interface
5
- */
6
- export interface WhoIsResponse {
7
- /**
8
- * Raw text response from WhoIs server
9
- */
10
- _raw: string
11
- /**
12
- * Parsed/Formatted key-value pairs of the response (if parsed is true)
13
- */
14
- parsedData: any | null
15
- }
16
-
17
- /**
18
- * Type of the proxy. Either SOCKS4 or SOCKS5
19
- * @enum
20
- */
21
- export enum ProxyType {
22
- /**
23
- * SOCKS4 type of proxy
24
- */
25
- SOCKS4 = 0,
26
- /**
27
- * SOCKS5 type of proxy
28
- */
29
- SOCKS5 = 1,
30
- }
31
-
32
- /**
33
- * Proxy related data
34
- * @interface
35
- *
36
- */
37
- export interface ProxyData {
38
- /**
39
- * Proxy IP
40
- */
41
- ip: string
42
- /**
43
- * Proxy port
44
- */
45
- port: number
46
- /**
47
- * Username to connect to the proxy
48
- */
49
- username?: string | null
50
- /**
51
- * Password to connect to the proxy
52
- */
53
- password?: string | null
54
- /**
55
- * {@link ProxyType}
56
- */
57
- type: ProxyType
58
- }
59
-
60
- /**
61
- * WhoIs options
62
- * @interface
63
- */
64
- export interface WhoIsOptions {
65
- /**
66
- * TLD of the domain. If the {@link tld} is not provided (or null), then it will be automatically determined as to the given domain name
67
- */
68
- tld?: string | null
69
- /**
70
- * The encoding type used for WhoIs server and response. By default UTF-8 is used.
71
- */
72
- encoding?: string | null
73
-
74
- /** {@link ProxyData} */
75
- proxy?: ProxyData | null
76
- /**
77
- * The WhoIs server to collect data from. If not provided, the server will automatically determined using the {@link tld}
78
- */
79
- server?: string | null
80
- /**
81
- * The port of the WhoIs server. By default, port 43 is used.
82
- */
83
- serverPort?: number | null
84
- /**
85
- * Which data needs to be extracted/parsed from the WhoIs response.
86
- * An object can be passed which contains keys of the fields of the WhoIs response.
87
- * A copy of the provided object will be returned with the values filled for the provided keys.
88
- *
89
- * The keys can have default value of empty string. However, if the WhoIs response has multiple values for the same field (eg: 'Domain Status'),
90
- * then all the values can be collected by providing a default value of an Array([]).
91
- *
92
- * Following example shows an object used to collect 'Domain Name', 'Domain Status' (multiple values) and 'Registrar' from WhoIs response
93
- *
94
- * @example {'Domain Name': '', 'Domain Status': [], 'Registrar': ''}
95
- */
96
- parseData?: object | null
97
- }
package/src/utils.ts DELETED
@@ -1,22 +0,0 @@
1
- /**
2
- * Copy an Object with its values
3
- *
4
- * @param obj Object which needs to be copied
5
- * @returns A copy of the object
6
- */
7
- export function shallowCopy<T>(obj: T): T {
8
- if (Array.isArray(obj)) {
9
- return obj.slice() as T // Clone the array
10
- }
11
-
12
- if (typeof obj === 'object' && obj !== null) {
13
- const copy: any = {}
14
- for (const key in obj) {
15
- if (Object.prototype.hasOwnProperty.call(obj, key))
16
- copy[key] = shallowCopy(obj[key])
17
- }
18
- return copy as T
19
- }
20
-
21
- return obj // For primitive values, return as is
22
- }