include-all
Advanced tools
Comparing version 0.0.6 to 0.1.0
15
index.js
var fs = require('fs'); | ||
var _ = {}; | ||
_.str = require('underscore.string'); | ||
var ltrim = require('underscore.string').ltrim; | ||
// Returns false if the directory doesn't exist | ||
@@ -38,3 +38,4 @@ module.exports = function requireAll(options) { | ||
excludeDirs: options.excludeDirs, | ||
startDirname: options.startDirname | ||
startDirname: options.startDirname, | ||
dontLoad: options.dontLoad | ||
}); | ||
@@ -62,3 +63,3 @@ | ||
// make sure a slash exists on the left side of path | ||
path = '/' + _.str.ltrim(path,'/'); | ||
path = '/' + ltrim(path,'/'); | ||
@@ -70,4 +71,4 @@ var pathMatch = path.match(options.pathFilter); | ||
// Load module into memory | ||
modules[identity] = require(filepath); | ||
// Load module into memory (unless `dontLoad` is true) | ||
modules[identity] = options.dontLoad ? true : require(filepath); | ||
} | ||
@@ -82,2 +83,2 @@ }); | ||
} | ||
}; | ||
}; |
{ | ||
"name": "include-all", | ||
"version": "0.0.6", | ||
"version": "0.1.0", | ||
"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", |
@@ -7,2 +7,3 @@ # include-all | ||
- the ability to `include-all` a directory as **optional**. | ||
- the ability to recursively stat a directory, instead of actually requiring the modules (via the `dontLoad` option) | ||
- the ability to filter by path, not just filename (pathFilter) | ||
@@ -9,0 +10,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6171
135
45