-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
executable file
·30 lines (23 loc) · 873 Bytes
/
index.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
#!/usr/bin/env node
const { NodeClient } = require("hs-client");
const config = require("./config.json");
const nameList = require("./nameList.json");
const node = new NodeClient(config);
async function checkAvailable(names) {
const available = [];
const reserved = [];
const registered = [];
const invalid = [];
for ( const name of names ) {
const data = await node.execute("getnameinfo", [ name ]).catch(x => null);
if ( data === null ) invalid.push(name);
else if ( data.start.reserved ) reserved.push(name);
else if ( data.info?.registered ) registered.push(name);
else available.push(name);
}
return { available, registered, reserved, invalid };
}
(async () => {
const result = await checkAvailable(nameList);
console.log(result);
})();