New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

class-validator-callback

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

class-validator-callback

ValidateCallback decorator for class-validator

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

Class Validator Callback

NPM Version Package License

Table of Contents

Description

ValidateCallback decorator for class-validator

Installation

npm install class-validator class-validator-callback

Examples

  import { validate } from 'class-validator';
  import { ValidateCallback } from 'class-validator-callback';

  class User {
    @ValidateCallback(
      (object, value) => /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[0-9a-zA-Z]{8,}$/.test(value), 
      { message: 'Error message for password' }
    )
    password: string;

    @ValidateCallback(
      (object, value) => object.password === value, 
      { message: 'Error message for passwordConfirmation' }
    )
    passwordConfirmation: string;
  }

  const user = new User();
  user.password = 'passW0rd';
  user.passwordConfirmation = 'passW0rd';
  validate(user).then(errors => console.log(errors));

License

MIT

Keywords

class-validator

FAQs

Package last updated on 04 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts