feat: filter null/undefined vals from potential selector nodes

This commit is contained in:
karishmas6
2024-06-05 23:38:36 +05:30
parent 531a2ba6bd
commit 4af7caf0aa

View File

@@ -399,9 +399,16 @@ export const getSelectors = async (page: Page, coordinates: Coordinates) => {
return node.name !== 'html' && !node.name.startsWith('#');
}
function maybe(...level: (Node | null)[]): Node[] | null {
const list = level.filter(notEmpty);
if (list.length > 0) {
return list;
}
return null;
}
};