debt-collector
Version:
a nodejs tool to identify, track and mesure technical debt
21 lines (20 loc) • 791 B
TypeScript
export type DomFilter = string | (string | RegExp)[] | RegExp;
export interface DomMatchChain {
tag: (filter: DomFilter) => DomMatchChain;
attribute: (name: DomFilter, value?: DomFilter) => DomMatchChain;
count: () => number;
find: () => 0 | 1;
}
/**
* Chainable utility for querying DOM-like markup (HTML, JSX, Vue, Angular).
* Supports filtering by tag names, attribute names, and attribute values.
* All filters accept `string | string[] | RegExp`.
*
* @example
* const dm = domMatch(content)
* dm.tag('div').attribute('className').count()
* dm.tag(['input', 'select']).attribute('required').find()
* dm.attribute('disabled').count()
* dm.tag(/^Legacy/).attribute('variant', 'primary').count()
*/
export declare const domMatch: (data: string) => DomMatchChain;