Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return (elementsPaths) => {
for (const elementPath of elementsPaths) {
const {node} = elementPath;
if (isObjectExpression(node))
traverseObjExpression(elementPath.get('properties'));
}
};
};
function isInitState(path) {
const {node} = path;
const {
left,
right,
} = node;
if (!isMemberExpression(left))
return false;
if (!isThisState(left))
return false;
if (!isObjectExpression(right))
return false;
return true;
}
ExportDefaultDeclaration(path) {
const declarationPath = path.get('declaration');
const {declaration} = path.node;
const {id} = declaration;
if (id && isFunctionDeclaration(declaration))
use(path, declaration.id.name);
else if (isIdentifier(declaration))
use(path, declaration.name);
else if (id && isClassDeclaration(declaration))
use(path, declaration.id.name);
else if (isObjectExpression(declaration))
traverseObj(declarationPath.get('properties'));
},
if (computed && isIdentifier(key)) {
use(path, key.name);
}
if (isIdentifier(value)) {
use(path, value.name);
continue;
}
if (isTemplateLiteral(value)) {
traverseTmpl(path, value.expressions);
continue;
}
if (isObjectExpression(value)) {
const traverseObj = traverseObjectExpression(use);
traverseObj(path.get('value.properties'));
continue;
}
}
};
};