Socket
Socket
Sign inDemoInstall

require-directory

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

require-directory - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

10

index.js
var fs = require('fs');
var join = require('path').join;
var resolve = require('path').resolve;
var requireDirectory = function(m, path){
var retval = {};
path = resolve(path);
fs.readdirSync(path).forEach(function(filename){
if(fs.statSync(path + filename).isDirectory()){
retval[filename] = requireDirectory(m, path + filename + '/');
var joined = join(path, filename);
if(fs.statSync(joined).isDirectory()){
retval[filename] = requireDirectory(m, joined);
}else{
var name = filename.substring(0, filename.lastIndexOf('.'));
retval[name] = m.require(path + filename);
retval[name] = m.require(joined);
}

@@ -12,0 +16,0 @@ });

{
"author": "Troy Goode <troygoode@gmail.com> (http://github.com/troygoode/)",
"name": "require-directory",
"version": "0.0.1",
"version": "0.0.2",
"description": "Recursively iterates over specified directory, requiring each file, and returning a nested hash structure containing those libraries.",

@@ -6,0 +6,0 @@ "keywords": ["require", "directory", "library", "recursive"],

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