import { Attribute , Element } from "@siteimprove/alfa-dom" ; import { Predicate } from "@siteimprove/alfa-predicate" ; const { property } = Predicate ; export function hasAttribute ( predicate ) ; export function hasAttribute ( name , value ? ) ; export function hasAttribute ( nameOrPredicate , value = ( ) => true ) { if ( typeof nameOrPredicate === "function" ) { return ( element ) => element . attribute ( nameOrPredicate ) . isSome ( ) ; } const name = nameOrPredicate ; const predicate = property < Attribute , "value" > ( "value" , value ) ; return ( element ) => element . attribute ( name ) . some ( predicate ) ; }