espree
- Version 11.1.1
- Published
- 96.3 kB
- 3 dependencies
- BSD-2-Clause license
Install
npm i espreeyarn add espreepnpm add espreeOverview
An Esprima-compatible JavaScript parser built on Acorn
Index
Variables
variable latestEcmaVersion
const latestEcmaVersion: number;variable name
const name: string;variable supportedEcmaVersions
const supportedEcmaVersions: [3, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17];variable Syntax
const Syntax: Record<string, string>;variable version
const version: string;{string}
Functions
function parse
parse: (code: string, options?: Options) => acorn.Program;Parses the given code.
Parameter code
The code to tokenize.
Parameter options
Options defining how to tokenize.
Returns
{acorn.Program} The "Program" AST node.
Throws
{EnhancedSyntaxError} If the input code is invalid.
function tokenize
tokenize: (code: string, options?: Options) => EspreeTokens;Tokenizes the given code.
Parameter code
The code to tokenize.
Parameter options
Options defining how to tokenize.
Returns
{EspreeTokens} An array of tokens.
Throws
{EnhancedSyntaxError} If the input code is invalid.
Type Aliases
type EcmaVersion
type EcmaVersion = | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | 2025 | 2026 | 'latest';type EspreeComment
type EspreeComment = { type: 'Block' | 'Hashbang' | 'Line'; value: string; range?: [number, number]; start?: number; end?: number; loc?: { start: acorn.Position | undefined; end: acorn.Position | undefined; };};type EspreeToken
type EspreeToken = { type: string; value: any; start?: number; end?: number; loc?: acorn.SourceLocation; range?: [number, number]; regex?: { flags: string; pattern: string; };};type EspreeTokens
type EspreeTokens = { comments?: EspreeComment[];} & EspreeToken[];type Options
type Options = { allowReserved?: boolean; ecmaVersion?: EcmaVersion; sourceType?: 'script' | 'module' | 'commonjs'; ecmaFeatures?: { jsx?: boolean; globalReturn?: boolean; impliedStrict?: boolean; }; range?: boolean; loc?: boolean; tokens?: boolean; comment?: boolean;};Package Files (1)
Dependencies (3)
Dev Dependencies (2)
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/espree.
- Markdown[](https://www.jsdocs.io/package/espree)
- HTML<a href="https://www.jsdocs.io/package/espree"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 2246 ms. - Missing or incorrect documentation? Open an issue for this package.
