typescript-validate
v1.2.0
Published
TypeScript Annotations for validation and sanitization
Downloads
2
Maintainers
Readme
TypeScript Validation and Sanitization Decorators
Getting Started
Using this package is simple and can be achevied with the following:
npm install typescript-validate
Contributing
Please contribute if you have any additions.
Quick Start
import { Sanitize, Validate, Sanitizor, Validator } from "typescript-validate";
class User {
@Sanitize([
SanitizationType.AlphaNumeric
])
@Validate({
String: {
MinLength: 1,
MaxLength: 5
}
})
public Username: string;
@Validate({
CreditCard: [ CreditCardType.Mastercard, CreditCardType.Visa ]
})
private _creditCard: string;
}
var user = new User();
Sanitizor.Sanitize( user );
Validator.Valid( user );