function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

/*
 * @Author: codingfly
 * @Description:
 * @Date: 2021-08-11 13:36:10
 * @LastEditTime: 2021-09-10 09:04:37
 * @FilePath: \my-remax-ui\components\_utils\validate.ts
 */
import IdentityCodeValid from './checkIdent';
export function isDef(val) {
  return val !== undefined && val !== null;
} // eslint-disable-next-line @typescript-eslint/ban-types

export function isFunction(val) {
  return typeof val === 'function';
}
export function isObject(val) {
  return val !== null && _typeof(val) === 'object';
}
export function isPromise(val) {
  return isObject(val) && isFunction(val.then) && isFunction(val.catch);
}
export function isDate(val) {
  return Object.prototype.toString.call(val) === '[object Date]' && !Number.isNaN(val.getTime());
}
export function isMobile(value) {
  value = value.replace(/[^-|\d]/g, '');
  return /^((\+86)|(86))?(1)\d{10}$/.test(value) || /^0[0-9-]{10,13}$/.test(value);
}
export function isNumeric(val) {
  return typeof val === 'number' || /^\d+(\.\d+)?$/.test(val);
}
export function isId(val) {
  var data = val.toUpperCase();
  return IdentityCodeValid(data);
}
export function isIOS() {
  var inBrowser = typeof window !== 'undefined';
  return inBrowser ? /ios|iphone|ipad|ipod/.test(navigator.userAgent.toLowerCase()) : false;
}