Skip to content

Gozala/isoscope

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 JS AST nodes 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

About

ECMAScript function isolation analyzer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published