CollectionIncludingValidator

Hierarchy

Implements

Index

Properties

Methods

Properties

Static describer

describer: Describer

Inherited from PatternValidator.describer

Overrides void

Methods

canValidate

canValidate(expectation: Expectation, isStrict?: boolean): boolean

Implementation of PatternValidator

Evaluates if validator can handle provided explicit pattern or implicit expectation.

Parameters:

NameTypeDescription
expectationExpectationEvaluated explicit Pattern instance or implicit expectation.
isStrict?boolean-

Returns: boolean

Returns true if pattern is instance of CollectionIncluding or is plain Object validated in loose mode, else false.


describe

describe(value: any): string

Inherited from PatternValidator.describe

Overrides void

Parameters:

NameType
valueany

Returns: string


validate

validate(value: any, collIncOrExpect: CollectionIncluding | Record‹keyof any, any›, validator: Validator): boolean

Validates if value matches an Object with expected keys and values matching the given expectations. 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 object.

throws {ValidationError} Thrown if the value does not match properties.

Parameters:

NameTypeDescription
valueanyValue that is validated against expectation.
collIncOrExpectCollectionIncluding | Record‹keyof any, any›Explicit pattern as CollectionIncluding instance or implicit expectation as plain Object against which value is validated.
validatorValidatorValidator matching Validator interface.

Returns: boolean

Returns true if value is matching explicit CollectionIncluding pattern or implicit expectation as plain object even with arbitrary keys, 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:

NameType
describerDescriber

Returns: void