Skip to content

Commit

Permalink
pontification and less console verbosity
Browse files Browse the repository at this point in the history
  • Loading branch information
mjpearson committed Dec 11, 2011
1 parent fa816a4 commit a8ff60f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
18 changes: 16 additions & 2 deletions README.md
Expand Up @@ -47,5 +47,19 @@ Available options (opts)


* hostName - whois hostname (default whois.internic.net) * hostName - whois hostname (default whois.internic.net)
* port - whois port (default 43) * port - whois port (default 43)
* onSuccess(whoisData) - whois request complete callback, containing utf8 encoded whois payload * onSuccess - whois request complete callback containing utf8 encoded whois payload (first arg)
* onFail(errorMessage, fqdn) - failure callback * onFail - failure callback containing errormessage and fqdn context

eg:

tldtools.whois(
'github.com',
{
'onSuccess' : function(whoisData) {
console.log(whoisData);
},
'onFail' : function(errorMessage, fqdn) {
console.log(fqdn + ' WHOIS FAILED');
console.log(errorMessage);
}
});
8 changes: 3 additions & 5 deletions index.js
Expand Up @@ -14,7 +14,8 @@ TLD_TOOLS = {
'onSuccess' : function(whoisData) { 'onSuccess' : function(whoisData) {
console.log(whoisData); console.log(whoisData);
}, },
'onFail' : function(errorMessage) { 'onFail' : function(errorMessage, fqdn) {
console.log(fqdn + ' WHOIS FAILED');
console.log(errorMessage); console.log(errorMessage);
} }
}, },
Expand Down Expand Up @@ -176,8 +177,6 @@ TLD_TOOLS = {
var token = tokens.shift(); var token = tokens.shift();


if (ptr.indexOf(token) != -1) { if (ptr.indexOf(token) != -1) {
console.log(token + ' in ');
console.log(ptr);
++idx; ++idx;
if (ptr[token].length > 0) { if (ptr[token].length > 0) {
ptr = ptr[token]; ptr = ptr[token];
Expand All @@ -197,7 +196,7 @@ TLD_TOOLS = {
opts = this._whoisDefaultOpts; opts = this._whoisDefaultOpts;
} }
var domainParts = this.extract(fqdn); var domainParts = this.extract(fqdn);
console.log(domainParts);
var onSuccess = (undefined != opts.onSuccess) ? opts.onSuccess : this._whoisDefaultOpts.onSuccess; var onSuccess = (undefined != opts.onSuccess) ? opts.onSuccess : this._whoisDefaultOpts.onSuccess;
var onFail = (undefined != opts.onFail) ? opts.onFail : this._whoisDefaultOpts.onFail; var onFail = (undefined != opts.onFail) ? opts.onFail : this._whoisDefaultOpts.onFail;


Expand Down Expand Up @@ -228,7 +227,6 @@ TLD_TOOLS = {
onFail(exception.description, fqdn); onFail(exception.description, fqdn);
}); });
} else { } else {
console.log('Returning from Cache');
onSuccess(this._whoisCacheStruct.domainName); onSuccess(this._whoisCacheStruct.domainName);
} }
} else { } else {
Expand Down

0 comments on commit a8ff60f

Please sign in to comment.