easyappointments/assets/js/utils/validation.js

36 lines
1.0 KiB
JavaScript
Raw Normal View History

2021-12-18 20:55:01 +03:00
/* ----------------------------------------------------------------------------
* Easy!Appointments - Open Source Web Scheduler
*
* @package EasyAppointments
* @author A.Tselegidis <alextselegidis@gmail.com>
* @copyright Copyright (c) Alex Tselegidis
* @license https://opensource.org/licenses/GPL-3.0 - GPLv3
* @link https://easyappointments.org
* @since v1.5.0
* ---------------------------------------------------------------------------- */
/**
* Validation utility.
*
* This module implements the functionality of validation.
*/
2021-12-18 20:55:01 +03:00
window.App.Utils.Validation = (function () {
/**
* Validate the provided email.
*
* @param {String} value
*
* @return {Boolean}
*/
function email(value) {
const re =
2022-01-11 18:25:14 +03:00
/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
2021-12-18 20:55:01 +03:00
return re.test(value);
}
return {
email
};
})();