Comparing version 0.4.25 to 0.4.26
@@ -230,2 +230,23 @@ /* | ||
/** | ||
* Return validator at the specified position. | ||
* | ||
* @param {String} name Validator name. | ||
* @return {Object|null} Validator object or null if not found. | ||
*/ | ||
Chain.prototype.getValidatorAtPos = function(pos) { | ||
var i, len, validator; | ||
for (i = 0, len = this.validators.length; i < len; i++) { | ||
validator = this.validators[i]; | ||
if (validator.pos === pos) { | ||
return validator; | ||
} | ||
} | ||
return null; | ||
}; | ||
/** | ||
* Add a validator to the end of the array and increase the counter. | ||
@@ -232,0 +253,0 @@ * @param {Object} validator Validator. |
@@ -14,3 +14,3 @@ { | ||
"description": "Serilization and Validation Framework for objects in RESTful APIs", | ||
"version": "0.4.25", | ||
"version": "0.4.26", | ||
"homepage": "https://github.com/racker/node-swiz", | ||
@@ -17,0 +17,0 @@ "repository": { |
@@ -1905,3 +1905,3 @@ /* | ||
exports['test_getValidatorPos_and_hasValidator'] = function(test, assert) { | ||
exports['test_getValidatorPos_hasValidator_and_getValidatorAtPos'] = function(test, assert) { | ||
var v = new V({ | ||
@@ -1923,3 +1923,6 @@ a: C().len(1).isNumeric(), | ||
assert.equal(v.schema.b.getValidatorAtPos(2).name, 'optional'); | ||
assert.equal(v.schema.b.getValidatorAtPos(6), null); | ||
test.finish(); | ||
}; |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
174663
5182
2