时间:2022-09-08 09:01:19 | 栏目:JavaScript代码 | 点击:次
export const isEmail = (e) => { return /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((.[a-zA-Z0-9_-]{2,3}){1,2})$/.test(e) }
export const isMobile = (e) => { return /^1[0-9]{10}$/.test(e) }
export const isPhone = (e) =>{ return /^([0-9]{3,4}-)?[0-9]{7,8}$/.test(e) }
export const isURL = (e) => { return /^http[s]?:\/\/.*/.test(e) }
export const isNumber = (e) =>{ return Object.prototype.toString.call(e).slice(8,-1) === 'String' }
export const isNumber = (e) =>{ return Object.prototype.toString.call(e).slice(8,-1) ==='Number' }
export const isBoolean = (e) =>{ return Object.prototype.toString.call(e).slice(8,-1) ==='Boolean' }
export const isFunction = (e) =>{ return Object.prototype.toString.call(e).slice(8,-1) === 'Function' }
export const isNull = (e) =>{ return Object.prototype.toString.call(e).slice(8,-1)==='Null' }
export const isUndefined = (e) =>{ return Object.prototype.toString.call(e).slice(8,-1)==='Undefined' }
export const isObject = (e) =>{ return Object.prototype.toString.call(e).slice(8,-1) === 'Object' }
export const isArray = (e) =>{ return Object.prototype.toString.call(e).slice(8,-1)==='Array' }
export const isDate = (e) =>{ return Object.prototype.toString.call(e).slice(8,-1)==='Date' }
export const isRegExp = (e) =>{ return Object.prototype.toString.call(e).slice(8,-1)==='RegExp' }
export const isError = (e) =>{ return Object.prototype.toString.call(e).slice(8,-1)==='Error' }
export const isSymbol = (e) =>{ return Object.prototype.toString.call(e).slice(8,-1)==='Symbol' }
export const isPromise = (e) =>{ return Object.prototype.toString.call(e).slice(8,-1)==='Promise' }
export const isSet = (e) =>{ return Object.prototype.toString.call(e).slice(8,-1) ==='Set' } export const us = navigator.userAgent.toLowerCase();
export const isWeiXin = () =>{ return ua.match(/microMessenger/i) == 'micromessenger' }
export const isDeviceMobile =()=>{ return /android|webos|iphone|ipod|balckberry/i.test(ua) }