"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));

var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));

var validation = {
  isEmail: function () {
    var _isEmail = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(emailField) {
      var reggex;
      return _regenerator["default"].wrap(function _callee$(_context) {
        while (1) {
          switch (_context.prev = _context.next) {
            case 0:
              reggex = /^(([^<>()[\]\\.,;:\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,}))$/;
              return _context.abrupt("return", reggex.test(emailField));

            case 2:
            case "end":
              return _context.stop();
          }
        }
      }, _callee);
    }));

    function isEmail(_x) {
      return _isEmail.apply(this, arguments);
    }

    return isEmail;
  }(),
  isPhoneNumber: function () {
    var _isPhoneNumber = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(phoneField) {
      var reggex;
      return _regenerator["default"].wrap(function _callee2$(_context2) {
        while (1) {
          switch (_context2.prev = _context2.next) {
            case 0:
              reggex = /^(?:\+62|\(0\d{2,3}\)|0)\s?(?:361|8[17]\s?\d?)?(?:[ -]?\d{3,4}){2,3}$/;
              return _context2.abrupt("return", reggex.test(phoneField));

            case 2:
            case "end":
              return _context2.stop();
          }
        }
      }, _callee2);
    }));

    function isPhoneNumber(_x2) {
      return _isPhoneNumber.apply(this, arguments);
    }

    return isPhoneNumber;
  }()
};
//# sourceMappingURL=index.js.map