Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const regDependency = /\s*\b_\(\s*['"]([\w\s$]+)['"]\s*\);?/m;
for (const file of files) {
let modName = last(file.split('/')).slice(0, -3);
const data = await fs.readFile(file, 'utf8');
let desc = 'No description.';
let comments = extractBlockCmts(data);
if (comments.length > 0) {
desc = trim(comments[0]).split('\n')[0];
}
let modInfo = extend(
{
description: desc,
dependencies: extractDependencies(data)
},
extractCmts(comments)
);
output[modName] = modInfo;
}
function extractDependencies(data) {
let dependencies = regDependency.exec(data);
dependencies = dependencies ? trim(dependencies[1]).split(/\s+/) : [];
return dependencies;
}