Permalink
Browse files

pontification and less console verbosity

  • Loading branch information...
1 parent fa816a4 commit a8ff60fed7411ed8a56be9d083800fae9b67082a @mjpearson committed Dec 11, 2011
Showing with 19 additions and 7 deletions.
  1. +16 −2 README.md
  2. +3 −5 index.js
View
@@ -47,5 +47,19 @@ Available options (opts)
* hostName - whois hostname (default whois.internic.net)
* port - whois port (default 43)
-* onSuccess(whoisData) - whois request complete callback, containing utf8 encoded whois payload
-* onFail(errorMessage, fqdn) - failure callback
+* onSuccess - whois request complete callback containing utf8 encoded whois payload (first arg)
+* 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);
+ }
+ });
View
@@ -14,7 +14,8 @@ TLD_TOOLS = {
'onSuccess' : function(whoisData) {
console.log(whoisData);
},
- 'onFail' : function(errorMessage) {
+ 'onFail' : function(errorMessage, fqdn) {
+ console.log(fqdn + ' WHOIS FAILED');
console.log(errorMessage);
}
},
@@ -176,8 +177,6 @@ TLD_TOOLS = {
var token = tokens.shift();
if (ptr.indexOf(token) != -1) {
- console.log(token + ' in ');
- console.log(ptr);
++idx;
if (ptr[token].length > 0) {
ptr = ptr[token];
@@ -197,7 +196,7 @@ TLD_TOOLS = {
opts = this._whoisDefaultOpts;
}
var domainParts = this.extract(fqdn);
- console.log(domainParts);
+
var onSuccess = (undefined != opts.onSuccess) ? opts.onSuccess : this._whoisDefaultOpts.onSuccess;
var onFail = (undefined != opts.onFail) ? opts.onFail : this._whoisDefaultOpts.onFail;
@@ -228,7 +227,6 @@ TLD_TOOLS = {
onFail(exception.description, fqdn);
});
} else {
- console.log('Returning from Cache');
onSuccess(this._whoisCacheStruct.domainName);
}
} else {

0 comments on commit a8ff60f

Please sign in to comment.