new Validator()
- Source:
Members
isValid
Checks if the attribute is valid
- Source:
key :string
Name of the attribute
Type:
- string
- Source:
value
Gets the value of the attribute
- Source:
Methods
(static) compile(managedType, validationCode) → {void}
Compiles the given validation code for the managedType
Parameters:
Name | Type | Description |
---|---|---|
managedType |
metamodel.ManagedType | The managedType of the code |
validationCode |
string | The validation code |
- Source:
Returns:
- Type
- void
is(fn) → {util.Validator}
Executes the given validation function to validate the value.
The value will be passed as the first parameter to the validation function and
the library https://github.com/chriso/validator.js as the second one.
If the function returns true the value is valid, otherwise it's invalid.
Parameters:
Name | Type | Description |
---|---|---|
fn |
function | will be used to validate the value |
- Source:
Returns:
- Type
- util.Validator
is(error, fn) → {util.Validator}
Executes the given validation function to validate the value.
The value will be passed as the first parameter to the validation function and
the library https://github.com/chriso/validator.js as the second one.
If the function returns true the value is valid, otherwise it's invalid.
Parameters:
Name | Type | Description |
---|---|---|
error |
string | The error message which will be used if the value is invalid |
fn |
function | will be used to validate the value |
- Source:
Returns:
- Type
- util.Validator