Rule
The Rule class validates only one value once a rule is created it can be used multiple times
Static Method Summary
Static Public Methods | ||
public static |
Add custom rule to the Rule class |
Constructor Summary
Public Constructor | ||
public |
constructor(obj: String | Object, error: String) |
Method Summary
Public Methods | ||
public |
getError(path: *, value: *, key: *): [String] returns a list of errors if they are present |
|
public |
|
|
public |
Tests the validity of the constructor object thows an error if the object is invalid |
|
public |
testEntryObjectOneType(type: *) Tests the validity of the constructor object thows an error if the object is invalid tests if all the keys are valid |
Private Methods | ||
private |
getRuleOperators(): [String] Returns a list of the operators when multiple types given its the case for example int|float |
|
private |
getTypes(): [String] converts array from string if multiple types given in type its the case for exemple int|float |
|
private |
testOneRule(val: *, obj: Object, type: String, path: String): boolean |
Static Public Methods
Public Constructors
Public Members
public error: * source
public errorCollector: * source
public rule: {"type": *} source
Public Methods
public getError(path: *, value: *, key: *): [String] source
returns a list of errors if they are present
Params:
Name | Type | Attribute | Description |
path | * | ||
value | * | ||
key | * |
Return:
[String] |
public testEntryObject() source
Tests the validity of the constructor object thows an error if the object is invalid
public testEntryObjectOneType(type: *) source
Tests the validity of the constructor object thows an error if the object is invalid tests if all the keys are valid
Params:
Name | Type | Attribute | Description |
type | * |
Private Methods
private getRuleOperators(): [String] source
Returns a list of the operators when multiple types given its the case for example int|float
Return:
[String] |
private getTypes(): [String] source
converts array from string if multiple types given in type its the case for exemple int|float
Return:
[String] |