Skip to content
Browse files

Minor improvements to the ‘minLength’ attribute

  • Loading branch information...
1 parent 48e12d2 commit 09a185d5b51418206517844269e684ca614a7066 @Baggz committed Mar 9, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/engines/json/attributes.js
View
8 src/engines/json/attributes.js
@@ -10,7 +10,7 @@ Validation.prototype.attributes = {
required: function requiredConstructor() {
return function required(property, propertyValue, attributeValue, propertyAttributes, callback) {
- if (attributeValue && propertyValue === undefined) {
+ if (attributeValue && isUndefined(propertyValue)) {
return callback(true);
} else {
return callback();
@@ -132,7 +132,11 @@ Validation.prototype.attributes = {
*/
minLength: function minLengthConstructor() {
return function minLength(property, propertyValue, attributeValue, propertyAttributes, callback) {
- return (typeof propertyValue === 'string' && propertyValue.length >= attributeValue) ? callback() : callback(true);
+ if (isString(propertyValue) && propertyValue.length >= attributeValue) {
+ return callback();
+ } else {
+ return callback(true);
+ }
};
},

0 comments on commit 09a185d

Please sign in to comment.
Something went wrong with that request. Please try again.