Permalink
Browse files

Move the ‘maxItems’ attribute into a separate file

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

0 comments on commit 9c3888d

Please sign in to comment.