Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Change the way the ‘minimum’ attribute reports errors

  • Loading branch information...
commit 18f3e7ec6bc7f059380cec5bbc43989e4dcf26dd 1 parent c4938ce
@Baggz authored
Showing with 7 additions and 6 deletions.
  1. +7 −6 src/engines/json/attributes/minimum.js
View
13 src/engines/json/attributes/minimum.js
@@ -2,14 +2,15 @@
* Minimum
*/
Validation.prototype.addAttributeConstructor('minimum', function minimumConstructor() {
-
return function minimum(property, propertyValue, attributeValue, propertyAttributes, callback) {
+
if (isNumber(propertyValue)) {
- var condition = (propertyAttributes.exclusiveMinimum) ? propertyValue > attributeValue : propertyValue >= attributeValue;
- return (condition) ? callback() : callback(true);
- } else {
- return callback(true);
+ if ((propertyAttributes.exclusiveMinimum && propertyValue <= attributeValue) || (propertyValue < attributeValue)) {
+ this.addError();
+ }
}
- };
+ return callback();
+
+ };
});
Please sign in to comment.
Something went wrong with that request. Please try again.