include-all
Advanced tools
Comparing version 1.0.4 to 1.0.5
58
index.js
@@ -32,3 +32,3 @@ /** | ||
////////////////////////////////////////////////////////////////////////////// | ||
// The rest of the methods below are all originally from sails-build-dictionary. | ||
// The four methods below are all originally from sails-build-dictionary. | ||
// They are asynchronous, and besides defaulting certain options, they do a | ||
@@ -46,2 +46,3 @@ // handful of extra things. So it's more than just options getting defaulted! | ||
* | ||
* @async | ||
* @param {Dictionary} options | ||
@@ -61,2 +62,3 @@ * @param {Function} cb | ||
* | ||
* @async | ||
* @param {Dictionary} options | ||
@@ -77,2 +79,3 @@ * @param {Function} cb | ||
* | ||
* @async | ||
* @param {Dictionary} options | ||
@@ -94,2 +97,3 @@ * @param {Function} cb | ||
* | ||
* @async | ||
* @param {Dictionary} options | ||
@@ -104,1 +108,53 @@ * @param {Function} cb | ||
}; | ||
////////////////////////////////////////////////////////////////////////////// | ||
// Finally, this last method is sort of like a recursive `ls`. | ||
// Similarly, it's more or less just a synchronous version of `.exists()`, | ||
// but with a few more specific hard-coded overrides. | ||
////////////////////////////////////////////////////////////////////////////// | ||
/** | ||
* Build a flat dictionary of the matched modules, where the keys are the | ||
* paths, and the values are `true` (fails silently-- returns {} if the | ||
* container cannot be loaded) | ||
* | ||
* @param {Dictionary} options | ||
* @returns {Dictionary} | ||
*/ | ||
module.exports.scanSync = function(options) { | ||
// Higher level overrides. | ||
options.flatten = true; | ||
options.keepDirectoryPath = true; | ||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
// Note: the combination of the following overrides make this | ||
// more or less equivalent to `.exists()`-- but synchronous. | ||
// Not all options work... instead, this is really designed | ||
// for a slightly different kind of use case-- where you want | ||
// to recursively, synchronously stat modules, rather than | ||
// include them. | ||
options.optional = true; | ||
options.dontLoad = true; | ||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||
// Finally, some defaults: | ||
if (!options.excludeDirs) { | ||
options.excludeDirs = /^\.(git|svn)$/; | ||
} | ||
if (!options.depth) { | ||
options.depth = 10; | ||
} | ||
if (!options.filter) { | ||
options.filter = /(.+)$/; | ||
} | ||
// Now call the low-lvl helper. | ||
return helpIncludeAllSync(options); | ||
}; | ||
{ | ||
"name": "include-all", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"description": "An easy way to include all node.js modules within a directory.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
31724
485