@cleandns/whois-rdap 1.0.19 → 1.0.20

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/dist/index.js CHANGED
@@ -12,7 +12,7 @@ const eventMap = new Map([
12
12
  ]);
13
13
  export async function whois(origDomain, options = { fetch: fetch, thinOnly: false }) {
14
14
  var _a, _b, _c, _d, _e, _f;
15
- const fetch = options.fetch;
15
+ const _fetch = options.fetch || fetch;
16
16
  let domain = origDomain;
17
17
  let url = null;
18
18
  [domain, url] = await tldToRdap(origDomain);
@@ -32,7 +32,7 @@ export async function whois(origDomain, options = { fetch: fetch, thinOnly: fals
32
32
  }
33
33
  const thinRdap = `${url}/domain/${domain}`;
34
34
  // console.log(`fetching thin RDAP: ${thinRdap}`);
35
- let thinResponse = await fetch(thinRdap)
35
+ let thinResponse = await _fetch(thinRdap)
36
36
  .then((r) => r.json())
37
37
  .catch(() => null);
38
38
  if (thinResponse && !thinResponse.errorCode) {
@@ -50,7 +50,7 @@ export async function whois(origDomain, options = { fetch: fetch, thinOnly: fals
50
50
  let thickResponse = null;
51
51
  if (!options.thinOnly && thickRdap) {
52
52
  // console.log(`fetching thick RDAP: ${thickRdap}`);
53
- thickResponse = await fetch(thickRdap)
53
+ thickResponse = await _fetch(thickRdap)
54
54
  .then((r) => r.json())
55
55
  .catch(() => null);
56
56
  if (thickResponse && !thickResponse.errorCode && !thickResponse.error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cleandns/whois-rdap",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/index.ts CHANGED
@@ -17,7 +17,7 @@ export async function whois(
17
17
  origDomain: string,
18
18
  options: WhoisOptions = { fetch: fetch, thinOnly: false }
19
19
  ): Promise<WhoisResponse> {
20
- const fetch = options.fetch!;
20
+ const _fetch = options.fetch || fetch;
21
21
 
22
22
  let domain = origDomain;
23
23
  let url: string | null = null;
@@ -43,7 +43,7 @@ export async function whois(
43
43
  const thinRdap = `${url}/domain/${domain}`;
44
44
  // console.log(`fetching thin RDAP: ${thinRdap}`);
45
45
 
46
- let thinResponse = await fetch(thinRdap)
46
+ let thinResponse = await _fetch(thinRdap)
47
47
  .then((r) => r.json() as any)
48
48
  .catch(() => null);
49
49
  if (thinResponse && !thinResponse.errorCode) {
@@ -69,7 +69,7 @@ export async function whois(
69
69
 
70
70
  if (!options.thinOnly && thickRdap) {
71
71
  // console.log(`fetching thick RDAP: ${thickRdap}`);
72
- thickResponse = await fetch(thickRdap)
72
+ thickResponse = await _fetch(thickRdap)
73
73
  .then((r) => r.json() as any)
74
74
  .catch(() => null);
75
75
  if (thickResponse && !thickResponse.errorCode && !thickResponse.error) {