controller
Advanced tools
Comparing version 0.6.0 to 0.6.1
@@ -66,2 +66,11 @@ var isRegExp = require('util').isRegExp; | ||
// Have run into production problems where controllers are created from different | ||
// instances of the Controller library due to weird dependency installations - | ||
// which means that we can't reference the `Controller` var and do `instanceof`, | ||
// we have to set some kind of constant and check against it. At least, that | ||
// seems like the most sensible way to me. | ||
Object.defineProperty(Controller.prototype, '_type', { | ||
enumerable: false, configurable: false, writable: false, value: '_controller_express_ext' | ||
}); | ||
function collectMiddlewares(scope) { | ||
@@ -77,3 +86,3 @@ var inScope = function(group) { return ~scope.indexOf(group); }; | ||
if (!base) base = []; | ||
if (this.parent instanceof Controller) | ||
if (this.parent && this.parent._type && this.parent._type == this._type) | ||
base = _collectMiddlewares.call(this.parent, scope, base); | ||
@@ -201,4 +210,4 @@ | ||
var createAnonymousGroupName = (function() { | ||
var anonCount = 0; | ||
return function() { return 'anonymous-middleware-group-' + ++anonCount } | ||
var anonSeed = Math.floor(Math.random() * Math.pow(10, 10)); | ||
return function() { return 'anonymous-middleware-group-' + ++anonSeed } | ||
})(); |
{ | ||
"name": "controller", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "an action controller for express", | ||
@@ -5,0 +5,0 @@ "main": "lib/controller.js", |
@@ -283,3 +283,3 @@ var assert = require('assert'); | ||
c1.define('action', ['thing'], routestr('string')); | ||
c1.define('action', ['thing', makemw('mw5')], routestr('string')); | ||
c1.use(makemw('mw1')); | ||
@@ -294,3 +294,3 @@ c0.use('thing', makemw('mw2')); | ||
.expect(200) | ||
.expect('mw4mw1mw2mw3') | ||
.expect('mw4mw1mw2mw3mw5') | ||
.end(done); | ||
@@ -297,0 +297,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
28234
493