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 🙏

© 2026 – Pkg Stats / Ryan Hefner

web-useful-tools

v1.0.10

Published

vue开发常用工具合集

Downloads

32

Readme

web-useful-tools

vue & uniapp 常用的功能封装,包括规则验证、节流防抖、常用mixins、时间格式化、对象转url参数等


一、使用

1、安装

npm install web-useful-tools

2、全局引用

// main.js
import webUsefulTools from 'web-useful-tools'
Vue.use(webUsefulTools)

// vue.config.js
module.exports = {
  transpileDependencies: ['web-useful-tools']
}

二、规则校验

1、通用规则调用方法

// 注:xxx为方法名,如:isEmpty

// 1、vue js中使用
console.log(this.$ti.test.xxx(false));

// 2、uniapp js中使用
console.log(uni.$ti.test.xxx(false));

// 3、模板中使用
:value="$ti.test.xxx(false)"

2、规则校验

  1. isEmpty(value):是否为空 ,包括:undefine、null、{}、[]、空字符串、false、0、“0”、NaN
  2. email(value):验证电子邮箱格式
  3. mobile(value):验证手机格式
  4. url(value):验证URL格式
  5. date(value):验证日期格式
  6. dateISO(value):验证ISO类型的日期格式
  7. number(value):验证十进制数字
  8. string(value):验证字符串
  9. digits(value):验证整数
  10. idCard(value):验证身份证号码
  11. carNo(value):是否车牌号,包括传统车牌号与新能源车牌号
  12. amount(value):金额,只允许2位小数
  13. chinese(value):中文
  14. letter(value):只能输入字母
  15. enOrNum(value):只能是字母或者数字
  16. contains(value, param):验证是否包含某个值
  17. range(value, param):验证一个值范围,param[min, max]
  18. landline(value):是否固定电话
  19. jsonString(value):是否json字符串
  20. array(value):是否数组
  21. object(value):是否对象
  22. code(value, len = 6):是否短信验证码,len验证码长度,默认6
  23. func(value):是否函数方法
  24. promise(value):是否promise对象
  25. image:是否图片格式
  26. video:是否视频格式
  27. regExp:是否正则对象