validation

commands. validation

Source:

Command validation functions and utils.

Members

(static, constant) isCommand

Source:

A validation function for a command.

(static, constant) isMinutes

Source:

A validation function for a number of minutes (mininum value 1).

(static, constant) isMs

Source:

A validation function for a number of milliseconds (mininum value 70).

(static, constant) isSeconds

Source:

A validation function for a number of seconds (mininum value 1).

(static, constant) isString

Source:

A validation function for a string.

(static, constant) isTimes

Source:

A validation function for a number of times (mininum value 1).

Methods

(package, static) and(…vfs) → {commands.Validate}

Source:

A factory for a validation function that combines other validation functions with "and".

Parameters:
Name Type Attributes Description
vfs commands.Validate <repeatable>

Validation functions to combine.

Returns:

Combined validation function.

Type
commands.Validate

(static) isIdentifier(s) → {boolean}

Source:

A validation function for an identifier.

Parameters:
Name Type Description
s string

String to test.

Returns:

If the input is a valid identifier.

Type
boolean

(static) makeNumber(typeopt, minopt, maxopt) → {commands.Validate}

Source:

A factory for a validation function based on a number.

Parameters:
Name Type Attributes Default Description
type string <optional>
'number'

"Type" of the validation function. Any text that represents this type.

min number <optional>
null

Minimum value.

max number <optional>
null

Maximum value.

Returns:

Validation function.

Type
commands.Validate

(static) makeOptions(type, options) → {commands.Validate}

Source:

A factory for a validation function based on a number of string options.

Parameters:
Name Type Description
type string

"Type" of the validation function. Any text that represents this type.

options Array.<string>

Options the validation function accepts. Must not be empty.

Returns:

Validation function.

Type
commands.Validate

(static) makeType(type, baseopt) → {commands.Validate}

Source:

A factory for a validation function based on a type.

Parameters:
Name Type Attributes Default Description
type string

"Type" of the validation function. Any text that represents this type.

base string <optional>
type

Base JavaScript type: "string", "number", "boolean", etc.

Returns:

Validation function.

Type
commands.Validate