Permalink
Browse files

Move the ‘minLength’ attribute into a separate file

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

0 comments on commit a900248

Please sign in to comment.