Files
Shifted/node_modules/react-docgen/dist/utils/isDestructuringAssignment.js
2026-02-10 01:14:19 +00:00

12 lines
376 B
JavaScript

/**
* Checks if the input Identifier is part of a destructuring Assignment
* and the name of the property key matches the input name
*/
export default function isDestructuringAssignment(path, name) {
if (!path.isObjectProperty()) {
return false;
}
const id = path.get('key');
return id.isIdentifier({ name }) && path.parentPath.isObjectPattern();
}