Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move the ‘minimum’ attribute into a separate file

  • Loading branch information...
commit 22c22bc77e84ee4e42b1df06092c45657f94f4af 1 parent 62e8881
@Baggz authored
Showing with 15 additions and 0 deletions.
  1. +15 −0 src/engines/json/attributes/minimum.js
View
15 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);
+ }
+ };
+
+});
Please sign in to comment.
Something went wrong with that request. Please try again.