{ "name": "detective", "description": "find all require() calls by walking the AST", "version": "2.1.2", "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": { "esprima": "1.0.2", "escodegen": "0.0.15" }, "devDependencies": { "tap": "~0.4.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## detective.find(src, opts)\n\nGive some source body `src`, return an object with \"strings\" and \"expressions\"\narrays for each of the require() calls.\n\nThe \"expressions\" array will contain the stringified expressions.\n\nOptionally you can specify a different function besides `\"require\"` to analyze\nwith `opts.word`.\n\nYou can also specify `opts.nodes = true` in order to include a \"nodes\" array \nwhich contains an AST node for each of the require() calls.\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" }, "_id": "detective@2.1.2", "dist": { "shasum": "7362998e62d82ec185e1a8ad5bf0f60323c7de7e" }, "_from": "detective@~2.1.1", "_resolved": "https://registry.npmjs.org/detective/-/detective-2.1.2.tgz" }