load-from-directory
Advanced tools
Comparing version 1.0.3 to 1.1.0
@@ -18,2 +18,5 @@ /** | ||
var filename_split = filename.split( '.' ); | ||
if( filename_split.length === 1 ) { | ||
return filename; | ||
} | ||
filename_split.pop(); // Remove the last thing, which is the extension | ||
@@ -91,2 +94,7 @@ return filename_split.join( '.' ); | ||
exports.loadArray = 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 stack | ||
} ); | ||
var loaded = exports.loadObject( root_directory, options ); | ||
@@ -93,0 +101,0 @@ |
{ | ||
"name": "load-from-directory", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "Loads all modules from the given directory into an array", | ||
@@ -10,3 +10,3 @@ "main": "index.js", | ||
"scripts": { | ||
"test": "node --harmony node_modules/.bin/_mocha --recursive tests/" | ||
"test": "mocha tests/" | ||
}, | ||
@@ -13,0 +13,0 @@ "repository": { |
@@ -27,2 +27,13 @@ /** | ||
} ); | ||
it( 'should load folders', function() { | ||
var modules = load_modules.load( 'test_folder_subdir' ); | ||
assert.equal( Object.keys( modules ).length, 2, 'Should have imported one module' ); | ||
assert.property( modules, 'see_me' ); | ||
assert.property( modules, 'a_dir' ); | ||
assert.property( modules[ 'see_me' ], 'method' ); | ||
assert.property( modules[ 'a_dir' ], 'method' ); | ||
assert.equal( modules[ 'see_me' ].method(), 'method_response' ); | ||
assert.equal( modules[ 'a_dir' ].method(), 'method_response' ); | ||
} ); | ||
} ); | ||
@@ -29,0 +40,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
9
196
9716