@makeen.io/material-ui-kit
Version:
Makeen UI components kit. Based on material-ui.
12 lines (11 loc) • 621 B
JavaScript
var text = "Invalid Phone Number, Please provide a valid phone number";
export default (function (_ref) {var _ref$schema = _ref.schema,type = _ref$schema.type,minOcc = _ref$schema.minOcc,_ref$validation$phone = _ref.validation.phone,message = _ref$validation$phone === void 0 ? text : _ref$validation$phone;return type === "phone" && [
"validate",
function (value) {
var re = /^[+]?[(]?[0-9]{3}[)]?[-\s.]?[0-9]{3}[-\s.]?[0-9]{4,6}$/im;
if (minOcc === 0 && value.length === 0) {
return true;
}
return re.test(String(value).toLowerCase()) ? true : text;
}];});
//# sourceMappingURL=phone.js.map