{"name":"sleuth","description":"Like detective, find all calls to require by walking the AST, however also supply the variable name used if available","version":"0.0.0","main":"index.js","browser":"index.js","dependencies":{"is-require":"0.0.0","static-eval":"~0.1.0","astw":"~0.1.0"},"devDependencies":{"esprima":"~1.0.4","tape":"~2.4.2"},"scripts":{},"author":{"name":"Hugh Kennedy","email":"hughskennedy@gmail.com","url":"http://hughsk.io/"},"license":"MIT","repository":{"type":"git","url":"git://github.com/hughsk/sleuth"},"bugs":{"url":"https://github.com/hughsk/sleuth/issues"},"homepage":"https://github.com/hughsk/sleuth","keywords":["analyse","discover","detect","detective","require","ast","esprima","parse","module"],"_id":"sleuth@0.0.0","dist":{"shasum":"b33c12688a5c7f01fca9863dd95db629a03af31b","tarball":"http://registry-npm.ywwl.com/sleuth/download/sleuth-0.0.0.tgz","integrity":"sha512-3LrHCyWu3mqsuB1JY0mTa2gJhAh85sdY1pQOT5IEQdy8jROV1K6QMV0nmUAQ7ibTYlB33tSWoO9WVt09fzwktQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCrDpZNcmQeY9f+deL6m78SbpkXqyBcAdetBVuGSTIYAAIhALTRYs1XX35y8xkG4IJY186JNZE/lJEc8DawdGNnnD4+"}],"size":2582,"noattachment":false,"key":"/sleuth/-/sleuth-0.0.0.tgz"},"_from":".","_npmVersion":"1.4.2","_npmUser":{"name":"hughsk","email":"hughskennedy@gmail.com"},"maintainers":[{"name":"hughsk","email":"hughskennedy@gmail.com"}],"directories":{},"readme":"# sleuth [![Flattr this!](https://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=hughskennedy&url=http://github.com/hughsk/sleuth&title=sleuth&description=hughsk/sleuth%20on%20GitHub&language=en_GB&tags=flattr,github,javascript&category=software)[![experimental](http://hughsk.github.io/stability-badges/dist/experimental.svg)](http://github.com/hughsk/stability-badges) #\n\nDiscover the variable names chosen for each of a file's top-level required\nmodules.\n\nWon't pick up nested requires in if/for statements or inside functions, but is\nintended for detecting the names of variables to replace e.g. when creating\ninlining transforms such as [brfs](http://github.com/substack/brfs).\n\n## Usage ##\n\n[![sleuth](https://nodei.co/npm/sleuth.png?mini=true)](https://nodei.co/npm/sleuth)\n\n### `requires = sleuth(ast)` ###\n\nAccepts an [esprima](http://github.com/ariya/esprima)-like `ast` object.\n\nReturns an object whose keys represent the variable names used to require a\nmodule, and whose values are the required module strings detected.\n\n## Example ##\n\n``` javascript\nvar esprima = require('esprima')\nvar walkers = require('astw')\nvar files = require('fs')\n\nvar src = files.readFileSync(__filename, 'utf8')\nvar ast = esprima.parse(src)\n\n// Walk the generated AST\nvar result = sleuth(ast)\nconsole.log(result)\n\n// Or you can try it this way:\nvar result = sleuth(walkers(src))\nconsole.log(result)\n```\n\nWhich should give you back something like this:\n\n``` javascript\n{\n  esprima: 'esprima',\n  walkers: 'astw',\n  files: 'fs'\n}\n```\n\n## License ##\n\nMIT. See [LICENSE.md](http://github.com/hughsk/sleuth/blob/master/LICENSE.md) for details.\n","publish_time":1392736314379,"_cnpm_publish_time":1392736314379,"dist-tags":{"latest":"0.1.1"}}