diff --git a/lib/hosts.js b/lib/hosts.js index 23c8caa..e2ce3f0 100644 --- a/lib/hosts.js +++ b/lib/hosts.js @@ -14,7 +14,12 @@ exports.getHosts = function() { var lines = fileContent.split(/[\r\n]+/g).filter(function(s) { return !(s.indexOf('#') == 0) }).map(function(s) { - return s.replace(/\s\s/g, ' '); + var pos = s.indexOf('#'); + if(pos > -1) { + return s.substring(pos).replace(/\s\s/g, ' '); + } else { + return s.replace(/\s\s/g, ' '); + } }); for (var i = 0; i < lines.length; i++) {