Permalink
Browse files

Move the ‘maxLength’ attribute into a separate file

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

0 comments on commit 62e8881

Please sign in to comment.