2.4.0 • Published 5 years ago

dezhu_utils v2.4.0

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

outils

outils

npm Build Status Coverage LICENSE MIT

Dezhu welcome you to use those funtion

#欢迎使用封装好的工具函数

Install

安装

$ npm install dezhu_utils --save

API

接口

let {
    arrayEqual,

    hasClass
    addClass,
    removeClass,

    getCookie,
    setCookie,
    removeCookie,

    getExplore,
    getOS,

    getScrollTop,
    offset,
    setScrollTop,
    scrollTo,

    getKeyName,

    deepClone,
    isEmptyObject,

    randomColor,
    randomNum,

    isEmail,
    isIdCard,
    isPhoneNum,
    isUrl,

    digitUppercase,

    isSupportWebP,
    formatPassTime,
    formatRemainTime,

    parseQueryString,
    stringfyQueryString,

    throttle,
    debounce,
} = require('dezhu_utils')

##Specification ##函数功能说明

1.判断两个数组是否相等
arrayEqual

2.判断元素是否有某个class
hasClass

3.为元素添加class
addClass

4.为元素移除class
removeClass

5.根据name读取cookie
getCookie

6.设置Cookie
setCookie

7.根据name删除cookie
removeCookie

8.获取浏览器类型和版本
getExplore

9.获取操作系统类型
getOS

10.获取滚动条距顶部的距离
getScrollTop

11.获取一个元素的距离文档(document)的位置,类似jQ中的offset()
offset

12.设置滚动条距顶部的距离
setScrollTop

13.在${duration}时间内,滚动条平滑滚动到${to}指定位置
scrollTo

14.根据keycode获得键名
getKeyName

15.深拷贝,支持常见类型
deepClone

16.判断`obj`是否为空
isEmptyObject

17.随机生成颜色
randomColor

18.生成指定范围随机数
randomNum

19.判断是否为邮箱地址
isEmail

20.判断是否为中国大陆身份证号
isIdCard

21.判断是否为中国大陆身手机号
isPhoneNum

22.判断是否为URL地址
isUrl

23.现金额转大写(华人地区通用)
digitUppercase

24.判断浏览器是否支持webP格式图片
isSupportWebP

25.格式化${startTime}距现在的已过时间
formatPassTime

26.格式化现在距${endTime}的剩余时间
formatRemainTime

27.url参数转对象
parseQueryString

28.对象序列化
stringfyQueryString

29.函数节流
throttle

30.函数防抖
debounce

这些功能的仅供参考
若有雷同,纯属巧合
如果有不同见解
欢迎邮件联系作者
406410589@qq.com
如果这些工具函数对你有帮助,
可以给作者捐一杯咖啡钱,
祝君一切安好,
祝君工作顺利。

License

MIT © Sindre Sorhus

2.4.0

5 years ago

2.3.0

5 years ago

2.2.0

5 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.9.0

5 years ago

1.8.0

5 years ago

1.7.0

5 years ago

1.6.0

5 years ago

1.5.0

5 years ago

1.4.0

5 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago