Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getFileLines (file) {
const lines = [];
let decommented, EOL;
const strFile = fs.readFileSync(file).toString().replace(/#/g, ' ');
try {
EOL = decomment.getEOL(strFile);
decommented = decomment(strFile);
} catch (e) {
console.error(file, e);
return lines;
}
decommented.split(EOL)
.forEach(line => lines.push(line));
return lines;
}