Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: lib/url.js

Issue 29336748: Issue 3671 - Expose getBaseDomain for abp2blocklist (Closed)
Patch Set: Created Feb. 20, 2016, 3:29 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/url.js
diff --git a/lib/url.js b/lib/url.js
index 78a5f9599d4dd1404cdebda930e23539a97ad336..b507b950916b8b0c1e01c288154888c1d6cdc718 100644
--- a/lib/url.js
+++ b/lib/url.js
@@ -92,7 +92,14 @@ function isDomain(hostname)
return hostname.indexOf(":") == -1;
}
-function getBaseDomain(hostname)
+let getBaseDomain =
+/**
+ * Returns the base domain for the given hostname.
+ *
+ * @param {string} hostname
+ * @return {string} base domain
+ */
+exports.getBaseDomain = function(hostname)
{
let bits = hostname.split(".");
let cutoff = bits.length - 2;
@@ -112,7 +119,7 @@ function getBaseDomain(hostname)
return hostname;
return bits.slice(cutoff).join(".");
-}
+};
/**
* Checks whether the request's origin is different from the document's origin.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld