Permalink
Browse files

Move the ‘minimum’ attribute into a separate file

  • Loading branch information...
Baggz committed Mar 9, 2012
1 parent 62e8881 commit 22c22bc77e84ee4e42b1df06092c45657f94f4af
Showing with 15 additions and 0 deletions.
  1. +15 −0 src/engines/json/attributes/minimum.js
@@ -0,0 +1,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);
+ }
+ };
+
+});

0 comments on commit 22c22bc

Please sign in to comment.