15.checkLowercaseLetter判断是否全部是小写字母
/** *判断是否全部是小写字母 * @param {Number} data */export const checkLowercaseLetter = data =https://www.isolves.com/it/cxkf/yy/js/2020-05-11/> /^[a-z]+$/g.test(data)复制代码
16.checkCapitalLetter判断是否是大写字母
/** *判断是否是大写字母 * @param {Number} data */export const checkCapitalLetter = data =https://www.isolves.com/it/cxkf/yy/js/2020-05-11/> /^[A-Z]+$/g.test(data)复制代码
17.checkNumOrLetter判断是否是字母或数字
/** * 判断是否是字母或数字 * @param {Number || String} data字符或数字 */export const checkNumOrLetter = data =https://www.isolves.com/it/cxkf/yy/js/2020-05-11/> /^[0-9a-zA-Z]*$/g.test(data)复制代码
判断是否是字母和数字的组合
/** * 判断是否是字母或数字 * @param {Number || String} data字符或数字 */export const checkNumAndLetter = data =https://www.isolves.com/it/cxkf/yy/js/2020-05-11/> /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,15}$/g.test(data)复制代码
18.checkChinese判断是否是中文
/** * 判断是否是中文 * @param {String} data中文 */export const checkChinese = data =https://www.isolves.com/it/cxkf/yy/js/2020-05-11/> /^[/u4E00-/u9FA5]+$/g.test(data)复制代码
19.checkChineseNumberLettter判断是否是中文 , 数字或字母
export const checkChineseNumberLettter = data =https://www.isolves.com/it/cxkf/yy/js/2020-05-11/> /^[a-zA-Z0-9/u4e00-/u9fa5]+$/g.test(data)复制代码
20.checkEmail判断是否是邮箱地址
/** * 判断是否是邮箱地址 * @param {String} data */export const checkEmail = data =https://www.isolves.com/it/cxkf/yy/js/2020-05-11/> {const reg = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/gif (reg.test(data)) return true}复制代码
21.checkTelphone判断是否是手机号
/** * 判断是否是手机号 , 只要是13,14,15,16,17,18,19开头即可 * @param {String} data */export const checkTelphone = data =https://www.isolves.com/it/cxkf/yy/js/2020-05-11/> {const reg = /^((+|00)86)?1[3-9]d{9}$/gif (reg.test(data)) return true}复制代码
22.checkUrl判断是否是正确的网址
/** * 判断是否是正确的网址 * @param {String} url 网址 */export const checkUrl = url => {const a = document.createElement('a')a.href = https://www.isolves.com/it/cxkf/yy/js/2020-05-11/urlreturn [/^(http|https):$/.test(a.protocol),a.host,a.pathname !== url,a.pathname !== `/${url}`].find(x => !x) === undefined}复制代码
client23.checkBrowser/** * 判断是浏览器内核 */export const checkBrowser = () => {const u = navigator.userAgent;const obj = {trident: u.indexOf("Trident") > -1, //IE内核presto: u.indexOf("Presto") > -1, //opera内核webKit: u.indexOf("AppleWebKit") > -1, //苹果、谷歌内核gecko: u.indexOf("Gecko") > -1 && u.indexOf("Khtml") == -1, //火狐内核}return Object.keys(obj)[Object.values(obj).indexOf(true)]};复制代码
24.checkIOSAndroidIpad判断是终端类型,值有ios,android,iPad
/** * 判断是终端类型,值有ios,android,iPad */export const checkIosAndroidIpad = () => {const u = navigator.userAgent;const obj = {ios: !!u.match(/(i[^;]+;( U;)? CPU.+mac OS X/), //ios终端android: u.indexOf("Android") > -1 || u.indexOf("linux") > -1, //android终端或者uc浏览器iPad: u.indexOf("iPad") > -1, //是否iPad}return Object.keys(obj)[Object.values(obj).indexOf(true)]};复制代码
25.checkWeixinQqUc判断是否是微信,qq 或 uc
/** * 判断是否是微信,qq 或 uc */export const checkWeixinQqUc = () => {const u = navigator.userAgent;const obj = {weixin: u.indexOf("MicroMessenger") > -1, //是否微信qq: u.match(/QQ/i) == "qq"&&!u.indexOf('MQQBrowser') > -1, //是否QQuc: u.indexOf('UCBrowser') > -1}return Object.keys(obj)[Object.values(obj).indexOf(true)]};复制代码
26.checkIsiphoneX检查是否是 IphoneX
/** * 检查是否是 IphoneX */export const checkIsIphoneX = () => {const u = navigator.userAgent;const isIOS = !!u.match(/(i[^;]+;( U;)? CPU.+Mac OS X/);if (isIOS && screen.height >= 812) {return true;}};复制代码
file27.fileFormatSize格式化文件单位
/** * 格式化文件单位 * @param {String || Number} size文件大小(kb) */export const fileFormatSize = size => {var ivar unit = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']for (i = 0; i < unit.length && size >= 1024; i++) {size /= 1024}return (Math.round(size * 100) / 100 || 0) + unit[i]}复制代码
obj28.objIsEqual判断两个对象是否相等,目前只支持对象值为简单数据类型的判断
推荐阅读
- 邻居家老蹭网,教你一招摆脱蹭网
- 中老年人怎样瘦肚子和腰?教你4个方法,消除腹部脂肪拥有好身材
- 教你如何识别我军3等10级的军官军衔,记住这3个要素就行了
- 花草茶常用有哪些,常用的花草茶有哪些
- 苦荞茶和黑苦荞哪个好,四大步骤教你如何简易而快速的冲泡百合花茶
- 膝盖疼就是关节炎吗?积水潭医生教你分辨
- 领导出现这几种行为,是逼员工主动离职,教你高情商反击
- 坚持长期喝茶有什么好处,教你九个喝茶的技巧
- 招聘|实用干货!20条HR常用的招聘问题!
- 怎样练习太极拳转腰跨 教你练习的小技巧