new Rule(field, constraintName, params)
Representation of a rule
Parameters:
Name | Type | Description |
---|---|---|
field |
String | Field name |
constraintName |
String | Constraint name, used to retrieve function to execute |
params |
JSON |
Methods
-
AssertFalse(value, params) → {boolean}
-
Constraint: AssertFalse
Parameters:
Name Type Description value
String | Array.<String> params
JSON Returns:
- Type
- boolean
-
AssertTrue(value, params) → {boolean}
-
Constraint: AssertTrue
Parameters:
Name Type Description value
String | Array.<String> params
JSON Returns:
- Type
- boolean
-
DecimalMax(value, params) → {boolean}
-
Constraint: DecimalMax
Parameters:
Name Type Description value
String | Array.<String> params
JSON Returns:
- Type
- boolean
-
DecimalMin(value, params) → {boolean}
-
Constraint: DecimalMin
Parameters:
Name Type Description value
String | Array.<String> params
JSON Returns:
- Type
- boolean
-
Digits(value, params) → {boolean}
-
Constraint: Digits
Parameters:
Name Type Description value
String | Array.<String> params
JSON Returns:
- Type
- boolean
-
Email(value, params) → {boolean}
-
Constraint: Email
Parameters:
Name Type Description value
String | Array.<String> params
JSON Returns:
- Type
- boolean
-
Future(value, params, fieldName, config) → {boolean}
-
Constraint: Future
Parameters:
Name Type Description value
String | Array.<String> params
JSON fieldName
String config
JSON Returns:
- Type
- boolean
-
getErrorMessage() → {String}
-
Get the rule error message
Returns:
- Type
- String
-
getPropertyValue(propertyName) → {String|Array.<String>}
-
Get the field value
Parameters:
Name Type Description propertyName
String Field name Returns:
- Type
- String | Array.<String>
-
Length(value, params) → {boolean}
-
Constraint: Length
Parameters:
Name Type Description value
String | Array.<String> params
JSON Returns:
- Type
- boolean
-
Max(value, params) → {boolean}
-
Constraint: Max
Parameters:
Name Type Description value
String | Array.<String> params
JSON Returns:
- Type
- boolean
-
Min(value, params) → {boolean}
-
Constraint: Min
Parameters:
Name Type Description value
String | Array.<String> params
JSON Returns:
- Type
- boolean
-
NotEmpty(value, params) → {boolean}
-
Constraint: NotEmpty
Parameters:
Name Type Description value
String | Array.<String> params
JSON Returns:
- Type
- boolean
-
NotNull(value, params) → {boolean}
-
Constraint: NotNull
Parameters:
Name Type Description value
String | Array.<String> params
JSON Returns:
- Type
- boolean
-
Null(value, params) → {boolean}
-
Constraint: Null
Parameters:
Name Type Description value
String | Array.<String> params
JSON Returns:
- Type
- boolean
-
Past(value, params, fieldName, config) → {boolean}
-
Constraint: Past
Parameters:
Name Type Description value
String | Array.<String> params
JSON fieldName
String config
JSON Returns:
- Type
- boolean
-
Pattern(value, params) → {boolean}
-
Constraint: Pattern
Parameters:
Name Type Description value
String | Array.<String> params
JSON Returns:
- Type
- boolean
-
Range(value, params) → {boolean}
-
Constraint: Range
Parameters:
Name Type Description value
String | Array.<String> params
JSON Returns:
- Type
- boolean
-
Size(value, params) → {boolean}
-
Constraint: Size
Parameters:
Name Type Description value
String | Array.<String> params
JSON Returns:
- Type
- boolean
-
validate(validator) → {boolean}
-
Validate the current JSValidator.Rule
Parameters:
Name Type Description validator
JSValidator Returns:
- Type
- boolean