@@ -17,6 +17,39 @@ define(["require", "exports", 'aurelia-templating', '../validator', '../validati
17
17
this . lookupFunctions = resources . lookupFunctions ;
18
18
this . getDisplayName = messageProvider . getDisplayName . bind ( messageProvider ) ;
19
19
}
20
+ /**
21
+ * Validates the specified property.
22
+ * @param object The object to validate.
23
+ * @param propertyName The name of the property to validate.
24
+ * @param rules Optional. If unspecified, the rules will be looked up using the metadata
25
+ * for the object created by ValidationRules....on(class/object)
26
+ */
27
+ StandardValidator . prototype . validateProperty = function ( object , propertyName , rules ) {
28
+ return this . validate ( object , propertyName , rules || null ) ;
29
+ } ;
30
+ /**
31
+ * Validates all rules for specified object and it's properties.
32
+ * @param object The object to validate.
33
+ * @param rules Optional. If unspecified, the rules will be looked up using the metadata
34
+ * for the object created by ValidationRules....on(class/object)
35
+ */
36
+ StandardValidator . prototype . validateObject = function ( object , rules ) {
37
+ return this . validate ( object , null , rules || null ) ;
38
+ } ;
39
+ /**
40
+ * Determines whether a rule exists in a set of rules.
41
+ * @param rules The rules to search.
42
+ * @parem rule The rule to find.
43
+ */
44
+ StandardValidator . prototype . ruleExists = function ( rules , rule ) {
45
+ var i = rules . length ;
46
+ while ( i -- ) {
47
+ if ( rules [ i ] . indexOf ( rule ) !== - 1 ) {
48
+ return true ;
49
+ }
50
+ }
51
+ return false ;
52
+ } ;
20
53
StandardValidator . prototype . getMessage = function ( rule , object , value ) {
21
54
var expression = rule . message || this . messageProvider . getMessage ( rule . messageKey ) ;
22
55
var _a = rule . property , propertyName = _a . name , displayName = _a . displayName ;
@@ -88,25 +121,6 @@ define(["require", "exports", 'aurelia-templating', '../validator', '../validati
88
121
}
89
122
return this . validateRuleSequence ( object , propertyName , rules , 0 ) ;
90
123
} ;
91
- /**
92
- * Validates the specified property.
93
- * @param object The object to validate.
94
- * @param propertyName The name of the property to validate.
95
- * @param rules Optional. If unspecified, the rules will be looked up using the metadata
96
- * for the object created by ValidationRules....on(class/object)
97
- */
98
- StandardValidator . prototype . validateProperty = function ( object , propertyName , rules ) {
99
- return this . validate ( object , propertyName , rules || null ) ;
100
- } ;
101
- /**
102
- * Validates all rules for specified object and it's properties.
103
- * @param object The object to validate.
104
- * @param rules Optional. If unspecified, the rules will be looked up using the metadata
105
- * for the object created by ValidationRules....on(class/object)
106
- */
107
- StandardValidator . prototype . validateObject = function ( object , rules ) {
108
- return this . validate ( object , null , rules || null ) ;
109
- } ;
110
124
StandardValidator . inject = [ validation_messages_1 . ValidationMessageProvider , aurelia_templating_1 . ViewResources ] ;
111
125
return StandardValidator ;
112
126
} ( validator_1 . Validator ) ) ;
0 commit comments