Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

upgrade readme

  • Loading branch information...
commit d3b2da5b78797f2235956914a707dd093fca6f47 1 parent aa50907
@substack authored
Showing with 29 additions and 25 deletions.
  1. +29 −25 README.markdown → readme.markdown
View
54 README.markdown → readme.markdown
@@ -1,56 +1,53 @@
-detective
-=========
+# detective
-Find all calls to require() no matter how crazily nested using a proper walk of
-the AST.
+find all calls to `require()` by walking the AST
[![build status](https://secure.travis-ci.org/substack/node-detective.png)](http://travis-ci.org/substack/node-detective)
-example
-=======
+# example
-strings
--------
+## strings
strings_src.js:
-````javascript
+``` js
var a = require('a');
var b = require('b');
var c = require('c');
-````
+```
strings.js:
-````javascript
+``` js
var detective = require('detective');
var fs = require('fs');
var src = fs.readFileSync(__dirname + '/strings_src.js');
var requires = detective(src);
console.dir(requires);
-````
+```
output:
- $ node examples/strings.js
- [ 'a', 'b', 'c' ]
+```
+$ node examples/strings.js
+[ 'a', 'b', 'c' ]
+```
-methods
-=======
+# methods
+``` js
var detective = require('detective');
+```
-detective(src, opts)
---------------------
+## detective(src, opts)
-Give some source body `src`, return an array of all the require()s with string
-arguments.
+Give some source body `src`, return an array of all the `require()` calls with
+string arguments.
The options parameter `opts` is passed along to `detective.find()`.
-detective.find(src, opts)
--------------------------
+## detective.find(src, opts)
Give some source body `src`, return an object with "strings" and "expressions"
arrays for each of the require() calls.
@@ -60,7 +57,14 @@ The "expressions" array will contain the stringified expressions.
Optionally you can specify a different function besides `"require"` to analyze
with `opts.word`.
-installation
-============
+# install
- npm install detective
+With [npm](https://npmjs.org) do:
+
+```
+npm install detective
+```
+
+# license
+
+MIT
Please sign in to comment.
Something went wrong with that request. Please try again.