Browse Source

Mark addValidator as internal (#22)

iss58
Sam Verschueren 7 years ago
committed by Sindre Sorhus
parent
commit
766b789e36
  1. 2
      source/lib/operators/not.ts
  2. 3
      source/lib/predicates/predicate.ts

2
source/lib/operators/not.ts

@ -6,7 +6,7 @@ import { Predicate, Validator, validatorSymbol } from '../predicates/predicate';
* @param predictate Predicate to wrap inside the operator.
*/
export const not = <T extends Predicate>(predicate: T) => {
predicate['addValidator'] = (validator: Validator<any>) => { // tslint:disable-line:no-string-literal
predicate.addValidator = (validator: Validator<any>) => {
const fn = validator.validator;
const message = validator.message;

3
source/lib/predicates/predicate.ts

@ -38,9 +38,10 @@ export abstract class Predicate<T = any> {
/**
* Register a new validator.
*
* @internal
* @param validator Validator to register.
*/
protected addValidator(validator: Validator<T>) {
addValidator(validator: Validator<T>) {
this.context.validators.push(validator);
return this;

Loading…
Cancel
Save