import { Predicate } from "@siteimprove/alfa-predicate" ; import { Node } from "../../node" ; import { Role } from "../../role" ; const { equals , property } = Predicate ; public export function hasRole ( predicate ? ) ; public export function hasRole < N extends Role . Name > ( name , ... rest ) ; export function hasRole ( nameOrPredicate , ... names ) { let predicate ; if ( typeof nameOrPredicate === "function" ) { predicate = nameOrPredicate ; } else { predicate = property ( "name" , equals ( nameOrPredicate , ... names ) ) ; } return ( node ) => node . role . some ( predicate ) ; }