Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dfatool

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

dfatool

JavaScript Data Flow Analyze Tool

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

dfatool.js is a data flow analyze tool for javascript code runs on node.js.

The code analyze is based on Parser API AST, which you can generated with Esprima. And Escodegen is needed for the final output code regenerate.

Install

npm install dfatool

Usage

Use Esprima to generate AST

var ast = esprima.parse(data, {
	loc : true
});

Build scope for the program

var globalScope = dfatool.globalScope
dfatool.buildScope(ast, globalScope);

anaylyze the code

globalScope.initialize();
globalScope.derivation();

Get the variable defined in a specific scope

var variable = scope.getDefine("variableName");

Inference the variable's value in a specific position of program

var loc = {
	line : 20,
	column : 20
};
var value = variable.inference( scope.offsetLoc(loc) );

Inference the type(object,function,array,literal,expression)

var type = value.type

Read property of the value( support prototype chain look up)

var property = value.access("propName.propName");

If the value is an array

var elem = value.access(10);

If the value is an function, you can simulate an function call

var returnedVariable = value.execute(callExprAST, scope);

Keywords

FAQs

Package last updated on 20 Dec 2012

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