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 🙏

© 2025 – Pkg Stats / Ryan Hefner

wangliuzhou-utils

v0.0.1

Published

王留周前端工具库

Readme

wangliuzhou-util

王留周前端工具库

TODO

  • [ ] 优化文档

  • [ ] 正则表达式

  • [ ] 时间日期处理

  • [ ] 目录处理

  • Install

方法列表

Color

  • isHexColor 判断是否是六进制颜色值
  • rgbToHex RGB 颜色值转换为 十六进制颜色值
  • hexToRGB 十六进制颜色值转RGB颜色值

Event

  • EventBus
  • initGlobalEventBus
  • useGlobalEventBus
import { initGlobalEventBus } from '@wangliuzhou/utils'

initGlobalEventBus()
import { useGlobalEventBus } from '@wangliuzhou/utils'

const bus = useGlobalEventBus()

bus.on('test', (data: any) => {
  message.success('test')
})

Date

  • timestamp 获取当前时间戳

File

  • formatFileSize 格式化文件大小

Is

  • isArray 是否为数组
  • isObject 是否为对象
  • isString 是否为字符串
  • isNumber 是否为数字
  • isBoolean 是否为boolean
  • isRegExp 是否是正则
  • isBlob 是否是blob
  • isNull 是否为null
  • isFunction 是否是Function
  • isUnDef 是否未定义
  • isEmptyObject 是否是空对象
  • isEmpty 是否为空
  • isDate 是否是日期对象
  • isPromise 是否是Promise
  • isElement 是否是Element
  • isMap 是否是Map
  • isWindow 是否是Window
  • isBrowser 是否是浏览器环境

Regexp

参考 /src/regexp

  • intReg 整数
  • positiveIntReg 正整数 不包含0
  • negativeIntReg 负整数 不包含0
  • floatReg 浮点数
  • floatStrictReg 浮点数 严格
  • moneyReg 金额 最多两位小数
  • moneyStrictReg 货币金额(支持负数、千分位分隔符)
  • letterReg 英文字母
  • letterUpperReg 大写英文字母
  • letterLowerReg 小写英文字母
  • letterNumberReg 字母和数字组合
  • wxReg 微信号(wx),6至20位,以字母开头,字母,数字,减号,下划线
  • emailReg email(支持中文邮箱)
  • zipCodeReg 邮政编码 中国
  • idCardReg 身份证号(2代,18位数字),最后一位是校验位,可能为数字或字符X
  • telReg 座机电话
  • provinceReg 中国省
  • mobilePhoneReg 手机号(mobile phone)中国(宽松), 只要是13,14,15,16,17,18,19开头即可
  • creditCodeReg 统一社会信用代码(宽松匹配)(15位/18位/20位数字/字母)
  • urlReg 网址URL

String

  • randomStr 生成随机字符串
  • replaceAll 替换字符串中的所有匹配项

Types

类型工具

Lodash

  • cloneDeep
  • throttle
  • debounce