The `get-assigned-identifiers` package provides a focused utility for JavaScript AST analysis, specifically designed to extract identifiers that are initialized by a given AST node, including those within destructuring assignments. It helps developers programmatically understand which variables are being declared or assigned in a specific scope, a common requirement for static analysis tools, code linters, and refactoring utilities. The current stable version is 1.2.0, which was published over six years ago, indicating a mature but infrequently updated library. Its primary differentiator is its single-purpose API, which allows for direct integration without the overhead of larger AST manipulation frameworks. While stable for its intended use cases, users should be aware of its age when integrating with very recent JavaScript syntax or modern AST parsers, as compatibility might not be actively maintained.
npm install get-assigned-identifiersVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to parse JavaScript code using Acorn and then extract assigned identifiers from various AST node types, including object and array destructuring, and simple variable declarations.
Manually verify compatibility with your specific AST parser and JavaScript syntax target. Consider alternative, more actively maintained AST utility libraries for modern projects, or fork and update the package if critical for your use case.
Always use a robust JavaScript parser (e.g., `acorn`, `@babel/parser`, `esprima`) to generate the AST nodes before passing them to `getAssignedIdentifiers`.
Ensure you are using the correct import statement for your module system: `const getAssignedIdentifiers = require('get-assigned-identifiers')` for CommonJS or `import getAssignedIdentifiers from 'get-assigned-identifiers'` for ESM.Either use the CommonJS `require()` syntax (`const getAssignedIdentifiers = require('get-assigned-identifiers')`) or configure your project for ESM by adding `"type": "module"` to your `package.json` or saving the file as `.mjs`.No dependency data recorded yet.