npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dezhu_utils

v2.4.0

Published

[![NPM version][npm-image]][npm-url] [![Build status][travis-image]][travis-url] [![Test coverage][coveralls-image]][coveralls-url] [![License][license-image]][license-url] [![Downloads][downloads-image]][downloads-url] [![Gittip][gittip-image]][gittip-ur

Downloads

32

Readme

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

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

License

MIT © Sindre Sorhus