{"_id":"sleuth","_rev":"398850","name":"sleuth","description":"Discover the variable names chosen for each of a file's top-level required modules","dist-tags":{"latest":"0.1.1"},"maintainers":[{"name":"hughsk","email":"hughskennedy@gmail.com"}],"time":{"modified":"2021-08-04T04:23:43.000Z","created":"2014-02-18T15:11:54.379Z","0.1.1":"2014-06-29T02:20:23.382Z","0.1.0":"2014-02-19T14:47:22.763Z","0.0.0":"2014-02-18T15:11:54.379Z"},"users":{},"author":{"name":"Hugh Kennedy","email":"hughskennedy@gmail.com","url":"http://hughsk.io/"},"repository":{"type":"git","url":"git://github.com/hughsk/sleuth"},"versions":{"0.1.1":{"name":"sleuth","description":"Discover the variable names chosen for each of a file's top-level required modules","version":"0.1.1","main":"index.js","browser":"index.js","dependencies":{"is-require":"0.0.1","static-eval":"~0.1.0"},"devDependencies":{"esprima":"~1.0.4","tape":"~2.4.2"},"scripts":{"test":"node test"},"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"],"gitHead":"22e5ea466d1b95035744bfe3d7b3ab8663ffb8f4","_id":"sleuth@0.1.1","_shasum":"406efb86730ba5c27147b570186d72c83b0d8cc0","_from":".","_npmVersion":"1.4.13","_npmUser":{"name":"hughsk","email":"hughskennedy@gmail.com"},"maintainers":[{"name":"hughsk","email":"hughskennedy@gmail.com"}],"dist":{"shasum":"406efb86730ba5c27147b570186d72c83b0d8cc0","size":2593,"noattachment":false,"key":"/sleuth/-/sleuth-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/sleuth/download/sleuth-0.1.1.tgz"},"directories":{},"publish_time":1404008423382,"_cnpm_publish_time":1404008423382,"_hasShrinkwrap":false},"0.1.0":{"name":"sleuth","description":"Discover the variable names chosen for each of a file's top-level required modules","version":"0.1.0","main":"index.js","browser":"index.js","dependencies":{"is-require":"0.0.0","static-eval":"~0.1.0"},"devDependencies":{"esprima":"~1.0.4","tape":"~2.4.2"},"scripts":{"test":"node test"},"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.1.0","dist":{"shasum":"4cdcc3dfd53b96b2d4da07c2122e5b266a8a3635","size":2618,"noattachment":false,"key":"/sleuth/-/sleuth-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/sleuth/download/sleuth-0.1.0.tgz"},"_from":".","_npmVersion":"1.4.2","_npmUser":{"name":"hughsk","email":"hughskennedy@gmail.com"},"maintainers":[{"name":"hughsk","email":"hughskennedy@gmail.com"}],"directories":{},"publish_time":1392821242763,"_cnpm_publish_time":1392821242763,"_hasShrinkwrap":false},"0.0.0":{"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","size":2582,"noattachment":false,"key":"/sleuth/-/sleuth-0.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/sleuth/download/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":{},"publish_time":1392736314379,"_cnpm_publish_time":1392736314379,"_hasShrinkwrap":false}},"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","_attachments":{},"homepage":"https://github.com/hughsk/sleuth","bugs":{"url":"https://github.com/hughsk/sleuth/issues"},"license":"MIT"}