Permalink
Browse files

Move the ‘required’ attribute into a separate file

  • Loading branch information...
1 parent f3c8408 commit 62d5a6a43edc82782b494534a4d6e6c39828088c @Baggz committed Mar 9, 2012
Showing with 14 additions and 0 deletions.
  1. +14 −0 src/engines/json/attributes/required.js
@@ -0,0 +1,14 @@
+/**
+ * Required
+ */
+Validation.prototype.addAttributeConstructor('required', function requiredConstructor() {
+
+ return function required(property, propertyValue, attributeValue, propertyAttributes, callback) {
+ if (attributeValue && isUndefined(propertyValue)) {
+ return callback(true);
+ } else {
+ return callback();
+ }
+ };
+
+});

0 comments on commit 62d5a6a

Please sign in to comment.