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
import whoisJson from "npm:whois-json";
export const whois = async (
domain,
properties,
) => {
const whoisData = await whoisJson(domain);
if (properties === null || properties.length === 0) {
properties = ["domainName", "updatedDate", "registrarRegistrationExpirationDate", "registrar"];
}
let result = {};
properties.forEach(property => {
if (whoisData.hasOwnProperty(property)) {
if (property === "nameServer") {
result[property] = whoisData[property].split(" ");
} else {
result[property] = whoisData[property];
}
}
if (property === "raw") {
result[property] = whoisData;
}
});
return result;
};
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
March 13, 2024