Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

esquery

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esquery

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

  • 0.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
43M
decreased by-5.31%
Maintainers
1
Weekly downloads
 
Created

What is esquery?

The esquery npm package is a tool for querying the abstract syntax tree (AST) of ECMAScript (JavaScript) code. It allows developers to find specific nodes within the AST using a CSS-like query syntax, making it easier to analyze and manipulate code structure programmatically.

What are esquery's main functionalities?

Selecting nodes by type

This feature allows you to select all nodes of a specific type, such as all function declarations in the AST. The code sample demonstrates how to select all function declaration nodes.

esquery(ast, 'FunctionDeclaration');

Selecting nodes by attribute

You can select nodes based on their attributes, such as selecting all nodes where the name attribute is 'myFunction'. The code sample shows how to select nodes with a specific name.

esquery(ast, '[name="myFunction"]');

Pseudo-classes for node selection

Esquery supports pseudo-classes for more complex queries, such as selecting the second child node of every matched set. The code sample demonstrates selecting the second child node.

esquery(ast, ':nth-child(2)');

Other packages similar to esquery

Keywords

FAQs

Package last updated on 04 Nov 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc