{
  "name": "burrito",
  "description": "Wrap up expressions with a trace function while walking the AST with rice and beans on the side",
  "version": "0.2.12",
  "repository": {
    "type": "git",
    "url": "git://github.com/substack/node-burrito.git"
  },
  "main": "./index.js",
  "keywords": [
    "trace",
    "ast",
    "walk",
    "syntax",
    "source",
    "tree",
    "uglify"
  ],
  "directories": {
    "lib": ".",
    "example": "example",
    "test": "test"
  },
  "scripts": {
    "test": "tap test/*.js"
  },
  "dependencies": {
    "traverse": "~0.5.1",
    "uglify-js": "~1.1.1"
  },
  "devDependencies": {
    "tap": "~0.2.5"
  },
  "engines": {
    "node": ">=0.4.0"
  },
  "license": "BSD",
  "author": {
    "name": "James Halliday",
    "email": "mail@substack.net",
    "url": "http://substack.net"
  },
  "readme": "burrito\n=======\n\nBurrito makes it easy to do crazy stuff with the javascript AST.\n\nThis is super useful if you want to roll your own stack traces or build a code\ncoverage tool.\n\n[![build status](https://secure.travis-ci.org/substack/node-burrito.png)](http://travis-ci.org/substack/node-burrito)\n\n![node.wrap(\"burrito\")](http://substack.net/images/burrito.png)\n\nexamples\n========\n\nmicrowave\n---------\n\nexamples/microwave.js\n\n````javascript\nvar burrito = require('burrito');\n\nvar res = burrito.microwave('Math.sin(2)', function (node) {\n    if (node.name === 'num') node.wrap('Math.PI / %s');\n});\n\nconsole.log(res); // sin(pi / 2) == 1\n````\n\noutput:\n\n    1\n\nwrap\n----\n\nexamples/wrap.js\n\n````javascript\nvar burrito = require('burrito');\n\nvar src = burrito('f() && g(h())\\nfoo()', function (node) {\n    if (node.name === 'call') node.wrap('qqq(%s)');\n});\n\nconsole.log(src);\n````\n\noutput:\n\n    qqq(f()) && qqq(g(qqq(h())));\n\n    qqq(foo());\n\nmethods\n=======\n\n    var burrito = require('burrito');\n\nburrito(code, cb)\n-----------------\n\nGiven some source `code` and a function `trace`, walk the ast by expression.\n\nThe `cb` gets called with a node object described below.\n\nIf `code` is an Array then it is assumbed to be an AST which you can generate\nyourself with `burrito.parse()`. The AST must be annotated, so make sure to\n`burrito.parse(src, false, true)`.\n\nburrito.microwave(code, context={}, cb)\n---------------------------------------\n\nLike `burrito()` except the result is run using\n`vm.runInNewContext(res, context)`.\n\nnode object\n===========\n\nnode.name\n---------\n\nName is a string that contains the type of the expression as named by uglify.\n\nnode.wrap(s)\n------------\n\nWrap the current expression in `s`.\n\nIf `s` is a string, `\"%s\"` will be replaced with the stringified current\nexpression.\n\nIf `s` is a function, it is called with the stringified current expression and\nshould return a new stringified expression.\n\nIf the `node.name === \"binary\"`, you get the subterms \"%a\" and \"%b\" to play with\ntoo. These subterms are applied if `s` is a function too: `s(expr, a, b)`.\n\nProtip: to insert multiple statements you can use javascript's lesser-known block\nsyntax that it gets from C:\n\n````javascript\nif (node.name === 'stat') node.wrap('{ foo(); %s }')\n````\n\nnode.node\n---------\n\nraw ast data generated by uglify\n\nnode.value\n----------\n\n`node.node.slice(1)` to skip the annotations\n\nnode.start\n----------\n\nThe start location of the expression, like this:\n\n````javascript\n{ type: 'name',\n  value: 'b',\n  line: 0,\n  col: 3,\n  pos: 3,\n  nlb: false,\n  comments_before: [] }\n````\n\nnode.end\n--------\n\nThe end  location of the expression, formatted the same as `node.start`.\n\nnode.state\n----------\n\nThe state of the traversal using traverse.\n\nnode.source()\n-------------\n\nReturns a stringified version of the expression.\n\nnode.parent()\n-------------\n\nReturns the parent `node` or `null` if the node is the root element.\n\nnode.label()\n------------\n\nReturn the label of the present node or `null` if there is no label.\n\nLabels are returned for \"call\", \"var\", \"defun\", and \"function\" nodes.\n\nReturns an array for \"var\" nodes since `var` statements can\ncontain multiple labels in assignment.\n\ninstall\n=======\n\nWith [npm](http://npmjs.org) you can just:\n\n    npm install burrito\n\nin the browser\n==============\n\nBurrito works in browser with\n[browserify](https://github.com/substack/node-browserify).\n\nIt has been tested against:\n\n* Internet Explorer 5.5, 6.0, 7.0, 8.0, 9.0\n* Firefox 3.5\n* Chrome 6.0\n* Opera 10.6\n* Safari 5.0\n\nkudos\n=====\n\nHeavily inspired by (and previously mostly lifted outright from) isaacs's nifty\ntmp/instrument.js thingy from uglify-js.\n",
  "readmeFilename": "README.markdown",
  "bugs": {
    "url": "https://github.com/substack/node-burrito/issues"
  },
  "homepage": "https://github.com/substack/node-burrito",
  "_id": "burrito@0.2.12",
  "_from": "burrito@>=0.2.5 <0.3"
}
