mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-12-18 06:57:59 +01:00
18 lines
483 B
TypeScript
18 lines
483 B
TypeScript
|
import { AstMatcher } from './types';
|
||
|
|
||
|
export function matchAny(...matchers: AstMatcher[]): AstMatcher {
|
||
|
return (e: HTMLElement) => matchers.some(matcher => matcher(e));
|
||
|
}
|
||
|
|
||
|
export function matchAll(...matchers: AstMatcher[]): AstMatcher {
|
||
|
return (e: HTMLElement) => matchers.every(matcher => matcher(e));
|
||
|
}
|
||
|
|
||
|
export function matchNot(matcher: AstMatcher): AstMatcher {
|
||
|
return (e: HTMLElement) => !matcher(e);
|
||
|
}
|
||
|
|
||
|
export function matchNone(): AstMatcher {
|
||
|
return () => false;
|
||
|
}
|