How to use the validatorjs.registerAsync function in validatorjs

To help you get started, we’ve selected a few validatorjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / validatorjs / validatorjs-tests.ts View on Github external
var check: boolean = validator.check()

var errors: Validator.Errors = validator.errors
var all: Validator.ValidationErrors = errors.all()
var error: Array = errors.get("foo")
var first: string | boolean = errors.first("foo")
var has: boolean = errors.has("foo")

Validator.setMessages("en", {})
var messages: Validator.ErrorMessages = Validator.getMessages("en")
Validator.useLang("en")
var lang: string = Validator.getDefaultLang()
Validator.setAttributeFormatter((attributes: any) => ({}))
Validator.stopOnError(true)
Validator.register("custom", () => {}, "error.custom")
Validator.registerAsync("custom", () => {}, "error.custom")