Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
This module provides a way to synchronously load multiple Node.js modules using glob pattern matching.
Require all sibling modules (relative to this module):
var results = grequire(module, "./*.js")
console.log(results)
Output:
[{
filename: './sibling-1.js',
exports: { /* exports of sibling-1 */ }
}, {
filename: './sibling-2.js',
exports: { /* exports of sibling-2 */ }
}]
Also see the spec, it shows many different combinations of parameters, with comments.
grequire([module, ] pattern [, globOpts])
module
The module object
that requires should be performed on behalf of. Usually this should be the free module
variable, like in the example above.
pattern
, globOpts
The glob pattern and options to use when matching files. See the
node-glob documentation.
Returns an array of items, where each item corresponds to one require
d module, and
has the following contents:
{
/**
* The filename of the loaded module. It may be absolute or relative,
* depending on the pattern. See test/index.js for examples.
*/
filename: String,
/**
* The loaded module's exports.
*/
exports: AnyObject
}
This module is written in ES6, and ES5 code is generated using Babel.
If you live in the future or use Babel (or some other transpiler), you may want to load the non-transpiled ES6 code:
import grequire from 'grequire/es6'
MIT
FAQs
Synchronous require of multiple modules that match a given glob pattern
The npm package grequire receives a total of 1 weekly downloads. As such, grequire popularity was classified as not popular.
We found that grequire demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.