Socket
Socket
Sign inDemoInstall

esliveness

Package Overview
Dependencies
39
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    esliveness

Liveness analysis for JavaScript based on Mozilla's Parser API AST.


Version published
Weekly downloads
11
increased by1000%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

esliveness

Variable liveness analysis for ECMAScript (JavaScript) based on Mozilla's Parser API AST.

Compatible with https://github.com/estools

Usage

// Create AST and control-flow graph
var ast = esprima.parse(source);
var cfg = esgraph(ast);

var liveness = require('esliveness');

liveness.compute(ast, cfg /* cfg is a optional parameter */);
var sourceWithComments = liveness.format(ast, true);

Examples

do-while loop (test 03-loops-02.js):

// Liveness: c, write
// - Kill: a
var a = 0, b, c;
do {
	// Liveness: a, c, write
	// - Gen: a
	// - Kill: b
	b = a + 1;
	// Liveness: b, c, write
	// - Gen: b, c
	// - Kill: c
	c = c + b;
	// Liveness: b, c, write
	// - Gen: b
	// - Kill: a
	a = b * 2;
} while (// Liveness: a, c, write
// - Gen: a
a < 9);
// Liveness: c, write
// - Gen: c, write
write(c);

Keywords

FAQs

Last updated on 23 Apr 2016

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