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

@types/esquery

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/esquery

TypeScript definitions for esquery

  • 1.5.4
  • ts4.7
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • ts5.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
149K
decreased by-17.68%
Maintainers
1
Weekly downloads
 
Created

What is @types/esquery?

@types/esquery provides TypeScript type definitions for the esquery library, which is used to query and match nodes in an ESTree-compliant AST (Abstract Syntax Tree). This package allows developers to use esquery with TypeScript, ensuring type safety and better development experience.

What are @types/esquery's main functionalities?

Querying AST Nodes

This feature allows you to query AST nodes using CSS-like selectors. In the example, it finds all Identifier nodes with the name 'myFunction' that are direct children of FunctionDeclaration nodes.

const esquery = require('esquery');
const ast = /* some ESTree-compliant AST */;
const matches = esquery(ast, 'FunctionDeclaration > Identifier[name="myFunction"]');
console.log(matches);

Complex Queries

This feature supports complex queries using pseudo-classes. In the example, it finds all FunctionDeclaration nodes that have an Identifier child node with the name 'myFunction'.

const esquery = require('esquery');
const ast = /* some ESTree-compliant AST */;
const matches = esquery(ast, 'FunctionDeclaration:has(Identifier[name="myFunction"])');
console.log(matches);

Combining Selectors

This feature allows combining multiple selectors to match different types of nodes. In the example, it finds all FunctionDeclaration and VariableDeclaration nodes in the AST.

const esquery = require('esquery');
const ast = /* some ESTree-compliant AST */;
const matches = esquery(ast, 'FunctionDeclaration, VariableDeclaration');
console.log(matches);

Other packages similar to @types/esquery

FAQs

Package last updated on 14 May 2024

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