You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

espree

Package Overview
Dependencies
Maintainers
2
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

espree

An Esprima-compatible JavaScript parser built on Acorn

10.4.0
latest
Source
npmnpm
Version published
Weekly downloads
56M
-13.08%
Maintainers
2
Weekly downloads
 
Created

What is espree?

Espree is an actively-maintained JavaScript parsing library used to parse ECMAScript (JavaScript) code. It is built on top of Acorn, a high-performance, tiny JavaScript parser, and it adheres to the ECMAScript standard. Espree is often used in the context of development tools and frameworks to analyze and understand JavaScript code structure or to enable code transformation.

What are espree's main functionalities?

Parsing JavaScript code to an Abstract Syntax Tree (AST)

This feature allows developers to parse a string of JavaScript code into an AST, which can then be used for various static analysis tasks.

const espree = require('espree');
const ast = espree.parse('let x = 5;');

Parsing with specific ECMAScript version

Espree can parse code according to a specified ECMAScript version, allowing developers to work with features from different stages of JavaScript evolution.

const espree = require('espree');
const ast = espree.parse('let x = 5;', { ecmaVersion: 2020 });

Parsing with source type module

Espree can parse code written in module format, which includes the use of `import` and `export` statements.

const espree = require('espree');
const ast = espree.parse('export var x = 5;', { sourceType: 'module' });

Other packages similar to espree

Keywords

ast

FAQs

Package last updated on 09 Jun 2025

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