node package manager

bloodhound

Build Status

Get the require(name) calls from a string of code. Really all of them.

// returns ["foo", "bar"], no `str` because it's not a string!
require('bloodhound')('require("foo"); require("bar").foo.bar()()().z; require(str)')

// returns an array of three nodes:
// [{type: "string", value: "foo"}, {type: "string", value: "bar"}, {type: "name", value: "str"}]
require('bloodhound')('require("foo"); require("bar").foo.bar()()().z; require(str)', true)