* Returns true if the url has a local host. * @param {URL} url URL as object * @return {boolean}
(url)
| 96 | * @return {boolean} |
| 97 | */ |
| 98 | function checkLocalURL(url) { |
| 99 | let host = extractHost(url); |
| 100 | |
| 101 | if (!host.match(/^\d/) && host !== 'localhost') { |
| 102 | return false; |
| 103 | } |
| 104 | |
| 105 | return ipRangeCheck(host, ["10.0.0.0/8", "172.16.0.0/12", |
| 106 | "192.168.0.0/16", "100.64.0.0/10", |
| 107 | "169.254.0.0/16", "127.0.0.1"]) || |
| 108 | host === 'localhost'; |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * Return the number of parameters query strings. |
no test coverage detected