Skip to content
Browse files

Move the ‘maximum’ attribute into a separate file

  • Loading branch information...
1 parent 62d5a6a commit ea92433bf68943b427e66e1f5b866a9bb879a0e5 @Baggz committed Mar 9, 2012
Showing with 15 additions and 0 deletions.
  1. +15 −0 src/engines/json/attributes/maximum.js
View
15 src/engines/json/attributes/maximum.js
@@ -0,0 +1,15 @@
+/**
+ * Maximum
+ */
+Validation.prototype.addAttributeConstructor('required', function maximumConstructor() {
+
+ return function maximum(property, propertyValue, attributeValue, propertyAttributes, callback) {
+ if (isNumber(propertyValue)) {
+ var condition = (propertyAttributes.exclusiveMaximum) ? propertyValue < attributeValue : propertyValue <= attributeValue;
+ return (condition) ? callback() : callback(true);
+ } else {
+ return callback(true);
+ }
+ };
+
+});

0 comments on commit ea92433

Please sign in to comment.
Something went wrong with that request. Please try again.