Socket
Socket
Sign inDemoInstall

express-load

Package Overview
Dependencies
1
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.8 to 1.1.9

examples/cwd/app.js

27

lib/express-load.js

@@ -28,5 +28,11 @@ /*!

var extlist = ['.js', '.node', '.json', '.coffee', '.sjs'];
var checkext = true;
var checkext = true
, extlist = ['.js', '.node', '.json', '.coffee', '.sjs'];
for (var ext in require.extensions) {
if (require.extensions.hasOwnProperty(ext) && extlist.indexOf(ext) === -1) {
extlist.push(ext);
}
}
/**

@@ -37,3 +43,3 @@ * ExpressLoad constructor.

var ExpressLoad = function(entity, options) {
var options = options || {};
options = options || {};
options.checkext = options.checkext || checkext;

@@ -43,2 +49,4 @@ options.extlist = options.extlist || extlist;

options.logger = options.logger || console;
options.ignore = options.ignore || false;
options.cwd = options.cwd || '';

@@ -61,3 +69,4 @@ this.options = options;

var entity = this.__getEntity(location);
var loc = this.options.cwd ? this.options.cwd + '/' + location : location;
var entity = this.__getEntity(loc);

@@ -80,2 +89,7 @@ if (entity) {

if (allow && this.options.ignore && dir[file].search(this.options.ignore) != -1) {
this.__log('Ignoring file: ingore option match ' + dir[file], 'warn');
allow = false;
}
if (allow && fs.statSync(script).isDirectory()) {

@@ -201,6 +215,7 @@ this.then(path.join(location, dir[file]));

* @param instance {Object} Express application instance.
* @param [done] {Function} Callback function.
* @return this {Object} this ExpressLoad instance.
*/
ExpressLoad.prototype.into = function(instance) {
ExpressLoad.prototype.into = function(instance, done) {

@@ -241,2 +256,4 @@ var self = this;

self.__log('All things loaded');
if(typeof done === 'function')
done(null, instance);
});

@@ -243,0 +260,0 @@ };

5

package.json
{
"name": "express-load",
"description": "Autoload modules into an Express application instance, config, models, routes, controllers etc...",
"version": "1.1.8",
"version": "1.1.9",
"author": {

@@ -14,3 +14,4 @@ "name": "Jarrad Seers",

{"name": "Jean-Matthieu Barbier", "email": "jm.barbier+github@solidev.net"},
{"name": "perfectworks", "email": "perfectworks@gmail.com"}
{"name": "perfectworks", "email": "perfectworks@gmail.com"},
{"name": "popomore", "email": "sakura9515@gmail.com"}
],

@@ -17,0 +18,0 @@ "main": "index",

@@ -107,2 +107,14 @@

If you need to know when async load is complete, you may pass the callback function as a second argument to ```into```. The callback get called when async load is completed.
```js
load('models')
.then('collections')
.then('controllers')
.into(app, function(err, instance) {
if(err) throw err;
app.listen(app.get('port'));
});
```
## Logging

@@ -149,2 +161,6 @@

### Base directory
Express-load load scripts based on relative directory, however you can use `cwd` option if you want to load based on the other directory. see [example](https://github.com/jarradseers/express-load/tree/master/examples/cwd).
### Getting the Express Application instance

@@ -151,0 +167,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc