Burrito, delicious static-analysis tool for JavaScript


Few hours ago I got introduced to burrito, a JavaScript lib that can analyze JavaScript code in a super simplified way.

I start playing with it and I love it!

https://github.com/substack/node-burrito

It built up to work on top of node.js

Here is a simple example: generating a list of all the functions

var fs = require('fs');
var burrito = require('burrito');
var functionList = [];
fs.readFile('someFile.js', function (err, data) {
	  if (err) throw err;
	  var dataStr = data.toString();
	  burrito(dataStr, function (node) {
		  if (node.name === 'function' || node.name === 'defun'){
                        functionList.push(node.value[0]);
		  }
		});
});

This is fun!

You can even wrap any function-invocation easily utilizing node.wrap(—)..

This makes profiler development much easier than ever before..

Advertisements

One thought on “Burrito, delicious static-analysis tool for JavaScript

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s