Socket
Socket
Sign inDemoInstall

undeclared-identifiers

Package Overview
Dependencies
7
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    undeclared-identifiers

find undeclared identifiers and property accesses in a javascript file.


Version published
Weekly downloads
924K
increased by0.18%
Maintainers
1
Install size
1.34 MB
Created
Weekly downloads
 

Changelog

Source

1.1.3

  • Do not count class names and method names as undeclared. (#1)

Readme

Source

undeclared-identifiers

find undeclared identifiers and property accesses in a javascript file.

npm travis standard

Install

npm install undeclared-identifiers

Usage

var undeclaredIdentifiers = require('undeclared-identifiers')

undeclaredIdentifiers(src)
// { identifiers: ['Buffer'],
//   properties: ['Buffer.isBuffer'] }

API

res = undeclaredIdentifiers(source, opts)

Find undeclared identifiers and properties that are used in the source. source can be an AST or a source string that will be parsed using acorn-node.

res is an object with properties:

  • res.identifiers - an array of variable names as strings.
  • res.properties - an array of property names as .-separated strings, such as 'xyz.abc'. These are the property accesses on the undeclared variables found in res.identifiers.

Set opts.properties to false to only return identifiers.

When opts.wildcard is true, unknown uses of undeclared identifiers will be added to res.properties as 'VarName.*'.

undeclaredIdentifiers('Buffer(), Buffer.from()', { wildcard: true })
// { identifiers: ['Buffer'],
//   properties: ['Buffer.*', 'Buffer.from'] }

License

Apache-2.0

Keywords

FAQs

Last updated on 24 Feb 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc