node package manager


ECMAScript function isolation analyzer


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.

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]
// => { type: "Identifier", name: "fn" } 
// Get names of enclosed references 
// => [ "console", "String" ] 
npm install isoscope