req-requires
Advanced tools
Comparing version 0.0.6 to 0.0.7
var requiredProperty = require('./requiredProperty'); | ||
var defaultAssertions = require('./defaultAssertions'); | ||
require('./defaultAssertions'); | ||
@@ -24,3 +24,3 @@ module.exports.setup = function(req, res, next){ | ||
self.property = function(name){ | ||
return new requiredProperty(this, name); | ||
return new requiredProperty(name, self.getProperty(name), self.assertFail); | ||
} | ||
@@ -27,0 +27,0 @@ |
@@ -1,13 +0,13 @@ | ||
var requiredProperty = function(requiresContext, propertyName){ | ||
this.context = requiresContext; | ||
var requiredProperty = function(propertyName, propertyValue, assertFailed){ | ||
this.name = propertyName; | ||
this.value = this.context.getProperty(this.name); | ||
this.value = propertyValue; | ||
this.assert = function(assertionText, assertion){ | ||
if(!assertion()) | ||
assertFailed('Expected '+this.name+' '+assertionText); | ||
} | ||
return this; | ||
} | ||
requiredProperty.prototype.assert = function(assertionText, assertion){ | ||
if(!assertion()) | ||
this.context.assertFail('Expected '+this.name+' '+assertionText); | ||
} | ||
module.exports = requiredProperty; |
{ | ||
"name": "req-requires", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Add assertions to ExpressJS middleware", | ||
@@ -5,0 +5,0 @@ "main": "./lib/req-requires.js", |
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
28802
14
73