f7
f7 is a spreadsheet formula execution library
git clone https://git.vogt.world/f7.git
Log | Files | README.md | LICENSE.md
← All files
name: src/main/js/validation/Validator.ts
-rw-r--r--
353
 1import { validateSync } from "class-validator";
 2import { InvalidArgumentError } from "../common/errors/InvalidArgumentError";
 3
 4export class Validator {
 5  static validate<T>(request: T): T {
 6    const errors = validateSync(request);
 7    if (errors.length > 0) {
 8      throw new InvalidArgumentError(errors[0].toString());
 9    }
10    return request;
11  }
12}