UNPKG

@ticatec/web-bean-validator

Version:

A TypeScript/JavaScript library for rule-based entity validation with boundary checking for strings, numbers, dates, enums, objects, and arrays.

14 lines (13 loc) 541 B
import BaseValidator, { ValidatorOptions } from "./BaseValidator"; import ValidationResult from "./ValidationResult"; export interface NumberValidatorOptions extends ValidatorOptions { minValue?: number; maxValue?: number; } export default class NumberValidator extends BaseValidator { protected minValue: number; protected maxValue: number; constructor(field: string, options?: NumberValidatorOptions); protected checkField(value: any, result: ValidationResult): boolean; protected checkType(value: any): any; }