xzy-web-utils
v1.0.4
Published
xzy-web-utils
Downloads
6
Readme
校验相关
TypeFn.isString //是否字符串
TypeFn.isNumber //是否数字
TypeFn.isBoolean //是否boolean
TypeFn.isFunction //是否函数
TypeFn.isNull //是否为null
TypeFn.isUndefined //是否undefined
TypeFn.isObj //是否对象
TypeFn.isArray //是否数组
TypeFn.isDate //是否时间
TypeFn.isRegExp //是否正则
TypeFn.isError //是否错误对象
TypeFn.isSymbol //是否Symbol函数
TypeFn.isPromise //是否Promise对象
TypeFn.isSet //是否Set对象
TypeFn.isFalse //否判断
TypeFn.isTrue //是判断
TypeFn.isIos //是否是ios
TypeFn.isPC //是否为pc端
TypeFn.browserType //判断浏览器类型
TypeFn.checkStr //正则校验
TypeFn.isCardID //严格的身份证校验
时间相关
DateFn.formatTime //格式化时间
DateFn.getMonths //返回指定长度的月份集合
DateFn.getDays //返回指定长度的天数集合
DateFn.formatHMS //格式化时分秒
DateFn.getMonthOfDay //获取某月有多少天
DateFn.getYearOfDay //获取某年有多少天
DateFn.getFirstDayOfYear //获取某年的第一天
DateFn.getLastDayOfYear //获取某年最后一天
DateFn.getDayOfYear //获取某个日期是当年中的第几天
DateFn.getDayOfYearWeek //获取某个日期在这一年的第几周
DateFn.formatDate //转换时间格式
DateFn.formatDateTwoMonthLater //转换时间格式--获取年月日 xx-xx-xx
DateFn.formatTime //转换时间格式--获取分秒 xx:xx
DateFn.formatYear //转换时间格式--获取年份
DateFn.getMouthFirstDay //获取当月月第一天0点0时0分(每月最开始)的时间戳 `` DateFn.formatDatePrototype //转换时间 new Date(1542274800000).Format('yy-MM-dd hh:mm:ss'); //"2018-11-15 17:40:00"
数组相关方法
ArrayFn.contains //判断一个元素是否在数组中
ArrayFn.each //
ArrayFn.map //
ArrayFn.sort //排序 1:从小到大 2:从大到小 3:随机
ArrayFn.unique //去重
ArrayFn.union //求两个集合的并集
ArrayFn.intersect //求两个集合的交集
ArrayFn.remove //删除其中一个元素
ArrayFn.formArray //将类数组转换为数组的方法
ArrayFn.remove //删除其中一个元素
ArrayFn.max //最大值
ArrayFn.min //最小值
ArrayFn.sum //求和
ArrayFn.average //平均值
去除空个、大小写、密码强度等
StringFn.trim //去除空格
StringFn.changeCase //大小写
StringFn.checkPwd //检测密码强度
StringFn.filterTag //过滤html代码(把<>转换)
StringFn.trim //去除空格
数字、金额、随机数相关
NumberFn.random //生成随机数
NumberFn.numberToChinese //将阿拉伯数字翻译成中文的大写数字
NumberFn.changeToChinese //将数字转换为大写金额
NumberFn.formdataMoney //金额千分位逗号分隔
NumberFn.random //生成随机数
NumberFn.random //生成随机数
深拷贝、防抖、节流
OtherFn.deepClone //深拷贝
OtherFn.debounce //防抖动
OtherFn.throttle //节流
OtherFn.getUrlParams //获取网址参数
OtherFn.getUrlAllParams //获取全部url参数,并转换成json对象
OtherFn.delParamsUrl //删除url指定参数,返回url
OtherFn.getRandomColor //获取十六进制随机颜色
OtherFn.imgLoadAll //图片加载
OtherFn.loadAudio //音频加载
OtherFn.domToStirng //DOM转字符串
OtherFn.stringToDom //字符串转dom
OtherFn.setCursorPosition //光标所在位置插入字符,并设置光标位置
OtherFn.insertAtCursor //光标所在位置插入字符
OtherFn.getRandomColor //获取十六进制随机颜色