debian/build_modules/relateurl/lib/parse/host.js
raw| 1 | "use strict"; |
| 2 | |
| 3 | function parseHost(urlObj, options) |
| 4 | { |
| 5 | // TWEAK :: condition only for speed optimization |
| 6 | if (options.ignore_www) |
| 7 | { |
| 8 | var host = urlObj.host.full; |
| 9 | |
| 10 | if (host) |
| 11 | { |
| 12 | var stripped = host; |
| 13 | |
| 14 | if (host.indexOf("www.") === 0) |
| 15 | { |
| 16 | stripped = host.substr(4); |
| 17 | } |
| 18 | |
| 19 | urlObj.host.stripped = stripped; |
| 20 | } |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | |
| 25 | |
| 26 | module.exports = parseHost; |