Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inBook a demo

esquery

Package Overview
Dependencies
1
Maintainers
2
Versions
13
Issues
File Explorer

Advanced tools

esquery

A query library for ECMAScript AST using a CSS selector like query language.

    1.4.0latest

Version published
Maintainers
2
Weekly downloads
19,039,418
decreased by-9.81%

Weekly downloads

Readme

Source

ESQuery is a library for querying the AST output by Esprima for patterns of syntax using a CSS style selector system. Check out the demo:

demo

The following selectors are supported:

  • AST node type: ForStatement
  • wildcard: *
  • attribute existence: [attr]
  • attribute value: [attr="foo"] or [attr=123]
  • attribute regex: [attr=/foo.*/] or (with flags) [attr=/foo.*/is]
  • attribute conditions: [attr!="foo"], [attr>2], [attr<3], [attr>=2], or [attr<=3]
  • nested attribute: [attr.level2="foo"]
  • field: FunctionDeclaration > Identifier.id
  • First or last child: :first-child or :last-child
  • nth-child (no ax+b support): :nth-child(2)
  • nth-last-child (no ax+b support): :nth-last-child(1)
  • descendant: ancestor descendant
  • child: parent > child
  • following sibling: node ~ sibling
  • adjacent sibling: node + adjacent
  • negation: :not(ForStatement)
  • has: :has(ForStatement)
  • matches-any: :matches([attr] > :first-child, :last-child)
  • subject indicator: !IfStatement > [name="foo"]
  • class of AST node: :statement, :expression, :declaration, :function, or :pattern

Build Status

Keywords

FAQs

What is esquery?

A query library for ECMAScript AST using a CSS selector like query language.

Is esquery popular?

The npm package esquery receives a total of 14,723,680 weekly downloads. As such, esquery popularity was classified as popular.

Is esquery well maintained?

We found that esquery demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.It has 2 open source maintainers collaborating on the project.

Last updated on 05 Feb 2021

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc