Validators

Validators

Methods

(static) alphanumeric()

Source:

Test if the value is alphanumeric or optional (params[0]) and empty

(static) date()

Source:

Make sure a value is a date that the Date object can parse. Can be optional.

(static) dateISO()

Source:

Make sure a value is a valid ISO Date (YYYY-MM-DD) or is optional (params[0]) and empty

(static) digits()

Source:

Makes sure a string consists of only numeric digits.

(static) email()

Source:

Make sure a value is a valid email adress.

(static) length()

Source:

String length must be between options.min (default 0) and options.max (default positive infinity).

(static) minMax()

Source:

Make sure a number value is between (inclusive) options.min (default: 0) and options.max (default: POSITIVE_INFINITY)

(static) notEmpty()

Source:

Make sure a value is not empty. Any falsy value is considered empty (including 0). use minMax for number types instead!

(static) number()

Source:

Make sure a value is a valid (SI, US or EU) number string or is optional (params[0]) and empty

(static) numberEU()

Source:

Make sure a value is a valid EU number (thousands seperator point, decimal seperator comma) string or is optional (params[0]) and empty

(static) numberSI()

Source:

Make sure a value is a valid SI number (thousands seperator space, decimal seperator point or comma) string or is optional (params[0]) and empty

(static) numberUS()

Source:

Make sure a value is a valid US number (thousands seperator comma, decimal seperator point) string or is optional (params[0]) and empty

(static) regexp()

Source:

Test if the value matches the provided regexp or optional (params[0]) and empty

(static) url()

Source:

Make sure a value is a valid url.

Validators

Methods

(static) alphanumeric()

Source:

Test if the value is alphanumeric or optional (params[0]) and empty

(static) date()

Source:

Make sure a value is a date that the Date object can parse. Can be optional.

(static) dateISO()

Source:

Make sure a value is a valid ISO Date (YYYY-MM-DD) or is optional (params[0]) and empty

(static) digits()

Source:

Makes sure a string consists of only numeric digits.

(static) email()

Source:

Make sure a value is a valid email adress.

(static) length()

Source:

String length must be between options.min (default 0) and options.max (default positive infinity).

(static) minMax()

Source:

Make sure a number value is between (inclusive) options.min (default: 0) and options.max (default: POSITIVE_INFINITY)

(static) notEmpty()

Source:

Make sure a value is not empty. Any falsy value is considered empty (including 0). use minMax for number types instead!

(static) number()

Source:

Make sure a value is a valid (SI, US or EU) number string or is optional (params[0]) and empty

(static) numberEU()

Source:

Make sure a value is a valid EU number (thousands seperator point, decimal seperator comma) string or is optional (params[0]) and empty

(static) numberSI()

Source:

Make sure a value is a valid SI number (thousands seperator space, decimal seperator point or comma) string or is optional (params[0]) and empty

(static) numberUS()

Source:

Make sure a value is a valid US number (thousands seperator comma, decimal seperator point) string or is optional (params[0]) and empty

(static) regexp()

Source:

Test if the value matches the provided regexp or optional (params[0]) and empty

(static) url()

Source:

Make sure a value is a valid url.