load-from-directory
Advanced tools
Comparing version 1.0.2 to 1.0.3
20
index.js
@@ -68,16 +68,26 @@ /** | ||
/** | ||
* Loads all modules from directory, returns array | ||
* Loads all modules from directory, returns object | ||
* @param root_directory Relative path to root_directory where modules should be loaded from | ||
* @param options [{}] See .load() for more information | ||
* @returns {Array} Array containing modules | ||
* @returns {Object} Object containing modules w/key as module_name | ||
*/ | ||
exports.loadArray = function( root_directory, options ) { | ||
exports.loadObject = function( root_directory, options ) { | ||
options = options || {}; | ||
_.defaults( options, { | ||
caller_directory: path.dirname( callsite()[ 1 ].getFileName() ) // Set this here, because when we call load we fuck up the stacke | ||
caller_directory: path.dirname( callsite()[ 1 ].getFileName() ) // Set this here, because when we call load we fuck up the stack | ||
} ); | ||
// Load the modules | ||
var loaded = exports.load( root_directory, options ); | ||
return exports.load( root_directory, options ); | ||
}; | ||
/** | ||
* Loads all modules from directory, returns array | ||
* @param root_directory Relative path to root_directory where modules should be loaded from | ||
* @param options [{}] See .load() for more information | ||
* @returns {Array} Array containing modules | ||
*/ | ||
exports.loadArray = function( root_directory, options ) { | ||
var loaded = exports.loadObject( root_directory, options ); | ||
// Use map to convert the object into a value array | ||
@@ -84,0 +94,0 @@ return _.map( loaded, function( item ) { |
{ | ||
"name": "load-from-directory", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Loads all modules from the given directory into an array", | ||
@@ -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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
10128
8
155
1
32