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.7 to 1.1.8

41

lib/express-load.js

@@ -15,3 +15,4 @@ /*!

, path = require('path')
, util = require('util');
, util = require('util')
, async = require('async');

@@ -181,4 +182,8 @@ /**

if (!fs.existsSync(entity)) {
this.__log('No such file or directory found at: ' + entity, 'error');
return false;
if (fs.existsSync(entity + '.js')) {
entity = entity + '.js';
} else {
this.__log('No such file or directory found at: ' + entity, 'error');
return false;
}
}

@@ -198,6 +203,5 @@

for (var s in this.scripts) {
var script = this.scripts[s]
, parts = script.location.split(path.sep)
var self = this;
async.eachSeries(this.scripts, function (script, next) {
var parts = script.location.split(path.sep)
, maps = parts.slice(0)

@@ -208,4 +212,10 @@ , ns = createNamespace(instance, parts)

if (typeof mod === 'function') {
mod = mod.apply(script, arguments);
var notAsync = typeof mod !== 'function' || mod.length < 2;
if (!notAsync) {
mod = mod.call(script, instance, function () {
self.__log('Loaded *.' + map.join('.'));
next();
});
} else if (typeof mod === 'function') {
mod = mod.call(script, instance);
}

@@ -223,6 +233,9 @@

this.__log('Loaded *.' + map.join('.'));
}
return this;
if (notAsync) {
self.__log('Loaded *.' + map.join('.'));
next();
}
}, function () {
self.__log('All things loaded');
});
};

@@ -257,1 +270,3 @@

};
// vim: sw=2 sts=2 ts=2:
{
"name": "express-load",
"description": "Autoload modules into an Express application instance, config, models, routes, controllers etc...",
"version": "1.1.7",
"version": "1.1.8",
"author": {

@@ -25,2 +25,5 @@ "name": "Jarrad Seers",

],
"dependencies": {
"async": "0.2.9"
},
"devDependencies": {

@@ -27,0 +30,0 @@ "express": "3.x"

@@ -91,2 +91,18 @@

### Async load
If you have an async script to load, _express-load_ will pass a `callback` function to your script and wait this function be called to load remain scripts.
```js
load('syncFoo.js').then('asyncBar.js').then('syncBar.js');
// asyncBar.js
module.exports = function (app, callback) {
setTimeout(function () {
console.log('After 5 seconds');
callback();
}, 5000);
};
```
## Logging

@@ -93,0 +109,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