Socket
Socket
Sign inDemoInstall

load-from-directory

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

load-from-directory - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

tests/test_folder_subdir/a_dir/index.js

8

index.js

@@ -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 @@

4

package.json
{
"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 @@

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