Permalink
Browse files

Move the ‘minItems’ attribute into a separate file

  • Loading branch information...
1 parent 22c22bc commit 9d0f9bc26cbb593b3fd687dc9b2b30a3bc82a347 @Baggz committed Mar 9, 2012
Showing with 14 additions and 0 deletions.
  1. +14 −0 src/engines/json/attributes/minItems.js
@@ -0,0 +1,14 @@
+/**
+ * MinItems
+ */
+Validation.prototype.addAttributeConstructor('minItems', function minItemsConstructor() {
+
+ return function minItems(property, propertyValue, attributeValue, propertyAttributes, callback) {
+ if (isArray(propertyValue) && propertyValue.length >= attributeValue) {
+ return callback();
+ } else {
+ return callback(true);
+ }
+ };
+
+});

0 comments on commit 9d0f9bc

Please sign in to comment.