Index: lib/domain.js
===================================================================
--- a/lib/domain.js
+++ b/lib/domain.js
@@ -35,16 +35,29 @@
 
   for (let key in publicSuffixes)
     map.set(key, publicSuffixes[key]);
 
   return map;
 }
 
 /**
+ * Normalizes a hostname.
+ * @param {string} hostname
+ * @returns {string}
+ */
+function normalizeHostname(hostname)
+{
+  return (hostname[hostname.length - 1] == "." ?
+            hostname.replace(/\.+$/, "") : hostname).toLowerCase();
+}
+
+exports.normalizeHostname = normalizeHostname;
+
+/**
  * Yields all suffixes for a domain. For example, given the domain
  * <code>www.example.com</code>, this function yields
  * <code>www.example.com</code>, <code>example.com</code>, and
  * <code>com</code>, in that order.
  *
  * @param {string} domain The domain.
  * @param {boolean} [includeBlank] Whether to include the blank suffix at the
  *   end.
