MCPcopy
hub / github.com/sindresorhus/ow / addValidator

Method addValidator

source/predicates/predicate.ts:342–348  ·  view source on GitHub ↗

Register a new validator. @param validator - Validator to register.

(validator: Validator<T>)

Source from the content-addressed store, hash-verified

340 @param validator - Validator to register.
341 */
342 addValidator(validator: Validator<T>): this {
343 // Create a new array with the existing validators plus the new one
344 const validators = [...this.context.validators, validator];
345
346 // Return a new instance with the updated validators
347 return this.withValidators(validators);
348 }
349
350 /**
351 @hidden

Callers 15

validateMethod · 0.95
isMethod · 0.95
byteLengthMethod · 0.80
minByteLengthMethod · 0.80
maxByteLengthMethod · 0.80
nameMethod · 0.80
messageMethod · 0.80
messageIncludesMethod · 0.80
hasKeysMethod · 0.80
instanceOfMethod · 0.80
sizeMethod · 0.80
minSizeMethod · 0.80

Calls 1

withValidatorsMethod · 0.95

Tested by

no test coverage detected