Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = async function ({ blacklist = [], modules = modulesList.slice(), targets, filename } = {}) {
const set = new Set();
function filter(method, list) {
for (const ns of list) {
for (const name of modulesList) {
if (name === ns || name.startsWith(`${ ns }.`)) {
set[method](name);
}
}
}
}
filter('add', modules);
filter('delete', blacklist);
modules = modulesList.filter(it => set.has(it));