@cleandns/whois-rdap 1.0.3 → 1.0.5
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 +2 -5
- package/package.json +1 -1
- package/src/index.ts +2 -3
package/dist/index.js
CHANGED
|
@@ -9,7 +9,6 @@ const eventMap = new Map([
|
|
|
9
9
|
["last changed", "updated"],
|
|
10
10
|
["expiration", "expires"],
|
|
11
11
|
]);
|
|
12
|
-
whois(process.argv[2]).then((r) => console.log(r));
|
|
13
12
|
export async function whois(domain, options = { fetch: fetch }) {
|
|
14
13
|
var _a, _b, _c, _d, _e, _f;
|
|
15
14
|
const fetch = options.fetch;
|
|
@@ -113,10 +112,9 @@ export async function whois(domain, options = { fetch: fetch }) {
|
|
|
113
112
|
// registrar
|
|
114
113
|
const { events, ...registrar } = registrars.sort((a, b) => {
|
|
115
114
|
var _a, _b;
|
|
116
|
-
// console.warn({ a, b });
|
|
117
115
|
const aDate = ((_a = a.events.find((ev) => ev.eventAction === "registration")) === null || _a === void 0 ? void 0 : _a.eventDate) || 0;
|
|
118
116
|
const bDate = ((_b = b.events.find((ev) => ev.eventAction === "registration")) === null || _b === void 0 ? void 0 : _b.eventDate) || 0;
|
|
119
|
-
return new Date(bDate).valueOf() - new Date(aDate).valueOf();
|
|
117
|
+
return new Date(bDate.replace(/\+0000Z$/, 'Z')).valueOf() - new Date(aDate.replace(/\+0000Z$/, 'Z')).valueOf();
|
|
120
118
|
})[0] || { id: 0, name: "" };
|
|
121
119
|
response.registrar = registrar;
|
|
122
120
|
// reseller
|
|
@@ -169,8 +167,7 @@ function findTimestamps(values) {
|
|
|
169
167
|
for (const [event, field] of eventMap) {
|
|
170
168
|
const date = events.find((ev) => ev.eventAction === event);
|
|
171
169
|
if (date === null || date === void 0 ? void 0 : date.eventDate) {
|
|
172
|
-
|
|
173
|
-
ts[field] = new Date(date.eventDate);
|
|
170
|
+
ts[field] = new Date(date.eventDate.replace(/\+0000Z$/, 'Z'));
|
|
174
171
|
}
|
|
175
172
|
}
|
|
176
173
|
return ts;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -155,14 +155,13 @@ export async function whois(domain: string, options: WhoisOptions = { fetch: fet
|
|
|
155
155
|
|
|
156
156
|
// registrar
|
|
157
157
|
const { events, ...registrar } = registrars.sort((a: any, b: any) => {
|
|
158
|
-
// console.warn({ a, b });
|
|
159
158
|
const aDate =
|
|
160
159
|
a.events.find((ev: any) => ev.eventAction === "registration")
|
|
161
160
|
?.eventDate || 0;
|
|
162
161
|
const bDate =
|
|
163
162
|
b.events.find((ev: any) => ev.eventAction === "registration")
|
|
164
163
|
?.eventDate || 0;
|
|
165
|
-
return new Date(bDate).valueOf() - new Date(aDate).valueOf();
|
|
164
|
+
return new Date(bDate.replace(/\+0000Z$/, 'Z')).valueOf() - new Date(aDate.replace(/\+0000Z$/, 'Z')).valueOf();
|
|
166
165
|
})[0] || { id: 0, name: "" };
|
|
167
166
|
response.registrar = registrar;
|
|
168
167
|
|
|
@@ -234,7 +233,7 @@ function findTimestamps(values: any[]) {
|
|
|
234
233
|
for (const [event, field] of eventMap) {
|
|
235
234
|
const date = events.find((ev: any) => ev.eventAction === event);
|
|
236
235
|
if (date?.eventDate) {
|
|
237
|
-
ts[field] = new Date(date.eventDate.replace(
|
|
236
|
+
ts[field] = new Date(date.eventDate.replace(/\+0000Z$/, 'Z'));
|
|
238
237
|
}
|
|
239
238
|
}
|
|
240
239
|
|