MValidate

Methods



email(email:String):Boolean


The email function uses regular expressions to check the validity of an e-mail address.

onlyContain(input:String, choices:Array):Boolean


Validates that a variable contains only the values is in the array.
The input can not have any values other than what is in the array.
If the input is a String each letter is checked against the choice array.
If the input is an Array each item in the array is checked against the choice array.

mustContain(input:String, choices:Array):Boolean


Validates that a variable contains every value in the array.
The input can have other values but must have what is in the array.
If the input is a String each letter is checked against the choice array.
If the input is an Array each item in the array is checked against the choice array.

cantContain(input:String, choices:Array):Boolean


Validates that a variable does not contain what is in the array.
The input can have other values but must not have what is in the array.
If the input is a String each letter is checked against the array.
If the input is an Array each item in the array is checked against the choice array.

includedIn(input:Mixed, choices:Array):Boolean


Validates that a variable is in a list of choices.
The comparison is case sensitive, so "red" and "Red" are not the same.

excludedFrom(input:Mixed, choices:Array):Boolean


Validates that a variable is not in a list of choices.
The comparison is case sensitive, so "red" and "Red" are not the same.

between(input:Number, min:Number, max:Number):Boolean


Validates that a variable is between two numbers.

multipleOf(input:Number, multiple:Number):Boolean


Validates that an input is a multiple of a number.

even(input:Number):Boolean


Validates that an input is an even number.

odd(input:Number):Boolean


Validates that an input is an odd number.

state(state:String):Boolean


Validates that a state or abbriation for a state is a valid state.
Washington DC is considered a state to this function.
This function is case insensitive.