Index: lib/common.js |
=================================================================== |
--- a/lib/common.js |
+++ b/lib/common.js |
@@ -96,8 +96,27 @@ |
} |
} |
selectors.push(selector.substring(start)); |
return selectors; |
} |
exports.splitSelector = splitSelector; |
+ |
+/** |
+ * Yields subdomains of a domain |
+ * @param {string} domain |
+ * @yields {string} |
+ */ |
+function* subdomains(domain) |
+{ |
+ while (true) |
+ { |
+ let index = domain.indexOf("."); |
+ if (index == -1) |
+ break; |
+ |
+ yield domain = domain.substring(index + 1); |
+ } |
+} |
+ |
+exports.subdomains = subdomains; |