feat: calculates a penalty score based on a CSS selector pat.
This commit is contained in:
@@ -286,6 +286,10 @@ export const getSelectors = async (page: Page, coordinates: Coordinates) => {
|
||||
return query;
|
||||
}
|
||||
|
||||
function penalty(path: Path): number {
|
||||
return path.map((node) => node.penalty).reduce((acc, i) => acc + i, 0);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user