blob: a53ee5339ec31f901c9961597dccd4b85eba2713 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
(function() {
var tldEnd = new RegExp("\\.tld$");
/**
* Checks if a domain matches checking for .tld which matches all top level
* domains
* @name domainMatch
* @memberOf net
* @function
*
* @param {String} domain
* The domain to test
* @param {String} match
* A domain that may contain .tld as top level domain
*
* @returns {Boolean}
* Whether the domains match
* */
Object.defineProperties(net, {
"domainMatch" :
{
value : function(domain, match) {
var result = false;
if (tldEnd.test(match))
{
result = domain.substring(0, domain.indexOf(".")) === match.substring(0, match.indexOf("."));
}
else
{
result = domain === match;
}
return result;
}
}
});
Object.freeze(net);
})();
|