Skip to content

Commit

Permalink
Updated - group more fields to same label
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiIgna committed Sep 3, 2019
1 parent 73f4196 commit 8a445e3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "whoiser",
"version": "1.4.0",
"version": "1.4.1",
"description": "Whois info for TLDs, domains and IPs",
"keywords": [
"whois",
Expand Down
7 changes: 6 additions & 1 deletion parsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,13 @@ const parseSimpleWhois = whois => {
const parseDomainWhois = whois => {
const renameLabels = {
'domain name': 'Domain Name',
'domain': 'Domain Name',
'nameserver': 'Name Server',
'nameservers': 'Name Server',
'nserver': 'Name Server',
'name servers': 'Name Server'
'name servers': 'Name Server',
'flags': 'Domain Status',
'status': 'Domain Status'
}
const ignoreLabels = ['note', 'notes', 'please note', 'important', 'notice', 'terms of use', 'web-based whois', 'https', 'to', 'registration service provider']
const ignoreTexts = [
Expand Down Expand Up @@ -192,6 +196,7 @@ const parseDomainWhois = whois => {

// remove invalid Name Servers (not valid hostname)
data['Name Server'] = data['Name Server'].map(nameServer => nameServer.split(' ')[0]).filter(isDomain)
data['Domain Status'] = data['Domain Status'].filter(status => Boolean(status))

// remove multiple empty lines
text = text.join("\n").trim()
Expand Down
2 changes: 1 addition & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe('Whoiser', function() {

it('should return WHOIS for "google.eu" when whois data is "label:_EOL_value"', async function() {
let whois = await whoiser.domain('google.eu', {follow: 1})
assert.equal(whois['whois.eu']['Domain'], 'google.eu', 'Domain name doesn\'t match')
assert.equal(whois['whois.eu']['Domain Name'], 'google.eu', 'Domain name doesn\'t match')
assert.notStrictEqual(whois['whois.eu']['Name Server'].length, 0, 'Does not return NS')
});

Expand Down

0 comments on commit 8a445e3

Please sign in to comment.