Socket
Socket
Sign inDemoInstall

require-all

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

require-all - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

test/.test.js.un~

18

index.js
var fs = require('fs');
module.exports = function requireAll(options) {
var files = fs.readdirSync(options.dirname);
var files = fs.readdirSync(options.dirname);
var modules = {};
files.forEach(function(file) {
var match = file.match(options.filter);
if (!match) return;
var filepath = options.dirname + '/' + file;
if (fs.statSync(filepath).isDirectory()) {
modules[file] = requireAll({
dirname: filepath,
filter: options.filter
});
var moduleName = match[1];
modules[moduleName] = require(options.dirname + '/' + moduleName);
} else {
var match = file.match(options.filter);
if (!match) return;
modules[match[1]] = require(filepath);
}
});

@@ -14,0 +22,0 @@

@@ -5,3 +5,3 @@ {

"description": "An easy way to require all files within a directory.",
"version": "0.0.1",
"version": "0.0.2",
"repository": {

@@ -8,0 +8,0 @@ "url": ""

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc