{"name":"detective","description":"find all require() calls by walking the AST","version":"4.3.1","repository":{"type":"git","url":"git://github.com/substack/node-detective.git"},"main":"index.js","keywords":["require","source","analyze","ast"],"scripts":{"test":"tap test/*.js"},"dependencies":{"acorn":"^1.0.3","defined":"^1.0.0"},"devDependencies":{"tap":"^1.0.0"},"license":"MIT","author":{"name":"James Halliday","email":"mail@substack.net","url":"http://substack.net"},"readme":"# detective\n\nfind all calls to `require()` by walking the AST\n\n[![build status](https://secure.travis-ci.org/substack/node-detective.png)](http://travis-ci.org/substack/node-detective)\n\n# example\n\n## strings\n\nstrings_src.js:\n\n``` js\nvar a = require('a');\nvar b = require('b');\nvar c = require('c');\n```\n\nstrings.js:\n\n``` js\nvar detective = require('detective');\nvar fs = require('fs');\n\nvar src = fs.readFileSync(__dirname + '/strings_src.js');\nvar requires = detective(src);\nconsole.dir(requires);\n```\n\noutput:\n\n```\n$ node examples/strings.js\n[ 'a', 'b', 'c' ]\n```\n\n# methods\n\n``` js\nvar detective = require('detective');\n```\n\n## detective(src, opts)\n\nGive some source body `src`, return an array of all the `require()` calls with\nstring arguments.\n\nThe options parameter `opts` is passed along to `detective.find()`.\n\n## var found = detective.find(src, opts)\n\nGive some source body `src`, return `found` with:\n\n* `found.strings` - an array of each string found in a `require()`\n* `found.expressions` - an array of each stringified expression found in a\n`require()` call\n* `found.nodes` (when `opts.nodes === true`) - an array of AST nodes for each\nargument found in a `require()` call\n\nOptionally:\n\n* `opts.word` - specify a different function name instead of `\"require\"`\n* `opts.nodes` - when `true`, populate `found.nodes`\n* `opts.isRequire(node)` - a function returning whether an AST `CallExpression`\nnode is a require call\n* `opts.parse` - supply options directly to\n[acorn](https://npmjs.org/package/acorn) with some support for esprima-style\noptions `range` and `loc`\n\n# install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install detective\n```\n\n# license\n\nMIT\n","readmeFilename":"readme.markdown","bugs":{"url":"https://github.com/substack/node-detective/issues"},"homepage":"https://github.com/substack/node-detective","_id":"detective@4.3.1","_shasum":"9fb06dd1ee8f0ea4dbcc607cda39d9ce1d4f726f","_from":"https://registry.npmjs.org/detective/-/detective-4.3.1.tgz","_resolved":"https://registry.npmjs.org/detective/-/detective-4.3.1.tgz"}