New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

javascript-idents

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

javascript-idents

Walks a JavaScript AST and collects Identifier nodes

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-80%
Maintainers
1
Weekly downloads
 
Created
Source

javascript-idents

javascript-idents walks a JS abstract syntax tree (AST) and returns all identifiers the code uses.

It relies on Marijn Haverbeke's Acorn for AST walking, and should work with any ESTree-compliant JavaScript AST.

npm version build status dependency status dev dependency status BSD-licensed

Example

The following example prints the name of each Identifier node to the console.

const acorn = require('acorn/dist/acorn');
const idents = require('javascript-idents');

acorn.parse(`
    const c = a.b[d];
    function f (w, x, y) {
        return z;
    }
`);

idents.inspect(ast, (identifier) => {
  console.log('identifier found:', identifier.name);
});
identifier found: a
identifier found: d
identifier found: c
identifier found: z
identifier found: f
identifier found: w
identifier found: x
identifier found: y

Running tests

Run npm test.

Contributors

FAQs

Package last updated on 26 Sep 2016

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