Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let matches, type, arg;
const lines = source.match(LINES);
for (let i = 0; i < lines.length - 1 /* last line is always empty */; i++) {
const text = lines[i];
if (matches = text.match(DIRECTIVE)) {
const token = {_line: 1 + i};
type = matches[1];
arg = matches[2].trim();
token.args = [];
// remove single line comments from arg
arg = decomment.text(arg);
switch (type) {
case 'include':
// detect "once" flag
if (/^once\b/.test(arg)) {
token.args.push('once');
arg = arg.substr(5).trim();
}
this._checkArgumentIsNonempty(type, arg, token._line);
token.type = TOKENS.INCLUDE;
token.args.push(arg);
break;
case 'set':
.then(data => {
// Uncomment files as if they were plain text files (avoiding issues with jsx)
outputFile(filePath, decomment.text(data));
})
.catch(err => {