nestjs-validators
TypeScript icon, indicating that this package has built-in type declarations

7.6.4 • Public • Published

Nest.js validators

Provides Nest common validators.

Installation

$ npm i nestjs-validators

Usage

Blank string validator

Checks if the string is not empty or blank, like in ' '.

export class AddressDTO {
  @IsNotBlank()
  public city: string;
  
  ...
}

No spaces validator

Checks if the string has no spaces, like in 'a b'.

export class CreateUserRequestDTO {
  @IsNoSpaces()
  public password: string;
  
  ...
}

Different than property validator

Checks if a object property is different than another one.

export class ChangePasswordRequestDTO {
  @IsNotBlank()
  public oldPassword: string;

  @IsDifferentThanProperty('oldPassword')
  public newPassword: string;
}

/nestjs-validators/

    Package Sidebar

    Install

    npm i nestjs-validators

    Weekly Downloads

    8

    Version

    7.6.4

    License

    MIT

    Unpacked Size

    16.2 kB

    Total Files

    18

    Last publish

    Collaborators

    • marciopd
    • arturbdr