1.8.0 • Published 4 years ago

think_validtion v1.8.0

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

think_validtion

Validtion Util for Koatty and ThinkORM. Based on class-validator, extended parameter type checking and restricted attribute functions.

User Decorators

  • @IsDefined
  • @IsCnName
  • @IsIdNumber
  • @IsZipCode
  • @IsMobile
  • @IsPlateNumber
  • @IsEmail
  • @IsIP
  • @IsPhoneNumber
  • @IsUrl
  • @IsHash
  • @IsNotEmpty
  • @Equals
  • @NotEquals
  • @Contains
  • @IsIn
  • @IsNotIn
  • @IsDate
  • @Min
  • @Max
  • @Length

Validator for manual

FunctionValidator

  • FunctionValidator.IsCnName
  • FunctionValidator.IsIdNumber
  • FunctionValidator.IsZipCode
  • FunctionValidator.IsMobile
  • FunctionValidator.IsPlateNumber
  • FunctionValidator.IsEmail
  • FunctionValidator.IsIP
  • FunctionValidator.IsPhoneNumber
  • FunctionValidator.IsUrl
  • FunctionValidator.IsHash
  • FunctionValidator.IsNotEmpty
  • FunctionValidator.Equals
  • FunctionValidator.NotEquals
  • FunctionValidator.Contains
  • FunctionValidator.IsIn
  • FunctionValidator.IsNotIn
  • FunctionValidator.IsDate
  • FunctionValidator.Min
  • FunctionValidator.Max
  • FunctionValidator.Length
if (!FunctionValidator.IsNotEmpty(data)) {
    console.log('error');
}

ClassValidator

class SchemaClass {
    @IsDefined
    id: number;
    
    @IsNotEmpty
    name: string;
}


ClassValidator.valid(SchemaClass, {name: ''}).catch(err => {
    console.log(err);
})
1.8.0

4 years ago

1.7.0

5 years ago

1.6.5

5 years ago

1.6.4

5 years ago

1.6.3

5 years ago

1.6.2

5 years ago

1.6.1

5 years ago

1.6.0

5 years ago

1.4.3

5 years ago

1.5.0

5 years ago

1.4.2

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.12

5 years ago

1.2.10

5 years ago

1.2.8

5 years ago

1.2.7

5 years ago

1.2.6

5 years ago

1.2.5

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago