isoscope

0.0.1 • Public • Published

isoscope

Build Status

ECMAScript function isolation analyzer. This is project is very alpha but intention is to provide API for performing static analyzes on the nodes of the JS AST in the de facto syntax tree format. All the API function take AST nodes denoting a function definition / declaration and perform static analyzes on it.

API

enclosed

Function takes AST node that represents a scope (function declaration / expression) form and returns array of identifier names for all the enclosed references.

var esprima = require("esprima")
var enclosed = require("isoscope/enclosed")

// Parse some code
var form = esprima.parse(String(function fn(a, b) {
  console.log(String(a) + b)
}))

// Get a function form we'll be analyzing
var fn = form.body[0]
fn.id
// => { type: "Identifier", name: "fn" }

// Get names of enclosed references
enclosed(fn)
// => [ "console", "String" ]

Install

npm install isoscope

Readme

Keywords

none

Package Sidebar

Install

npm i isoscope

Weekly Downloads

0

Version

0.0.1

License

none

Last publish

Collaborators

  • gozala