Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function visit(node, st, c) {
var hasRequire = wordRe.test(src.slice(node.start, node.end));
if (!hasRequire) return;
walk.base[node.type](node, st, c);
if (node.type !== 'CallExpression') return;
if (isRequire(node)) {
if (node.arguments.length) {
var arg = node.arguments[0];
if (arg.type === 'Literal') {
modules.strings.push(arg.value);
}
else if (arg.type === 'TemplateLiteral'
&& arg.quasis.length === 1
&& arg.expressions.length === 0) {
modules.strings.push(arg.quasis[0].value.raw);
}
else {
modules.expressions.push(src.slice(arg.start, arg.end));
}
function visit(node, st, c) {
var hasRequire = wordRe.test(src.slice(node.start, node.end));
if (!hasRequire) return;
walk.base[node.type](node, st, c);
if (node.type !== 'CallExpression') return;
if (isRequire(node)) {
if (node.arguments.length) {
var arg = node.arguments[0];
if (arg.type === 'Literal') {
modules.strings.push(arg.value);
}
else if (arg.type === 'TemplateLiteral'
&& arg.quasis.length === 1
&& arg.expressions.length === 0) {
modules.strings.push(arg.quasis[0].value.raw);
}
else {
modules.expressions.push(src.slice(arg.start, arg.end));
}