JavaScript-utils ============ > JavaScript工具函数库 ## array * [arrayDisorder — 打乱数组顺序](https://github.com/striveDJiang/JavaScript-utils/blob/master/array/arrayDisorder.js) * [arrayEqual — 判断两个数组是否相等](https://github.com/striveDJiang/JavaScript-utils/blob/master/array/arrayEqual.js) * [arrayFlattening — 数组扁平化](https://github.com/striveDJiang/JavaScript-utils/blob/master/array/arrayFlattening.js) * [arrayRandom — 从数组中随机获取元素](https://github.com/striveDJiang/JavaScript-utils/blob/master/array/arrayRandom.js) * [arrayRemoveRepeat — 数组去重](https://github.com/striveDJiang/JavaScript-utils/blob/master/array/arrayRemoveRepeat.js) * [arraySum — 数组求和(数字类型的数组)](https://github.com/striveDJiang/JavaScript-utils/blob/master/array/arraySum.js) * [getEleCount — 返回数组或字符串中一个元素出现的次数](https://github.com/striveDJiang/JavaScript-utils/blob/master/array/getEleCount.js) * [getCount — 返回数组(或字符串)中出现最多的元素和出现次数](https://github.com/striveDJiang/JavaScript-utils/blob/master/array/getCount.js) * [maxArr — 找出数组中的最大值(数字类型的数组)](https://github.com/striveDJiang/JavaScript-utils/blob/master/array/maxArr.js) * [minArr — 找出数组中的最小值(数字类型的数组)](https://github.com/striveDJiang/JavaScript-utils/blob/master/array/minArr.js) ## string * [changeCase — 大小写转换](https://github.com/striveDJiang/JavaScript-utils/blob/master/string/changeCase.js) * [removeSpace — 字符串去除空格](https://github.com/striveDJiang/JavaScript-utils/blob/master/string/removeSpace.js) * [stringReplace — 字符串替换](https://github.com/striveDJiang/JavaScript-utils/blob/master/string/stringReplace.js) * [stringFormat — 格式化字符串](https://github.com/striveDJiang/JavaScript-utils/blob/master/string/stringFormat.js) * [repeatCopy — 字符串重复复制](https://github.com/striveDJiang/JavaScript-utils/blob/master/string/repeatCopy.js) * [digitUppercase — 现金额转大写](https://github.com/striveDJiang/JavaScript-utils/blob/master/string/digitUppercase.js) ## object * [dataType — 数据类型判断](https://github.com/striveDJiang/JavaScript-utils/blob/master/object/dataType.js) * [deepClone — 深拷贝,支持常见类型](https://github.com/striveDJiang/JavaScript-utils/blob/master/object/deepClone.js) * [isEmptyObject — 判断obj是否为空](https://github.com/striveDJiang/JavaScript-utils/blob/master/object/isEmptyObject.js) ## function * [debounce — 函数防抖](https://github.com/striveDJiang/JavaScript-utils/blob/master/function/debounce.js) * [throttle — 函数节流](https://github.com/striveDJiang/JavaScript-utils/blob/master/function/throttle.js) ## dom * [hasClass — 判断元素是否有某个class](https://github.com/striveDJiang/JavaScript-utils/blob/master/dom/hasClass.js) * [addClass — 为元素添加class](https://github.com/striveDJiang/JavaScript-utils/blob/master/dom/addClass.js) * [removeClass — 为元素移除class](https://github.com/striveDJiang/JavaScript-utils/blob/master/dom/removeClass.js) ## bom * [setScrollTop — 设置滚动条距顶部的距离](https://github.com/striveDJiang/JavaScript-utils/blob/master/bom/setScrollTop.js) * [getScrollTop — 获取滚动条距顶部的距离](https://github.com/striveDJiang/JavaScript-utils/blob/master/bom/getScrollTop.js) * [scrollTo — 在${duration}时间内,滚动条平滑滚动到${to}指定位置](https://github.com/striveDJiang/JavaScript-utils/blob/master/bom/scrollTo.js) * [offset — 获取一个元素的距离文档(document)的位置,类似jQ中的offset()](https://github.com/striveDJiang/JavaScript-utils/blob/master/bom/offset.js) * [isSupportWebP — 判断浏览器是否支持webP格式图片](https://github.com/striveDJiang/JavaScript-utils/blob/master/bom/isSupportWebP.js) ## date * [formatPassTime — 格式化${startTime}距现在的已过时间](https://github.com/striveDJiang/JavaScript-utils/blob/master/date/formatPassTime.js) * [formatRemainTime — 格式化现在距${endTime}的剩余时间](https://github.com/striveDJiang/JavaScript-utils/blob/master/date/formatRemainTime.js) ## random * [randomColor — 随机生成颜色](https://github.com/striveDJiang/JavaScript-utils/blob/master/random/randomColor.js) * [randomNum — 生成指定范围随机数](https://github.com/striveDJiang/JavaScript-utils/blob/master/random/randomNum.js) ## regexp * [isEmail — 判断是否为邮箱地址](https://github.com/striveDJiang/JavaScript-utils/blob/master/regexp/isEmail.js) * [isIdCard — 判断是否为身份证号](https://github.com/striveDJiang/JavaScript-utils/blob/master/regexp/isIdCard.js) * [isPhoneNum — 判断是否为手机号](https://github.com/striveDJiang/JavaScript-utils/blob/master/regexp/isPhoneNum.js) * [isUrl — 判断是否为URL地址](https://github.com/striveDJiang/JavaScript-utils/blob/master/regexp/isUrl.js) ## url * [parseQueryString — url参数转对象](https://github.com/striveDJiang/JavaScript-utils/blob/master/url/parseQueryString.js) * [stringfyQueryString — 对象序列化](https://github.com/striveDJiang/JavaScript-utils/blob/master/url/stringfyQueryString.js) ## cookie * [setCookie — 设置Cookie](https://github.com/striveDJiang/JavaScript-utils/blob/master/cookie/setCookie.js) * [getCookie — 根据name读取cookie](https://github.com/striveDJiang/JavaScript-utils/blob/master/cookie/getCookie.js) * [removeCookie — 根据name删除cookie](https://github.com/striveDJiang/JavaScript-utils/blob/master/cookie/removeCookie.js) ## device * [getExplore — 获取浏览器类型和版本](https://github.com/striveDJiang/JavaScript-utils/blob/master/device/getExplore.js) * [getOS — 获取操作系统类型](https://github.com/striveDJiang/JavaScript-utils/blob/master/device/getOS.js) * [getKeyName — 根据keycode获得键名](https://github.com/striveDJiang/JavaScript-utils/blob/master/device/getKeyName.js)