Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/denomander/docs.ts>Validator

Deno command-line interfaces made easy
Latest
class Validator
implements ValidatorContract
import { Validator } from "https://deno.land/x/denomander@0.9.3/docs.ts";

It is responsible for validating the arguments and throw the related error

Constructors

new
Validator(options: ValidatorOptions)

Constructor of the Validator object

Properties

private
_isClassic: boolean
app: Kernel

Holds the app instance

args: Arguments

Holds the Arguments instance

rules: Array<ValidationRules>

The array of rules for validation

throw_errors: boolean

User have the option to throw the errors

Methods

protected
failed(): Array<ValidationResult>

It maps through all validations and returns the ones that didn't pass

Validates if there are non decleared commands

Validates if there are non decleared options

protected
runValidations(): Array<ValidationResult>

It runs all the validations passed as ValidationRules

Validates the .action() parameters and sends them to the callback

Validates if there are non decleared arguments

Validates the .on() commands and stacks them in the available commands

Validates if the required options are defined

Validates all the commands which needs required values to be defined

It starts the validation process and throws the first error