/usr/lib/nodejs/require-all/index.js is in node-require-all 0.0.6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | var fs = require('fs');
module.exports = function requireAll(options) {
var files = fs.readdirSync(options.dirname);
var modules = {};
function excludeDirectory(dirname) {
return options.excludeDirs && dirname.match(options.excludeDirs);
}
files.forEach(function(file) {
var filepath = options.dirname + '/' + file;
if (fs.statSync(filepath).isDirectory()) {
if (excludeDirectory(file)) return;
modules[file] = requireAll({
dirname : filepath,
filter : options.filter,
excludeDirs : options.excludeDirs
});
} else {
var match = file.match(options.filter);
if (!match) return;
modules[match[1]] = require(filepath);
}
});
return modules;
};
|