0.4.0 • Published 9 years ago

acquire v0.4.0

Weekly downloads
11
License
MIT
Repository
github
Last release
9 years ago

npm

acquire

Build Status Dependency Status

Using Node module resolution algorithm, discover node_modules directory and require or require.resolve all modules in it.

API

acquire([opts])

Require all modules in node_modules, starting from opts.basedir.

Returns object of all the modules required:

{
  foo: require(path_to_foo),
  bar: require(path_to_bar)
}
OptionTypeRequired?Default
basedirstringNo__dirname
depthnumberNo1
ignorestring/stringNo[]
skipFailuresboolean/functionNofalse

If opts.depth is finite, it specifies the number of node_modules directories up the directory tree to traverse into. If opts.depth is Infinity, traversal ends at the file system root.

opts.ignore specifies module names to ignore.

If opts.skipFailures is true, modules that fail to require() (e.g. plugins for Grunt) are skipped. If opts.skipFailures is a function, it is called as opts.skipFailures(moduleName, modulePath) for each failure.

acquire.resolve([opts])

Require.resolve all modules in node_modules, starting from opts.basedir.

Returns object of all the modules and corresponding paths:

{
  foo: path_to_foo,
  bar: path_to_bar
}

Install

npm install acquire

License

MIT