UNPKG

nestjs-typebox

Version:

This library provides helper utilities for writing and validating NestJS APIs using [TypeBox](https://github.com/sinclairzx81/typebox) as an alternative to class-validator/class-transformer. It also includes a patch for @nestjs/swagger allowing OpenAPI ge

9 lines (6 loc) 243 B
import { Format } from '@sinclair/typebox/format'; const emailRegex = /.+\@.+\..+/; export const emailFormat = (value: string) => value.match(emailRegex) !== null; export const applyFormats = () => { Format.Set('email', emailFormat); };