Permalink
Browse files

tld ordering bug

  • Loading branch information...
1 parent c7dc0de commit b3b0355f7634b2817e46cd35f5392cd3b0e13e4c @mjpearson committed Dec 11, 2011
Showing with 8 additions and 7 deletions.
  1. +3 −3 README.md
  2. +4 −3 index.js
  3. +1 −1 package.json
View
@@ -30,9 +30,9 @@ eg:
Returns...
TLD Cache is UP
- { subdomain: 'funkjazz.wagga.wagga',
- domain: 'gov',
- tld: 'au' }
+ { subdomain: 'wagga.wagga',
+ domain: 'funkjazz',
+ tld: 'au.gov' }
### tldtools.tldCacheRefresh(onSuccess, onFail)
View
@@ -176,13 +176,14 @@ TLD_TOOLS = {
var ptrLen = ptr.length;
var token = tokens.shift();
- if (ptr.indexOf(token) != -1) {
+ if (undefined != ptr.token) {
++idx;
if (ptr[token].length > 0) {
ptr = ptr[token];
idx = this._arrDepth(tokens, ptr, idx);
}
- } else if (ptr.indexOf('*') != -1) {
+
+ } else if (undefined != ptr['*']) {
++idx;
}
}
@@ -253,7 +254,7 @@ TLD_TOOLS = {
while (htIdx--) {
idxVal = hostTokens[htIdx];
if (tldDepth > 0) {
- tld.push(idxVal);
+ tld.unshift(idxVal);
} else if (domain == '') {
domain = idxVal;
} else {
View
@@ -1,7 +1,7 @@
{
"name": "tldtools",
"description": "Extracts a domain into its component parts (based on John Kurkowski's tldextract python lib)",
- "version": "0.0.3",
+ "version": "0.0.4",
"maintainers": [
{
"name": "Michael Pearson",

0 comments on commit b3b0355

Please sign in to comment.