WhereValidator
Hierarchy
PatternValidator
↳ WhereValidator
Implements
- PatternValidator
- PatternValidator
Index
Properties
Methods
Properties
Static describer
▪ describer: Describer
Inherited from PatternValidator.describer
Overrides void
Methods
canValidate
▸ canValidate(expectation: Expectation): boolean
Evaluates if validator can handle provided explicit pattern or implicit expectation.
Parameters:
| Name | Type | Description |
|---|---|---|
expectation | Expectation | Evaluated explicit Pattern instance or implicit expectation. |
Returns: boolean
Returns true if pattern: is instance of Where or is a function that is not class constructor; else false.
describe
▸ describe(value: any): string
Inherited from PatternValidator.describe
Overrides void
Parameters:
| Name | Type |
|---|---|
value | any |
Returns: string
validate
▸ validate(value: any, whereOrExpect: Expectation): boolean
Validates if value matches pattern expectation.
throws {ValidationError|Error}
Thrown if the value does not match expectation.
Parameters:
| Name | Type | Description |
|---|---|---|
value | any | Value that is validated against expectation. |
whereOrExpect | Expectation | -Explicit pattern as Where instance or implicit expectation against which value is validated. |
Returns: boolean
Returns true if expectation function returns z for value, else throws.
Static getDescriber
▸ getDescriber(): Describer
Inherited from PatternValidator.getDescriber
Overrides void
Returns: Describer
Static setDescriber
▸ setDescriber(describer: Describer): void
Inherited from PatternValidator.setDescriber
Overrides void
Parameters:
| Name | Type |
|---|---|
describer | Describer |
Returns: void