2024-03-18 13:20:47 +01:00
|
|
|
import { AstMatcher } from './types';
|
|
|
|
|
|
|
|
export function matchAny(...matchers: AstMatcher[]): AstMatcher {
|
2024-07-03 22:54:14 +02:00
|
|
|
return (e: HTMLElement) => matchers.some((matcher) => matcher(e));
|
2024-03-18 13:20:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export function matchAll(...matchers: AstMatcher[]): AstMatcher {
|
2024-07-03 22:54:14 +02:00
|
|
|
return (e: HTMLElement) => matchers.every((matcher) => matcher(e));
|
2024-03-18 13:20:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export function matchNot(matcher: AstMatcher): AstMatcher {
|
|
|
|
return (e: HTMLElement) => !matcher(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
export function matchNone(): AstMatcher {
|
|
|
|
return () => false;
|
|
|
|
}
|