@types/esquery
- Version 1.5.4
- Published
- 7.55 kB
- 1 dependency
- MIT license
Install
npm i @types/esquery
yarn add @types/esquery
pnpm add @types/esquery
Overview
TypeScript definitions for esquery
Index
Functions
Interfaces
Type Aliases
Functions
function match
match: (ast: Node, selector: Selector, options?: ESQueryOptions) => Node[];
From a JS AST and a selector AST, collect all JS AST nodes that match the selector.
function matches
matches: ( node: Node, selector: Selector, ancestry?: Node[], options?: ESQueryOptions) => boolean;
Given a
node
and its ancestors, determine ifnode
is matched byselector
.
function parse
parse: (selector: string) => Selector;
Parse a selector and return its AST.
function query
query: (ast: Node, selector: string, options?: ESQueryOptions) => Node[];
Query the code AST using the selector string.
function traverse
traverse: ( ast: Node, selector: Selector, visitor: (node: Node, parent: Node, ancestry: Node[]) => void, options?: ESQueryOptions) => void;
From a JS AST and a selector AST, collect all JS AST nodes that match the selector.
Interfaces
interface Attribute
interface Attribute extends SubjectSelectorAtom {}
interface BinarySelectorAtom
interface BinarySelectorAtom extends SubjectSelectorAtom {}
interface Class
interface Class extends Atom {}
interface Descendant
interface Descendant extends BinarySelectorAtom {}
property type
type: 'descendant';
interface ESQueryOptions
interface ESQueryOptions {}
property fallback
fallback?: (node: Node) => string[];
property matchClass
matchClass?: (className: string, node: Node, ancestry: Node[]) => boolean;
property nodeTypeKey
nodeTypeKey?: string;
property visitorKeys
visitorKeys?: { [nodeType: string]: readonly string[] };
interface Identifier
interface Identifier extends SubjectSelectorAtom {}
interface LiteralAtom
interface LiteralAtom extends Atom {}
interface MultiSelectorAtom
interface MultiSelectorAtom extends SubjectSelectorAtom {}
property selectors
selectors: SubjectSelector[];
interface NthLastChild
interface NthLastChild extends NthSelectorAtom {}
property type
type: 'nth-last-child';
interface NthSelectorAtom
interface NthSelectorAtom extends SubjectSelectorAtom {}
property index
index: NumericLiteral;
interface NumericLiteral
interface NumericLiteral extends LiteralAtom {}
property value
value: number;
interface RegExpLiteral
interface RegExpLiteral extends Atom {}
interface StringLiteral
interface StringLiteral extends LiteralAtom {}
property value
value: string;
interface SubjectSelectorAtom
interface SubjectSelectorAtom extends Atom {}
property subject
subject?: boolean | undefined;
Type Aliases
type BinarySelector
type BinarySelector = Descendant | Child | Sibling | Adjacent;
type Literal
type Literal = StringLiteral | NumericLiteral;
type MultiSelector
type MultiSelector = Sequence | Negation | Matches | Has;
type NthSelector
type NthSelector = NthChild | NthLastChild;
type Selector
type Selector = | Field | Type | Sequence | Identifier | Wildcard | Attribute | NthChild | NthLastChild | Descendant | Child | Sibling | Adjacent | Negation | Matches | Has | Class;
type SubjectSelector
type SubjectSelector = | NthSelector | BinarySelector | MultiSelector | Identifier | Wildcard | Attribute;
Package Files (1)
Dependencies (1)
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/esquery
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/esquery)
- HTML<a href="https://www.jsdocs.io/package/@types/esquery"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3363 ms. - Missing or incorrect documentation? Open an issue for this package.