ESUtils is a foundational utility library for ECMAScript language tools, providing a 'utility box' for analyzing JavaScript Abstract Syntax Trees (ASTs), character codes, and keywords/reserved words based on specific ECMA262 editions. It offers functions to classify AST nodes (e.g., `isExpression`, `isStatement`), identify character types (e.g., `isDecimalDigit`, `isIdentifierStart`), and check for keywords (`isKeywordES5`, `isKeywordES6`). The current stable version is 2.0.3, released in 2018. Given its core utility nature, its API is highly stable, and its release cadence is low, typically for maintenance or specification updates. It serves as a building block for various JavaScript parsing, linting, and transformation projects, providing low-level, spec-compliant checks.
npm install esutilsVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage of `esutils` to check AST node types, character codes, and ECMAScript keywords.
Always explicitly choose `esutils.keyword.isKeywordES5`, `isKeywordES6`, `isReservedWordES5`, or `isReservedWordES6` according to the ECMAScript version you intend to target.
Consult the official `esutils` documentation for `isProblematicIfStatement` to understand its precise definition and implications before relying on it for AST transformations.
For basic character checks, the functions are sufficient. For full Unicode identifier validation, consider pairing `esutils` with a dedicated Unicode normalization library or a parser that handles identifier processing for all Unicode ranges.
Ensure `esutils` is properly imported: `import esutils from 'esutils';` for ESM or `const esutils = require('esutils');` for CommonJS, then access `esutils.ast.isExpression`.Switch to ESM `import esutils from 'esutils';` or configure your build system (e.g., Webpack, Rollup, Babel) to transpile CommonJS `require` calls in ESM environments.
`esutils.ast` is an object containing utility functions, not a function itself. Access its methods like `esutils.ast.isExpression(node)`.
No dependency data recorded yet.