[Pkg-javascript-commits] [node-detective] 80/119: update docs with acorn specifics

Bastien Roucariès rouca at moszumanska.debian.org
Wed Sep 6 09:44:37 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-detective.

commit d8e8d1d64fcf98b2fbb441c1f1dee537f5a00d44
Author: James Halliday <mail at substack.net>
Date:   Wed Nov 19 12:39:34 2014 +0100

    update docs with acorn specifics
---
 readme.markdown | 28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/readme.markdown b/readme.markdown
index 5223d50..e16b3e7 100644
--- a/readme.markdown
+++ b/readme.markdown
@@ -47,23 +47,25 @@ string arguments.
 
 The options parameter `opts` is passed along to `detective.find()`.
 
-## detective.find(src, opts)
+## var found = detective.find(src, opts)
 
-Give some source body `src`, return an object with "strings" and "expressions"
-arrays for each of the require() calls.
+Give some source body `src`, return `found` with:
 
-The "expressions" array will contain the stringified expressions.
+* `found.strings` - an array of each string found in a `require()`
+* `found.expressions` - an array of each stringified expression found in a
+`require()` call
+* `found.nodes` (when `opts.nodes === true`) - an array of AST nodes for each
+argument found in a `require()` call
 
-Optionally you can specify a different function besides `"require"` to analyze
-with `opts.word`.
+Optionally:
 
-You can also specify `opts.nodes = true` in order to include a "nodes" array 
-which contains an AST node for each of the require() calls.
-
-You can use `opts.isRequire(node)` to return a boolean signifying whether an
-esprima AST `node` is a require call.
-
-You can use `opts.parse` to supply options parsed to the parser ([esprima](http://esprima.org/doc/index.html)).
+* `opts.word` - specify a different function name instead of `"require"`
+* `opts.nodes` - when `true`, populate `found.nodes`
+* `opts.isRequire(node)` - a function returning whether an AST node is a require
+call
+* `opts.parse` - supply options directly to
+[acorn](https://npmjs.org/package/acorn) with some support for esprima-style
+options `range` and `loc`
 
 # install
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-detective.git



More information about the Pkg-javascript-commits mailing list