Socket
Socket
Sign inDemoInstall

include-all

Package Overview
Dependencies
Maintainers
2
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

include-all - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

33

index.js

@@ -58,2 +58,5 @@ var fs = require('fs');

markDirectories: options.markDirectories,
flattenDirectories: options.flattenDirectories,
keepDirectoryPath: options.keepDirectoryPath,
force: options.force,

@@ -65,6 +68,25 @@ // Keep track of depth

if (options.markDirectories) {
if (options.markDirectories || options.flattenDirectories) {
modules[file].isDirectory = true;
}
if (options.flattenDirectories) {
modules = (function flattenDirectories(modules, accum, path) {
accum = accum || {};
Object.keys(modules).forEach(function(identity) {
if (typeof(modules[identity]) !== 'object') {
return;
}
if (modules[identity].isDirectory) {
flattenDirectories(modules[identity], accum, path ? path + '/' + identity : identity );
} else {
accum[options.keepDirectoryPath ? (path ? path + '/' + identity : identity) : identity] = modules[identity];
}
});
return accum;
})(modules);
}
}

@@ -99,2 +121,11 @@ // For files, go ahead and add the code to the module map

modules[identity] = options.dontLoad ? true : require(filepath);
if (options.dontLoad) {
modules[identity] = true;
} else {
if (options.force) {
var resolved = require.resolve(filepath);
if (require.cache[resolved]) delete require.cache[resolved];
}
modules[identity] = require(filepath);
}
}

@@ -101,0 +132,0 @@ });

2

package.json
{
"name": "include-all",
"version": "0.1.2",
"version": "0.1.3",
"description": "An easy way to include all node.js modules within a directory. This is a fork of felixge's awesome module, require-all (https://github.com/felixge/node-require-all) which adds the ability to mark an include as **optional**.",

@@ -5,0 +5,0 @@ "main": "index.js",

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