lib/crawler.js
function isSubdomainOf(subdomain, host) {

        // Comparisons must be case-insensitive
        subdomain   = subdomain.toLowerCase();
        host        = host.toLowerCase();

        // If we're ignoring www, remove it from both
        // (if www is the first domain component...)
        if (crawler.ignoreWWWDomain) {
            subdomain = subdomain.replace(/^www./ig, "");
            host = host.replace(/^www./ig, "");
        }

        // They should be the same flipped around!
        return subdomain.split("").reverse().join("").substr(0, host.length) ===
                host.split("").reverse().join("");
    }
function isSubdomainOf(subdomain, host) {

        // Comparisons must be case-insensitive
        subdomain   = subdomain.toLowerCase();
        host        = host.toLowerCase();

        // If we're ignoring www, remove it from both
        // (if www is the first domain component...)
        if (crawler.ignoreWWWDomain) {
            subdomain = subdomain.replace(/^www./ig, "");
            host = host.replace(/^www./ig, "");
        }

        // They should be the same flipped around!
        return subdomain.split("").reverse().join("").substr(0, host.length) ===
                host.split("").reverse().join("");
    }
function isSubdomainOf ( subdomain , host ) { // Comparisons must be case-insensitive subdomain = subdomain . toLowerCase ( ) ; host = host . toLowerCase ( ) ; // If we're ignoring www, remove it from both // (if www is the first domain component...) if ( crawler . ignoreWWWDomain ) { subdomain = subdomain . replace ( / ^www. / ig , "" ) ; host = host . replace ( / ^www. / ig , "" ) ; } // They should be the same flipped around! return subdomain . split ( "" ) . reverse ( ) . join ( "" ) . substr ( 0 , host . length ) === host . split ( "" ) . reverse ( ) . join ( "" ) ; }
Checks if the first domain is a subdomain of the second
Checks if the first domain is a subdomain of the second