/** * @name sogv * @namespace * @description Root namespace for the SOG Validator Library */ declare namespace sogv { /** * @abstract * @constructor * @name sogv.BaseComparisonValidator * @extends sogv.BaseValidator * @classdesc *
Abstract base class that implements functionality for validation.
*Provides a base class for the validation of property comparisons.
* @description Create a new Validator. * @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options * @param {String} lang The language used by the application. Defaults to 'en'. * @param {Boolean} internal If this parameter is true, it means, that validation called from core. */ class BaseComparisonValidator extends sogv.BaseValidator { constructor(data: any, options: any, optionRules: any, lang: string, internal: boolean); /** * @name sogv.BaseValidator#data * @type {*} * @description Data that needs to be validated. */ data: any; /** * @name sogv.BaseValidator#lang * @type {String} * @description Language of error messages. */ lang: string; /** * @function * @name sogv.BaseValidator#isValid * @description *Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; } /** * @abstract * @constructor * @name sogv.BaseValidator * @classdesc Abstract base class that implements functionality for validation. * @description Create a new validation extension. * @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options * @param {String} lang Language of error messages. * @param {Boolean} lang Language of error messages. * @constructor */ class BaseValidator { constructor(data: any, options: any, optionRules: any, lang: boolean, lang: boolean); /** * @name sogv.BaseValidator#data * @type {*} * @description Data that needs to be validated. */ data: any; /** * @name sogv.BaseValidator#lang * @type {String} * @description Language of error messages. */ lang: string; /** * @function * @name sogv.BaseValidator#isValid * @description *Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; } /** * @function * @name sogv.globalScope * @description *Return variable by name from the global scope.
* @param {String} name Variable name. * @returns {Window | *} */ function globalScope(name: string): Window | any; /** * @function * @name sogv.registerValidator * @description *Register validator.
* @param {Function} validator The validator. */ function registerValidator(validator: (...params: any[]) => any): void; /** * @function * @name sogv.getType * @description *Get data type.
* @param {*} data Data, which type needs to be defined. * @returns {String} Data type */ function getType(data: any): string; /** * @function * @name sogv.isType * @description *Parse validation rules from string.
* @param {String} type Type string. * @param {*} data Data, which type needs to be checked. * @returns {Boolean} Is correct data type. */ function isType(type: string, data: any): boolean; /** * @function * @name sogv.makeValidator * @description *Create object of the validator.
* @param {*} data The data which needs to be validated. * @param {String} validator Validator name. * @param {Object} options The setting options. * @param {Object} optionRules The validation rules for setting options. * @param {Object} lang The language used by the application. Defaults to 'en'. * @param {Boolean} internal If this parameter is true, it means, that validation called from core. * @returns {Object} The object of validator. */ function makeValidator(data: any, validator: string, options: any, optionRules: any, lang: any, internal: boolean): any; /** * @function * @name sogv.isValid * @description *Check if data valid according to validation rules.
* @param {*} data The data which needs to be validated. * @param {String} rules Validation rules in string format. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal It means, that validation called from core.
* @returns {Boolean} Validation status.
*/
function isValid(data: any, rules: string, lang: string, internal: boolean): boolean;
/**
* @function
* @deprecated
* @name sogv.isValidWithErrorMessage
* @description
* Use sogv.isValidMessage instead.
Check if data valid according to validation rules.
*Check only single data.
* @param {*} data The data which needs to be validated. * @param {String} rules Validation rules in string format. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal It means, that validation called from core.
* @returns {Null|String} If valid this function return null otherwise error message.
*/
function isValidWithErrorMessage(data: any, rules: string, lang: string, internal: boolean): null | string;
/**
* @function
* @name sogv.isValidMessage
* @description
* Check if data valid according to validation rules.
*Check only single data.
* @param {*} data The data which needs to be validated. * @param {String} rules Validation rules in string format. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal It means, that validation called from core.
* @returns {Null|String} If valid this function return null otherwise error message.
*/
function isValidMessage(data: any, rules: string, lang: string, internal: boolean): null | string;
/**
* @function
* @name sogv.isValidException
* @description
* Check if data valid according to validation rules. If not then throw error exception.
*Check only single data.
* @param {*} data The data which needs to be validated. * @param {String} rules Validation rules in string format. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal It means, that validation called from core.
* @throws The validation error message.
*/
function isValidException(data: any, rules: string, lang: string, internal: boolean): void;
/**
* @function
* @name sogv.isValidFormMessage
* @description
* Check if data valid according to validation rules
*Check only multi data.
* @param {Object} data The data which needs to be validated. * @param {Object} rules Validation rules in string format. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal It means, that validation called from core.
* @returns {Null|Object} If valid this function return null otherwise the list of error messages.
*/
function isValidFormMessage(data: any, rules: any, lang: string, internal: boolean): null | any;
/**
* @function
* @name sogv.isValidFormException
* @description
* Check if data valid according to validation rules. If not then throw error exception.
*Check only multi data.
* @param {Object} data The data which needs to be validated. * @param {Object} rules Validation rules in string format. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal It means, that validation called from core.
* @throws The validation error message.
*/
function isValidFormException(data: any, rules: any, lang: string, internal: boolean): void;
/**
* @function
* @name sogv.convertToType
* @description Convert data to one of the type.
* @param {*} data The data which needs to be converted
* @param {String} strTypes Data types. (Example: 'integer|date-string')
* @returns {*} The converted data
*/
function convertToType(data: any, strTypes: string): any;
/**
* @constructor
* @name sogv.Application
* @classdesc A sogv.Application represents and manages your Validation application.
* @description Create a new Application.
* @param {Object} options The setting options
* @example
* var validationEngine = new sogv.Application({
* lang: 'en'
* });
*
* var form = validationEngine.make({
* first_name: 'Leo',
* last_lame: 'Lane',
* email: 'leo.lane38@example.com',
* birthday: '1977-03-07',
* creditCard: '4111111111111111',
* ip: '8.8.8.8',
* locale: 'cy_GB',
* country: 'US',
* language: 'en_gb',
* homepage: 'https://github.com//slaveofgod/sog-validator'
* }, {
* first_name: 'required|string|length:{"min":2,"max":255}',
* last_lame: 'required|string|length:{"min":2,"max":255}',
* email: 'required|email',
* birthday: 'required|date',
* creditCard: 'required|string|card-scheme:{"schemes":["VISA"]}',
* ip: 'required|string|ip',
* locale: 'required|string|locale',
* country: 'required|string|country',
* language: 'required|string|language',
* homepage: 'required|string|url'
* });
*
* if (false === form.isValid()) {
* if (false === form.get('name').isValid()) {
* form.get('name').errors().first();
* }
* // ...
* }
*/
class Application {
constructor(options: any);
/**
* @name sogv.Application#lang
* @type {String}
* @description
* The language used by the application.
*Defaults to 'en' ({@link https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes|List of ISO 639-1 codes}).
* @example * // Set the language for the application * this.app.lang = 'en'; */ lang: string; /** * @name sogv.Application#internal * @type {Boolean} * @description If this parameter is true, it means, that validation called from core. */ internal: boolean; /** * @function * @name sogv.Application#make * @description Create validators for all the fields * @param {Object} data The data which needs to be validated * @param {Object} rules The validation rules * @returns {sogv.ValidatorHandler} */ make(data: any, rules: any): sogv.ValidatorHandler; /** * @function * @name sogv.Application#makeSingle * @description Create single validator * @param {*} data The data which needs to be validated * @param {String} rules The validation rules * @example * var validationEngine = new sogv.Application({ * lang: 'en' * }); * * validator = validationEngine.makeSingle( * 'leo.lane38@example.com', * 'required|email' * ); * * if (false === validator.isValid()) { * validator.errors().first(); * } * @returns {Object} Validator object */ makeSingle(data: any, rules: string): any; } /** * @constructor * @name sogv.AnyValidator * @extends sogv.BaseValidator * @classdesc *Validates that a value is valid at least for one of the rule.
* @description *Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['any', 'one-of'].
This is the message that will be shown if the value is not valid.
*Default: "This value should be valid at least for one rule."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
This option is required.
*It defines the value to check the containing.
*/ rules: string; /** * @name sogv.BaseValidator#data * @type {*} * @description Data that needs to be validated. */ data: any; /** * @name sogv.BaseValidator#lang * @type {String} * @description Language of error messages. */ lang: string; /** * @function * @name sogv.BaseValidator#isValid * @description *Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['any', 'one-of'].
Validates that a value contains given substring.
* @description *Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['contains'].
This is the message that will be shown if the value is not contains given substring.
*Default: "This value should contains the given substring."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
This option is required.
*It defines the value to check the containing.
*/ value: string; /** * @name sogv.BaseValidator#data * @type {*} * @description Data that needs to be validated. */ data: any; /** * @name sogv.BaseValidator#lang * @type {String} * @description Language of error messages. */ lang: string; /** * @function * @name sogv.BaseValidator#isValid * @description *Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['contains'].
The field under validation must be yes, on, 1, or true.
This is useful for validating "Terms of Service" acceptance.
* @description *Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['accepted'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['accepted'].
The field under validation must have a valid A or AAAA record
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['active_url','active-url'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['active_url','active-url'].
The field under validation must be a value after or equal to the given date.
For more information, see the after rule.
* @description *Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['after_or_equal', 'after-or-equal', 'aoe'].
This option is required.
*
It defines the value to compare to.
*
The data type could be string, number or date.
*/ value: any; /** * @name sogv.BaseValidator#data * @type {*} * @description Data that needs to be validated. */ data: any; /** * @name sogv.BaseValidator#lang * @type {String} * @description Language of error messages. */ lang: string; /** * @function * @name sogv.BaseValidator#isValid * @description *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['after_or_equal', 'after-or-equal', 'aoe'].
The field under validation must be a value after a given date.
* @description *Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['after'].
This option is required.
*It defines the value to compare to.
*The data type could be string, number or date.
*/ value: any; /** * @name sogv.BaseValidator#data * @type {*} * @description Data that needs to be validated. */ data: any; /** * @name sogv.BaseValidator#lang * @type {String} * @description Language of error messages. */ lang: string; /** * @function * @name sogv.BaseValidator#isValid * @description *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['after'].
The field under validation may have alpha-numeric characters, as well as dashes and underscores.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['alpha_dash', 'alpha-dash'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['alpha_dash', 'alpha-dash'].
The field under validation must be entirely alpha-numeric characters.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['alpha_num', 'alpha-num', 'alnum'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['alpha_num', 'alpha-num', 'alnum'].
The field under validation must be entirely alphabetic characters.
* @description *Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['alpha'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['alpha'].
The field under validation must be an array.
* @description *Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['array', 'arr'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['array', 'arr'].
The field under validation must be a value before or equal to the given date.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['before_or_equal', 'before-or-equal', 'boe'].
This option is required.
*It defines the value to compare to.
*The data type could be string, number or date.
*/ value: any; /** * @name sogv.BaseValidator#data * @type {*} * @description Data that needs to be validated. */ data: any; /** * @name sogv.BaseValidator#lang * @type {String} * @description Language of error messages. */ lang: string; /** * @function * @name sogv.BaseValidator#isValid * @description *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['before_or_equal', 'before-or-equal', 'boe'].
The field under validation must be a value before a given date.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['before'].
This option is required.
*It defines the value to compare to.
*The data type could be string, number or date.
*/ value: any; /** * @name sogv.BaseValidator#data * @type {*} * @description Data that needs to be validated. */ data: any; /** * @name sogv.BaseValidator#lang * @type {String} * @description Language of error messages. */ lang: string; /** * @function * @name sogv.BaseValidator#isValid * @description *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['before'].
The field under validation must have a size between the given min and max.
Strings, numerics, arrays and dates are evaluated in the same fashion as the size rule.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['between'].
This option is the "max" count value. Validation will fail if the given collection elements count is greater than this max value.
This option is required when the min option is not defined.
*/ max: Integer; /** * @name sogv.BetweenValidator#min * @type {Integer} * @description *This option is the "min" count value. Validation will fail if the given collection elements count is less than this min value.
This option is required when the max option is not defined.
*/ min: Integer; /** * @name sogv.BaseValidator#data * @type {*} * @description Data that needs to be validated. */ data: any; /** * @name sogv.BaseValidator#lang * @type {String} * @description Language of error messages. */ lang: string; /** * @function * @name sogv.BaseValidator#isValid * @description *Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['between'].
The field under validation must be able to be cast as a boolean. Accepted input are true, false, 1, 0, "1", and "0".
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['boolean', 'bool'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['boolean', 'bool'].
Verify that the contents of a variable can be called as a function.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['callable'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['callable'].
Check for control character(s).
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['cntrl'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['cntrl'].
The field under validation must be equal to the given date.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['date_equals', 'date-equals', 'de'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['date_equals', 'date-equals', 'de'].
Check for numeric character(s).
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['digit'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['digit'].
The field under validation must be numeric and must have a length between the given min and max.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['digits_between', 'digits-between'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['digits_between', 'digits-between'].
The field under validation must be numeric and must have an exact length of value.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['digits'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['digits'].
When working with arrays, the field under validation must not have any duplicate values.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['distinct'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['distinct'].
Finds whether the type of a variable is double.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['double'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['double'].
The field under validation must end with one of the given values.
* @description *Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['ends_with', 'ends-with', 'ends'].
The option is required.
*The list of ends.
*One of the "end" needs to be the end of the passed value.
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['ends_with', 'ends-with', 'ends'].
The field under validation must be able to be cast as a float.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['float'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['float'].
Check for any printable character(s) except space.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['graph'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['graph'].
The data must be greater than the given value.
Strings, numerics, arrays, and dates are evaluated using the same conventions as the size rule.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['gt'].
This option is required.
*It defines the value to compare to.
*The data type could be string, number, array or date.
*/ value: any; /** * @name sogv.BaseValidator#data * @type {*} * @description Data that needs to be validated. */ data: any; /** * @name sogv.BaseValidator#lang * @type {String} * @description Language of error messages. */ lang: string; /** * @function * @name sogv.BaseValidator#isValid * @description *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['gt'].
The field under validation must be greater than or equal to the given field.
Strings, numerics, arrays, and dates are evaluated using the same conventions as the size rule.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['gte'].
This option is required.
*It defines the value to compare to.
*The data type could be string, number, array or date.
*/ value: any; /** * @name sogv.BaseValidator#data * @type {*} * @description Data that needs to be validated. */ data: any; /** * @name sogv.BaseValidator#lang * @type {String} * @description Language of error messages. */ lang: string; /** * @function * @name sogv.BaseValidator#isValid * @description *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['gte'].
The field under validation must be included in the given list of values.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['in'].
A required option - The field under validation must be included in the given list of values.
*The input value will be matched against this array.
*/ choices: any[]; /** * @name sogv.BaseValidator#data * @type {*} * @description Data that needs to be validated. */ data: any; /** * @name sogv.BaseValidator#lang * @type {String} * @description Language of error messages. */ lang: string; /** * @function * @name sogv.BaseValidator#isValid * @description *Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['in'].
The field under validation must be an integer.
* @description *Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['integer', 'int'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['integer', 'int'].
The field under validation must be an IPv4 address.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['ipv4'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['ipv4'].
The field under validation must be an IPv6 address.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['ipv6'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['ipv6'].
Verify that the contents of a variable is an iterable value.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['iterable'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['iterable'].
Check for lowercase character(s).
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['lower'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['lower'].
The field under validation must be less than the given field.
*
Strings, numerics, arrays, and dates are evaluated using the same conventions as the size rule.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['lt'].
This option is required.
*It defines the value to compare to.
*The data type could be string, number, array or date.
*/ value: any; /** * @name sogv.BaseValidator#data * @type {*} * @description Data that needs to be validated. */ data: any; /** * @name sogv.BaseValidator#lang * @type {String} * @description Language of error messages. */ lang: string; /** * @function * @name sogv.BaseValidator#isValid * @description *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['lt'].
The field under validation must be less than or equal to the given field.
Strings, numerics, arrays, and dates are evaluated using the same conventions as the size rule.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['lte'].
This option is required.
*It defines the value to compare to.
*The data type could be string, number, array or date.
*/ value: any; /** * @name sogv.BaseValidator#data * @type {*} * @description Data that needs to be validated. */ data: any; /** * @name sogv.BaseValidator#lang * @type {String} * @description Language of error messages. */ lang: string; /** * @function * @name sogv.BaseValidator#isValid * @description *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['lte'].
The field under validation must not be included in the given list of values.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['not_in', 'not-in'].
A required option - this is the array of options that should be considered in the valid set.
*The input value will be matched against this array.
*/ choices: any[]; /** * @name sogv.BaseValidator#data * @type {*} * @description Data that needs to be validated. */ data: any; /** * @name sogv.BaseValidator#lang * @type {String} * @description Language of error messages. */ lang: string; /** * @function * @name sogv.BaseValidator#isValid * @description *Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['not_in', 'not-in'].
The field under validation must be numeric.
* @description *Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['numeric', 'num'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['numeric', 'num'].
Finds whether a variable is an object.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['object'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['object'].
Check for printable character(s).
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['print'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['print'].
Check for any printable character which is not whitespace or an alphanumeric character.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['punct'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['punct'].
Finds whether the type of a variable is real.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['real'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['real'].
Finds whether a variable is a scalar. Scalar variables are those containing an integer, float, string or boolean.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['scalar'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['scalar'].
The field under validation must have a size matching the given value.
*For string data, value corresponds to the number of characters.
For numeric data, value corresponds to a given integer value.
For an array, size corresponds to the count of the array.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['size'].
This option is required.
*It defines the value to compare to.
*/ value: Integer; /** * @name sogv.BaseValidator#data * @type {*} * @description Data that needs to be validated. */ data: any; /** * @name sogv.BaseValidator#lang * @type {String} * @description Language of error messages. */ lang: string; /** * @function * @name sogv.BaseValidator#isValid * @description *Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['size'].
Check for whitespace character(s).
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['space'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['space'].
The field under validation must start with one of the given values.
* @description *Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['starts_with', 'starts-with', 'starts'].
The option is required.
*The list of starts.
*One of the "start" needs to be the end of the passed value.
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['starts_with', 'starts-with', 'starts'].
The field under validation must be a string.
* @description *Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['string', 'str'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['string', 'str'].
Check for uppercase character(s).
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['upper'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['upper'].
Check for character(s) representing a hexadecimal digit.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['xdigit'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['xdigit'].
Validates that a value is valid according to list of validation rules.
* @description *Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} rules Validation rules. * @param {Object} options The setting options. * @property {Array} alias *The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['all'].
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['all'].
This constraint is used to ensure that a value has the proper format of a {@link https://en.wikipedia.org/wiki/Business_Identifier_Code|Business Identifier Code (BIC)}.
*BIC is an internationally agreed means to uniquely identify both financial and non-financial institutions.
You may also check that the BIC is associated with a given IBAN.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['bic'].
An IBAN value to validate that the BIC is associated with it.
*Default: null.
The default message supplied when the value does not pass the combined BIC/IBAN check.
*Default: "This Business Identifier Code (BIC) is not associated with IBAN %%iban%%."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%iban%% |
* The current IBAN value | *
The default message supplied when the value does not pass the BIC check.
*Default: "This is not a valid Business Identifier Code (BIC)."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) BIC value | *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['bic'].
Validates that a value is blank - meaning equal to an empty string or null.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['blank', 'empty'].
This is the message that will be shown if the value is not blank.
*Default: "This value should be blank."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['blank', 'empty'].
This constraint ensures that a credit card number is valid for a given credit card company.
*It can be used to validate the number before trying to initiate a payment through a payment gateway.
* @description *Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['card-scheme', 'cs'].
The message shown when the value does not pass the CardScheme check.
*Default: "Unsupported card type or invalid card number." *
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
This option is required and represents the name of the number scheme used to validate the credit card number, it can either be a string or an array.
*Valid values are:
*For more information about the used schemes, see {@link https://en.wikipedia.org/wiki/Bank_card_number#Issuer_identification_number_.28IIN.29|Wikipedia: Issuer identification number (IIN)}.
*/ schemes: string | any[]; /** * @name sogv.BaseValidator#data * @type {*} * @description Data that needs to be validated. */ data: any; /** * @name sogv.BaseValidator#lang * @type {String} * @description Language of error messages. */ lang: string; /** * @function * @name sogv.BaseValidator#isValid * @description *Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['card-scheme', 'cs'].
This constraint is used to ensure that the given value is one of a given set of valid choices.
*It can also be used to validate that each item in an array of items is one of those valid choices.
* @description *Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['choice'].
This is a callback method that can be used instead of the choices option to return the choices array.
*/ callback: string | any[] | Closure; /** * @name sogv.ChoiceValidator#choices * @type {Array} * @description *A required option (unless callback is specified) - this is the array of options that should be considered in the valid set.
*The input value will be matched against this array.
*/ choices: any[]; /** * @name sogv.ChoiceValidator#max * @type {Integer} * @description *If the multiple option is true, then you can use the max option to force no more than XX number of values to be selected.
*For example, if max is 3, but the input array contains 4 valid items, the validation will fail.
*/ max: Integer; /** * @name sogv.ChoiceValidator#maxMessage * @type {String} * @description *This is the validation error message that's displayed when the user chooses too many options per the max option.
*Default: "You must select at most {{ limit }} choices."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%limit%% |
* Max count of selected options | *
%%choices%% |
* A comma-separated list of available choices | *
%%value%% |
* The current (invalid) value | *
This is the message that you will receive if the multiple option is set to false and the underlying value is not in the valid array of choices.
*Default: "The value you selected is not a valid choice."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
If the multiple option is true, then you can use the min option to force at least XX number of values to be selected.
*For example, if min is 3, but the input array only contains 2 valid items, the validation will fail.
*/ min: Integer; /** * @name sogv.ChoiceValidator#minMessage * @type {String} * @description *This is the validation error message that's displayed when the user chooses too few choices per the min option.
*Default: "You must select at least {{ limit }} choices."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%limit%% |
* Min count of selected options | *
%%choices%% |
* A comma-separated list of available choices | *
%%value%% |
* The current (invalid) value | *
If this option is true, the input value is expected to be an array instead of a single, scalar value.
*The constraint will check that each value of the input array can be found in the array of valid choices.
*If even one of the input values cannot be found, the validation will fail.
*Default: false
This is the message that you will receive if the multiple option is set to true and one of the values on the underlying array being checked is not in the array of valid choices.
*Default: "One or more of the given values is invalid."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['choice'].
Validates that a given collection's (i.e. an array or an object that implements Countable) element count is between some minimum and maximum value.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['count'].
The message that will be shown if min and max values are equal and the underlying collection elements count is not exactly this value.
*Default: "This collection should contain exactly %%limit%% elements."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%count%% |
* The current collection size | *
%%limit%% |
* The exact expected collection size | *
This option is the "max" count value. Validation will fail if the given collection elements count is greater than this max value.
This option is required when the min option is not defined.
*/ max: Integer; /** * @name sogv.CountValidator#maxMessage * @type {String} * @description *The message that will be shown if the underlying collection elements count is more than the max option.
*Default: "This collection should contain %%limit%% elements or less."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%count%% |
* The current collection size | *
%%limit%% |
* The upper limit | *
This option is the "min" count value. Validation will fail if the given collection elements count is less than this min value.
This option is required when the max option is not defined.
*/ min: Integer; /** * @name sogv.CountValidator#minMessage * @type {String} * @description *The message that will be shown if the underlying collection elements count is less than the min option.
*Default: "This collection should contain %%limit%% elements or more."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%count%% |
* The current collection size | *
%%limit%% |
* The lower limit | *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['count'].
Validates that a value is a valid {@link https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes/ISO 3166-1 alpha-2} country code.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['country'].
This message is shown if the string is not a valid country code.
Default:"This value is not a valid country."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) country code | *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['country'].
Validates that a value is a valid {@link https://en.wikipedia.org/wiki/ISO_4217|3-letter ISO 4217} currency name.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['currency'].
Default: "This value is not a valid currency."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['currency'].
Validates that a value is a valid "datetime", meaning a string (or an object that can be cast into a string) that follows a specific format.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['date-time', 'date_format', 'date-format'].
This message is shown if the underlying data is not a valid datetime.
*Default: "This value is not a valid datetime."
*You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
This option allows to validate a custom date format.
*Default: "YYYY-MM-DD HH:mm:ss"
Tokens are case-sensitive.
*| Input | *Example | *Description | *
|---|---|---|
YYYY |
* 2014 |
* 4 or 2 digit year | *
YY |
* 14 |
* 2 digit year | *
Y |
* -25 |
* Year with any number of digits and sign | *
Q |
* 1..4 |
* Quarter of year. Sets month to first month in quarter. | *
M MM |
* 1..12 |
* Month number | *
MMM MMMM |
* Jan..December |
* Month name in locale that is specified | *
D DD |
* 1..31 |
* Day of month | *
Do |
* 1st..31st |
* Day of month with ordinal | *
DDD DDDD |
* 1..365 |
* Day of year | *
X |
* 1410715640.579 |
* Unix timestamp | *
x |
* 1410715640579 |
* Unix ms timestamp | *
Tokens are case-sensitive.
*| Input | *Example | *Description | *
|---|---|---|
gggg |
* 2014 |
* Locale 4 digit week year | *
gg
* | 14 |
* Locale 2 digit week year | *
w ww |
* 1..53 |
* Locale week of year | *
e |
* 0..6 |
* Locale day of week | *
ddd dddd |
* Mon...Sunday |
* Day name in locale that is specified | *
GGGG |
* 2014 |
* ISO 4 digit week year | *
GG |
* 14 |
* ISO 2 digit week year | *
W WW |
* 1..53 |
* ISO week of year | *
E |
* 1..7 |
* ISO day of week | *
Tokens are case-sensitive.
*| Input | *Example | *Description | *
|---|---|---|
L |
* 04/09/1986 |
* Date (in local format) | *
LL |
* September 4 1986 |
* Month name, day of month, year | *
LLL |
* September 4 1986 8:30 PM |
* Month name, day of month, year, time | *
LLLL |
* Thursday, September 4 1986 8:30 PM |
* Day of week, month name, day of month, year, time | *
LT |
* 08:30 PM |
* Time (without seconds) | *
LTS |
* 08:30:00 PM |
* Time (with seconds) | *
Tokens are case-sensitive.
*| Input | *Example | *Description | *
|---|---|---|
H HH |
* 0..23 |
* Hours (24 hour time) | *
h hh |
* 1..12 |
* Hours (12 hour time used with a A.) |
*
k kk |
* 1..24 |
* Hours (24 hour time from 1 to 24) | *
a A |
* am pm |
* Post or ante meridiem (Note the one character a p are also considered valid) |
*
m mm |
* 0..59 |
* Minutes | *
s ss |
* 0..59 |
* Seconds | *
S SS SSS |
* 0..999 |
* Fractional seconds | *
Z ZZ |
* +12:00 |
* Offset from UTC as +-HH:mm, +-HHmm, or Z |
*
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['date-time', 'date_format', 'date-format'].
Validates that a value is a valid date, meaning a string (or an object that can be cast into a string) that follows a valid YYYY-MM-DD format.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['date'].
This message is shown if the underlying data is not a valid date.
*Default: "This value is not a valid date."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['date'].
Validates that a value is divisible by another value, defined in the options.
* @description *Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['divisible-by'].
This is the message that will be shown if the value is not divisible by the comparison value.
*Default: "This value should be a multiple of %%compared_value%%."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%compared_value%% |
* The expected value | *
%%compared_value_type%% |
* The expected value type | *
%%value%% |
* The current (invalid) value | *
This option is required.
*It defines the value to compare to.
*It can be a number or date object.
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['divisible-by'].
Validates that a value is a valid email address.
The underlying value is cast to a string before being validated.
* @description *Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['email'].
This option is optional and defines the pattern the email address is validated against.
Default: 'html5'
Valid values are:
*Normalizer string before validate (trim, etc.).
*Default: false
This message is shown if the underlying data is not a valid email address.
*Default: "This value is not a valid email address."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['email'].
Validates that a value is equal to another value, defined in the options.
*This constraint compares using ==, so 3 and "3" are considered equal. Use sogv.IdenticalTo to compare with ===.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['equal-to', 'equal', 'same', 'et'].
This is the message that will be shown if the value is not equal.
*Default: "This value should be equal to %%compared_value%%."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%compared_value%% |
* The expected value | *
%%compared_value_type%% |
* The expected value type | *
%%value%% |
* The current (invalid) value | *
This option is required.
*It defines the value to compare to.
*It can be a string, number or object.
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['equal-to', 'equal', 'same', 'et'].
Validates that a value is greater than or equal to another value, defined in the options.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['greater_than_or_equal', 'greater-than-or-equal', 'min'].
This is the message that will be shown if the value is not greater than or equal to the comparison value.
*Default: "This value should be greater than or equal to %%compared_value%%."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%compared_value%% |
* The expected value | *
%%compared_value_type%% |
* The expected value type | *
%%value%% |
* The current (invalid) value | *
This option is required.
*It defines the value to compare to.
*It can be a string, number or date object.
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['greater_than_or_equal', 'greater-than-or-equal', 'min'].
Validates that a value is greater than another value, defined in the options.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['greater_than', 'greater-than', 'greater'].
This is the message that will be shown if the value is not greater than the comparison value.
*Default: "This value should be greater than %%compared_value%%."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%compared_value%% |
* The expected value | *
%%compared_value_type%% |
* The expected value type | *
%%value%% |
* The current (invalid) value | *
This option is required.
*It defines the value to compare to.
*It can be a string, number or date object.
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['greater_than', 'greater-than', 'greater'].
This constraint is used to ensure that a bank account number has the proper format of an {@link https://en.wikipedia.org/wiki/International_Bank_Account_Number|International Bank Account Number (IBAN)}.
*IBAN is an internationally agreed means of identifying bank accounts across national borders with a reduced risk of propagating transcription errors.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['iban'].
The default message supplied when the value does not pass the IBAN check.
Default: "This is not a valid International Bank Account Number (IBAN)."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['iban'].
Validates that a value is identical to another value, defined in the options.
*This constraint compares using ===, so 3 and "3" are not considered equal.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['identical-to', 'identical', 'it'].
This is the message that will be shown if the value is not identical.
*Default: "This value should be identical to %%compared_value_type%% %%compared_value%%."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%compared_value%% |
* The expected value | *
%%compared_value_type%% |
* The expected value type | *
%%value%% |
* The current (invalid) value | *
This option is required.
It defines the value to compare to.
*It can be a string, number or object.
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['identical-to', 'identical', 'it'].
Validates that a value is a valid IP address.
*By default, this will validate the value as IPv4, but a number of different options exist to validate as IPv6 and many other combinations.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['ip'].
This message is shown if the string is not a valid IP address.
*Default: "This is not a valid IP address."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
Normalizer string before validate (trim, etc.).
*Default: false.
This determines exactly how the IP address is validated and can take one of a variety of different values.
*Default: "4".
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['ip'].
Validates that a value is false.
Specifically, this checks to see if the value is exactly false, exactly the integer 0, or exactly the string "0".
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['is-false', 'false'].
This message is shown if the underlying data is not false.
*Default: "This value should be false."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['is-false', 'false'].
Validates that a value is exactly equal to null.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['is-null', 'null', 'nullable'].
This is the message that will be shown if the value is not null.
*Default: "This value should be null."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['is-null', 'null', 'nullable'].
Validates that a value is true.
Specifically, this checks if the value is exactly true, exactly the integer 1, or exactly the string "1".
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['is-true', 'true'].
This message is shown if the underlying data is not true.
*Default: "This value should be true."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['is-true', 'true'].
This constraint validates that an {@link https://en.wikipedia.org/wiki/Isbn|International Standard Book Number (ISBN)} is either a valid ISBN-10 or a valid ISBN-13.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['isbn'].
The message that will be shown if the type option is null and the given value does not pass any of the ISBN checks.
Default: "This value is neither a valid ISBN-10 nor a valid ISBN-13."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
The message that will be shown if the type option is isbn10 and the given value does not pass the ISBN-10 check.
Default: "This value is not a valid ISBN-10."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
The message that will be shown if the type option is isbn13 and the given value does not pass the ISBN-13 check.
Default: "This value is not a valid ISBN-13."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
The message that will be shown if the value is not valid. If not null, this message has priority over all the other messages.
Default: null
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
The type of ISBN to validate against. Valid values are isbn10, isbn13 and null to accept any kind of ISBN.
Default: null
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['isbn'].
Validates that a value is a valid {@link https://en.wikipedia.org/wiki/Issn|International Standard Serial Number (ISSN)}.
* @description *Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['issn'].
The validator will allow ISSN values to end with a lower case 'x' by default.
When switching this to true, the validator requires an upper case 'X'.
Default: false
The validator will allow non hyphenated ISSN values by default.
When switching this to true, the validator requires a hyphenated ISSN value.
Default: false
The message shown if the given value is not a valid ISSN.
*Default: "This value is not a valid ISSN."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['issn'].
Validates that a value has valid JSON syntax.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['json'].
This message is shown if the underlying data is not a valid JSON value.
*Default: "This value should be valid JSON."
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['json'].
Validates that a value is a valid language Unicode language identifier (e.g. fr or ar-dz).
Available languages:
*'aa', 'ab', 'ace', 'ach', 'ada', 'ady', 'ae', 'aeb', 'af', 'afh', 'agq', 'ain', 'ak', 'akk', 'akz', 'ale', 'aln', 'alt', 'am', 'an', 'ang', 'anp', 'ar', 'arc', 'arn', 'aro', 'arp', 'arq', 'ars', 'arw', 'ary', 'arz', 'as', 'asa', 'ase', 'ast', 'av', 'avk', 'awa', 'ay', 'az', 'ba', 'bal', 'ban', 'bar', 'bas', 'bax', 'bbc', 'bbj', 'be', 'bej', 'bem', 'bew', 'bez', 'bfd', 'bfq', 'bg', 'bgn', 'bho', 'bi', 'bik', 'bin', 'bjn', 'bkm', 'bla', 'bm', 'bn', 'bo', 'bpy', 'bqi', 'br', 'bra', 'brh', 'brx', 'bs', 'bss', 'bua', 'bug', 'bum', 'byn', 'byv', 'ca', 'cad', 'car', 'cay', 'cch', 'ccp', 'ce', 'ceb', 'cgg', 'ch', 'chb', 'chg', 'chk', 'chm', 'chn', 'cho', 'chp', 'chr', 'chy', 'cic', 'ckb', 'co', 'cop', 'cps', 'cr', 'crh', 'crs', 'cs', 'csb', 'cu', 'cv', 'cy', 'da', 'dak', 'dar', 'dav', 'de', 'del', 'den', 'dgr', 'din', 'dje', 'doi', 'dsb', 'dtp', 'dua', 'dum', 'dv', 'dyo', 'dyu', 'dz', 'dzg', 'ebu', 'ee', 'efi', 'egl', 'egy', 'eka', 'el', 'elx', 'en', 'enm', 'eo', 'es', 'esu', 'et', 'eu', 'ewo', 'ext', 'fa', 'fan', 'fat', 'ff', 'fi', 'fil', 'fit', 'fj', 'fo', 'fon', 'fr', 'frc', 'frm', 'fro', 'frp', 'frr', 'frs', 'fur', 'fy', 'ga', 'gaa', 'gag', 'gan', 'gay', 'gba', 'gbz', 'gd', 'gez', 'gil', 'gl', 'glk', 'gmh', 'gn', 'goh', 'gom', 'gon', 'gor', 'got', 'grb', 'grc', 'gsw', 'gu', 'guc', 'gur', 'guz', 'gv', 'gwi', 'ha', 'hai', 'hak', 'haw', 'he', 'hi', 'hif', 'hil', 'hit', 'hmn', 'ho', 'hr', 'hsb', 'hsnht', 'hu', 'hup', 'hy', 'hz', 'ia', 'iba', 'ibb', 'id', 'ie', 'ig', 'ii', 'ik', 'ilo', 'inh', 'io', 'is', 'it', 'iu', 'izh', 'ja', 'jam', 'jbo', 'jgo', 'jmc', 'jpr', 'jrb', 'jut', 'jv', 'ka', 'kaa', 'kab', 'kac', 'kaj', 'kam', 'kaw', 'kbd', 'kbl', 'kcg', 'kde', 'kea', 'ken', 'kfo', 'kg', 'kgp', 'kha', 'kho', 'khq', 'khw', 'ki', 'kiu', 'kj', 'kk', 'kkj', 'kl', 'kln', 'km', 'kmb', 'kn', 'ko', 'koi', 'kok', 'kos', 'kpe', 'kr', 'krc', 'kri', 'krj', 'krl', 'kru', 'ks', 'ksb', 'ksf', 'ksh', 'ku', 'kum', 'kut', 'kv', 'kw', 'ky', 'la', 'lad', 'lag', 'lah', 'lam', 'lb', 'lez', 'lfn', 'lg', 'li', 'lij', 'liv', 'lkt', 'lmo', 'ln', 'lo', 'lol', 'lou', 'loz', 'lrc', 'lt', 'ltg', 'lu', 'lua', 'lui', 'lun', 'luo', 'lus', 'luy', 'lv', 'lzh', 'lzz', 'mad', 'maf', 'mag', 'mai', 'mak', 'man', 'mas', 'mde', 'mdf', 'mdr', 'men', 'mer', 'mfe', 'mg', 'mga', 'mgh', 'mgo', 'mh', 'mi', 'mic', 'min', 'mk', 'ml', 'mn', 'mnc', 'mni', 'moh', 'mos', 'mr', 'mrj', 'ms', 'mt', 'mua', 'mus', 'mwl', 'mwr', 'mwv', 'my', 'mye', 'myv', 'mzn', 'na', 'nan', 'nap', 'naq', 'nb', 'nd', 'nds', 'ne', 'new', 'ng', 'nia', 'niu', 'njo', 'nl', 'nmg', 'nn', 'nnh', 'no', 'nog', 'non', 'nov', 'nqo', 'nr', 'nso', 'nus', 'nv', 'nwc', 'ny', 'nym', 'nyn', 'nyo', 'nzi', 'oc', 'oj', 'om', 'or', 'os', 'osa', 'ota', 'pa', 'pag', 'pal', 'pam', 'pap', 'pau', 'pcd', 'pcm', 'pdc', 'pdt', 'peo', 'pfl', 'phn', 'pi', 'pl', 'pms', 'pnt', 'pon', 'prg', 'pro', 'ps', 'pt', 'qu', 'quc', 'qug', 'raj', 'rap', 'rar', 'rgn', 'rif', 'rm', 'rn', 'ro', 'rof', 'rom', 'rtm', 'ru', 'rue', 'rug', 'rup', 'rw', 'rwk', 'sa', 'sad', 'sah', 'sam', 'saq', 'sas', 'sat', 'saz', 'sba', 'sbp', 'sc', 'scn', 'sco', 'sd', 'sdc', 'sdh', 'se', 'see', 'seh', 'sei', 'sel', 'ses', 'sg', 'sga', 'sgs', 'sh', 'shi', 'shn', 'shu', 'si', 'sid', 'sk', 'sl', 'sli', 'sly', 'sm', 'sma', 'smj', 'smn', 'sms', 'sn', 'snk', 'so', 'sog', 'sq', 'sr', 'srn', 'srr', 'ss', 'ssy', 'st', 'stq', 'su', 'suk', 'sus', 'sux', 'sv', 'sw', 'swb', 'syc', 'syr', 'szl', 'ta', 'tcy', 'te', 'tem', 'teo', 'ter', 'tet', 'tg', 'th', 'ti', 'tig', 'tiv', 'tk', 'tkl', 'tkr', 'tl', 'tlh', 'tli', 'tly', 'tmh', 'tn', 'to', 'tog', 'tpi', 'tr', 'tru', 'trv', 'ts', 'tsd', 'tsi', 'tt', 'ttt', 'tum', 'tvl', 'tw', 'twq', 'ty', 'tyv', 'tzm', 'udm', 'ug', 'uga', 'uk', 'umb', 'ur', 'uz', 'vai', 've', 'vec', 'vep', 'vi', 'vls', 'vmf', 'vo', 'vot', 'vro', 'vun', 'wa', 'wae', 'wal', 'war', 'was', 'wbp', 'wo', 'wuu', 'xal', 'xh', 'xmf', 'xog', 'yao', 'yap', 'yav', 'ybb', 'yi', 'yo', 'yrl', 'yue', 'za', 'zap', 'zbl', 'zea', 'zen', 'zgh', 'zh', 'zu', 'zun', 'zza'
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['language', 'lang'].
This message is shown if the string is not a valid language code.
*Default: "This value is not a valid language."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['language', 'lang'].
Validates that a given string length is between some minimum and maximum value.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['length', 'len'].
If set to true, empty strings are considered valid.
*The default false value considers empty strings not valid.
*Default: false.
The message that will be shown if min and max values are equal and the underlying value's length is not exactly this value.
*Default: "This value should have exactly %%limit%% characters.".
You can use the following parameters in this message:
*| Parameter | *Description | *
%%limit%% |
* The exact expected length | *
%%value%% |
* The current (invalid) value | *
The message that will be shown if the underlying value's length is more than the max option.
*Default: "This value is too long. It should have %%limit%% characters or less.".
*
You can use the following parameters in this message:
*| Parameter | *Description | *
%%limit%% |
* The expected maximum length | *
%%value%% |
* The current (invalid) value | *
The message that will be shown if the underlying value's length is less than the min option.
*Default: "This value is too short. It should have %%limit%% characters or more.".
You can use the following parameters in this message:
*| Parameter | *Description | *
%%limit%% |
* The expected minimum length | *
%%value%% |
* The current (invalid) value | *
Normalizer string before validate (trim, etc.).
*Default: false
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['length', 'len'].
Validates that a value is less than or equal to another value, defined in the options.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['less_than_or_equal'', 'less-than-or-equal', 'max'].
This is the message that will be shown if the value is not less than or equal to the comparison value.
*Default: "This value should be less than or equal to %%compared_value%%."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%compared_value%% |
* The expected value | *
%%compared_value_type%% |
* The expected value type | *
%%value%% |
* The current (invalid) value | *
This option is required.
*It defines the value to compare to.
*It can be a string, number or date object.
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['less_than_or_equal'', 'less-than-or-equal', 'max'].
Validates that a value is less than another value, defined in the options.
* @description *Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['less_than', 'less-than', 'less'].
This is the message that will be shown if the value is not less than the comparison value.
*Default: "This value should be less than %%compared_value%%."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%compared_value%% |
* The expected value | *
%%compared_value_type%% |
* The expected value type | *
%%value%% |
* The current (invalid) value | *
This option is required.
*It defines the value to compare to.
*It can be a string, number or date object.
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['less_than', 'less-than', 'less'].
Validates that a value is a valid locale.
The "value" for each locale is any of the {@link http://userguide.icu-project.org/locale|ICU format locale IDs}.
For example, the two letter {@link https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes|ISO 639-1} language code (e.g. fr), or the language code followed by an underscore (_) and the {@link https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes|ISO 3166-1 alpha-2} country code (e.g. fr_FR for French/France).
The given locale values are canonicalized before validating them to avoid issues with wrong uppercase/lowercase values and to remove unneeded elements (e.g. FR-fr.utf8 will be validated as fr_FR).
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['locale'].
This message is shown if the string is not a valid locale.
*Default: "This value is not a valid locale."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['locale'].
This constraint is used to ensure that a credit card number passes the {@link https://en.wikipedia.org/wiki/Luhn_algorithm|Luhn algorithm}.
It is useful as a first step to validating a credit card: before communicating with a payment gateway.
* @description *Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['luhn'].
The default message supplied when the value does not pass the Luhn check.
*Default: "Invalid card number."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['luhn'].
Validates that a value is a negative number or equal to zero.
If you don't want to allow zero as value, use sogv.Negative instead.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['negative-or-zero', 'noz'].
The default message supplied when the value is not less than or equal to zero.
*Default: "This value should be either negative or zero."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%compared_value%% |
* The expected value | *
%%compared_value_type%% |
* The expected value type | *
%%value%% |
* The current (invalid) value | *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['negative-or-zero', 'noz'].
Validates that a value is a negative number.
Zero is neither positive nor negative, so you must use sogv.NegativeOrZero if you want to allow zero as value.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['negative'].
The default message supplied when the value is not less than zero.
*Default: "This value should be negative."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%compared_value%% |
* The expected value | *
%%compared_value_type%% |
* The expected value type | *
%%value%% |
* The current (invalid) value | *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['negative'].
Validates that a value is not blank - meaning not equal to a blank string, a blank array, false or null (null behavior is configurable).
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['not-blank', 'not-empty', 'filled'].
true, null values are considered valid and won't trigger a constraint violation.
* Default: false
*/
allowNull: boolean;
/**
* @name sogv.NotBlankValidator#normalize
* @type {Boolean}
* @description
* Normalizer string before validate (trim, etc.).
*Default: false
Default: "This value should not be blank."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['not-blank', 'not-empty', 'filled'].
Validates that a value is not equal to another value, defined in the options.
*This constraint compares using !=, so 3 and "3" are considered equal. sogv.Use NotIdenticalTo to compare with !==.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['not-equal-to', 'not-equal', 'net'].
This is the message that will be shown if the value is not equal.
*Default: "This value should not be equal to %%compared_value%%."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%compared_value%% |
* The expected value | *
%%compared_value_type%% |
* The expected value type | *
%%value%% |
* The current (invalid) value | *
This option is required.
*It defines the value to compare to.
*It can be a string, number or object.
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['not-equal-to', 'not-equal', 'net'].
Validates that a value is not identical to another value, defined in the options.
*This constraint compares using !==, so 3 and "3" are considered not equal.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['not-identical-to', 'not-identical', 'nit'].
Default: "This value should not be identical to %%compared_value_type%% %%compared_value%%."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%compared_value%% |
* The expected value | *
%%compared_value_type%% |
* The expected value type | *
%%value%% |
* The current (invalid) value | *
This option is required.
*It defines the value to compare to.
*It can be a string, number or object.
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['not-identical-to', 'not-identical', 'nit'].
Validates that a value is not strictly equal to null.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['not-null', 'required', 'present'].
This is the message that will be shown if the value is null.
*Default: "This value should not be null."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['not-null', 'required', 'present'].
Validates that a value is a positive number or equal to zero.
If you don't want to allow zero as value, use sogv.Positive instead.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['positive-or-zero', 'poz'].
The default message supplied when the value is not greater than or equal to zero.
Default: "This value should be either positive or zero."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%compared_value%% |
* The expected value | *
%%compared_value_type%% |
* The expected value type | *
%%value%% |
* The current (invalid) value | *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['positive-or-zero', 'poz'].
Validates that a value is a positive number.
*Zero is neither positive nor negative, so you must use sogv.PositiveOrZero if you want to allow zero as value.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['positive'].
The default message supplied when the value is not greater than zero.
*Default: "This value should be positive."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%compared_value%% |
* The expected value | *
%%compared_value_type%% |
* The expected value type | *
%%value%% |
* The current (invalid) value | *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['positive'].
Validates that a given number or Date object is between some minimum and maximum.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['range'].
The message that will be shown if the underlying value is not a number.
*Default: "This value should be a valid number."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
The message that will be shown if the underlying value is more than the max option.
*Default: "This value should be %%limit%% or less."
You can use the following parameters in this message:
*| Parameter | *Description | *
%%limit%% |
* The upper limit | *
%%value%% |
* The current (invalid) value | *
The message that will be shown if the underlying value is less than the min option.
*Default: "This value should be %%limit%% or more."
You can use the following parameters in this message:
*| Parameter | *Description | *
%%limit%% |
* The lower limit | *
%%value%% |
* The current (invalid) value | *
The message that will be shown if the underlying value is less than the min option or greater than the max option.
*Default: "This value should be between %%min%% and %%max%%."
You can use the following parameters in this message:
*| Parameter | *Description | *
%%max%% |
* The upper limit | *
%%min%% |
* The lower limit | *
%%value%% |
* The current (invalid) value | *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['range'].
Validates that a value matches a regular expression.
* @description *Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['regex', 'regexp'].
If true (or not set), this validator will pass if the given string matches the given pattern regular expression.
However, when this option is set to false, the opposite will occur: validation will pass only if the given string does not match the pattern regular expression.
*Default: true.
Default: "This value is not valid."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
This required option is the regular expression pattern that the input will be matched against.
*By default, this validator will fail if the input string does not match this regular expression.
*However, if match is set to false, then validation will fail if the input string does match this pattern.
Normalizer string before validate (trim, etc.).
*Default: false
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['regex', 'regexp'].
Validates that a value is a valid time, meaning a string (or an object that can be cast into a string) that follows a valid HH:mm:ss format.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['time'].
This message is shown if the underlying data is not a valid time.
*Default: "This value is not a valid time."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['time'].
Validates that a value is a valid timezone identifier (e.g. Europe/Paris).
{@link https://en.wikipedia.org/wiki/List_of_tz_database_time_zones|List of tz database time zones}.
* @description *Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['timezone', 'tz'].
This message is shown if the underlying data is not a valid timezone identifier.
*Default: "This value is not a valid timezone."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['timezone', 'tz'].
Validates that a value is of a specific data type.
For example, if a variable should be an array, you can use this constraint with the array type option to validate this.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['type'].
If true, one of data type needs to be valid, otherwise passed data should be valid for all types.
Default: false
The message if the underlying data is not of the given type.
*Default: "This value should be of type %%type%%."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%type%% |
* The expected type | *
%%value%% |
* The current (invalid) value | *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['type'].
Validates that all the elements of the given collection are unique (none of them is present more than once).
Elements are compared strictly, so '7' and 7 are considered different elements (a string and an integer, respectively).
It can be a string or array.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['unique'].
This is the message that will be shown if at least one element is repeated in the collection.
*Default: "This collection should contain only unique elements."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The repeated value | *
Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['unique'].
Validates that a value is a valid URL string.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['url'].
Default: "This value is not a valid URL."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
false.
*/
normalize: boolean;
/**
* @name sogv.UrlValidator#protocols
* @type {Array}
* @description
* The protocols considered to be valid for the URL.
* For example, if you also consider the ftp:// type URLs to be valid, redefine the protocols array, listing http, https, and also ftp.
* Default: ['http', 'https', 'ftp']
*/
protocols: any[];
/**
* @name sogv.UrlValidator#relativeProtocol
* @type {Boolean}
* @description
* If true, the protocol is considered optional when validating the syntax of the given URL.
* This means that both http:// and https:// are valid but also relative URLs that contain no protocol (e.g. //example.com).
* Default: false.
*/
relativeProtocol: boolean;
/**
* @name sogv.BaseValidator#data
* @type {*}
* @description Data that needs to be validated.
*/
data: any;
/**
* @name sogv.BaseValidator#lang
* @type {String}
* @description Language of error messages.
*/
lang: string;
/**
* @function
* @name sogv.BaseValidator#isValid
* @description
* Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['url'].
Validates that a value is a valid {@link https://en.wikipedia.org/wiki/Universally_unique_identifier|Universally unique identifier (UUID)} per {@link https://tools.ietf.org/html/rfc4122|RFC 4122}.
*By default, this will validate the format according to the RFC's guidelines, but this can be relaxed to accept non-standard UUIDs that other systems (like PostgreSQL) accept.
UUID versions can also be restricted using a whitelist.
Create a new Validator.
* @param {*} data The data which needs to be validated. * @param {Object} options The setting options * @param {Object} optionRules The validation rules for setting options. * @param {String} lang The language used by the application. Default: "en".
* @param {Boolean} internal If this parameter is true, it means, that validation called from core.
* @property {Array} alias
* The aliases for the current validator.
*They could be used in the short validation format.
*Defined aliases: ['uuid'].
This message is shown if the string is not a valid UUID.
Default: "This is not a valid UUID."
You can use the following parameters in this message:
*| Parameter | *Description | *
|---|---|
%%value%% |
* The current (invalid) value | *
Normalizer string before validate (trim, etc.).
*Default: false.
If this option is set to true the constraint will check if the UUID is formatted per the RFC's input format rules: 216fff40-98d9-11e3-a5e2-0800200c9a66.
Default: true.
Setting this to false will allow alternate input formats like:
* *This option can be used to only allow specific {@link https://en.wikipedia.org/wiki/Universally_unique_identifier#Variants_and_versions|UUID versions}.
*Valid versions are 1 - 5.
Default: [1,2,3,4,5].
The following PHP constants can also be used:
*Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.BaseValidator#errors * @description *Return error errors
* @returns {sogv.Error} Error messages */ errors(): sogv.Error; /** *The aliases for the current validator.
They could be used in the short validation format.
Defined aliases: ['uuid'].
I18n handler
*/ namespace I18nHandler { /** * @function * @name sogv.I18nHandler#add * @description *Add new message or messages to global collection for specific language.
* @param {String} lang The current language * @param {Array} messages Message or messages * @example * sogv.I18nHandler.add('fr', [{ * "source": "The value you selected is not a valid choice.", * "target": "Cette valeur doit être l'un des choix proposés." * }]); * * // The first part of the message: "You must select at least %%limit%% choice." - this is the singular form * // The second part of the message: "You must select at least %%limit%% choices." - this is the plural form * // The form depends on value of "%%limit%%". If value "1", "0" or "-1" - singular form, otherwise - plural form * sogv.I18nHandler.add('fr', [{ * "source": "You must select at least %%limit%% choice.|You must select at least %%limit%% choices.", * "target": "Vous devez sélectionner au moins %%limit%% choix.|Vous devez sélectionner au moins %%limit%% choix." * }]); */ function add(lang: string, messages: any[]): void; /** * @function * @name sogv.I18nHandler#get * @description *Get translated message for specific language by origin message.
* @param {String} lang The current language * @param {String} sourceMessage The source message * @returns {String|Null} The translated message */ function get(lang: string, sourceMessage: string): string | null; /** * @function * @name sogv.I18nHandler#prepare * @description *Prepare message.
* @param {String} message Message text * @param {Object} parameters Message parameters * @returns {String} Processed message */ function prepare(message: string, parameters: any): string; } /** * @namespace * @name sogv.ValidationSettingsHandler * @description *Validation settings handler.
*This handler provides different types of validation settings parsers (validator's name and settings).
* @example * var validators = sogv.ValidationSettingsHandler.parse('required|email:{"mode":"html5"}'); */ namespace ValidationSettingsHandler { /** * @function * @name sogv.ValidationSettingsHandler#parse * @description Prepare validation settings * @param {String|JSON|Object} settings Validation settings * @returns {Object} Processed settings */ function parse(settings: string | JSON | any): any; } /**add * @constructor * @name sogv.ValidatorHandler * @classdesc This service provides handling validation of form * @description *Create a new validator handler.
*/ class ValidatorHandler { /** * @function * @name sogv.ValidatorHandler#add * @description *Add new validator for field.
* @param {String} key Field key * @param {sogv.AllValidator} validator Validator */ add(key: string, validator: sogv.AllValidator): void; /** * @function * @name sogv.ValidatorHandler#get * @description *Get validator for field.
* @param {String} key Field key * @returns {sogv.AllValidator} */ get(key: string): sogv.AllValidator; /** * @function * @name sogv.ValidatorHandler#isValid * @description *Check if data valid.
* @returns {Boolean} Validation status */ isValid(): boolean; /** * @function * @name sogv.ValidatorHandler#isValidWithErrorMessage * @description *Check if data valid.
* @returns {Boolean} Validation status */ isValidWithErrorMessage(): boolean; } /** * @constructor * @name sogv.I18n * @classdesc *Handles translation. Responsible for the translation. Can also handle plural forms.
* @param {String} lang The current language. This parameter is required. * @example * var translator = new sogv.I18n(lang); * var translatedMessage = translator.getText(message, parameters); */ class I18n { constructor(lang: string); /** * @function * @name sogv.I18n#translate * @description Returns the translation. * @param {String} message The message which need to be translated * @param {Object} parameters The message parameters * @returns {String} Translated and processed message */ translate(message: string, parameters: any): string; } }