Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!path.parentPath.get('id').isObjectPattern())
return;
const objectPath = path.get('object');
const object = objectPath.node;
if (objectPath.isIdentifier())
return add({
name: generate(object).code,
items,
path,
});
if (objectPath.isCallExpression())
return add({
name: generate(objectPath.node).code,
items,
path,
});
},
});
MemberExpression(path) {
if (!path.parentPath.isVariableDeclarator())
return;
if (path.node.property.name === 'default')
return;
if (!path.parentPath.get('id').isObjectPattern())
return;
const objectPath = path.get('object');
const object = objectPath.node;
if (objectPath.isIdentifier())
return add({
name: generate(object).code,
items,
path,
});
if (objectPath.isCallExpression())
return add({
name: generate(objectPath.node).code,
items,
path,
});
},
});