InterfaceValidator
Hierarchy
PatternValidator
↳ InterfaceValidator
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 expectation.
Parameters:
Name | Type | Description |
---|---|---|
expectation | Expectation | Evaluated explicit Pattern instance or implicit expectation. |
Returns: boolean
Returns true
if pattern is instance of Interface
pattern, else false
.
describe
▸ describe(value
: any): string
Inherited from PatternValidator.describe
Overrides void
Parameters:
Name | Type |
---|---|
value | any |
Returns: string
validate
▸ validate(value
: any, pattern
: Interface, validator
: Validator): boolean
Implementation of PatternValidator
Validates value against Interface
pattern requiring it to match expected
properties and available methods(compared only by name - and not by with method parameters).
The value may also contain other keys with arbitrary values not defined in
pattern(equivalent of Meteor's Match.ObjectIncluding
).
throws
{InvalidTypeError}
Thrown if the value is not an class instance.
throws
{ValidationError}
Thrown if the value does not match expectation.
Parameters:
Name | Type | Description |
---|---|---|
value | any | Value that is validated against expectation. |
pattern | Interface | - |
validator | Validator | Validator matching Validator interface. |
Returns: boolean
Returns true
if value is matching exactly Interface
pattern expectation, 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