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

iot-validatejs

v1.0.20

Published

this is a common validatejs

Readme

1、Vue 和 angular 项目均可使用

angular项目使用:导入out/iot-validatejs-rjs.js,使用全局变量DataValidator访问

vue 项目使用:npm i iot-validatejs

2、验证类型/方法名

1)正则校验,传入数据,正则表达式

    DataValidator.regTest(data, rule)

2)非空校验

    DataValidator.isEmpty(data)

3)必须是整数

    DataValidator.isInt(data)

4)必须是正整数

    DataValidator.isPositiveInt(data)

5)必须是浮点数,小数位必须是*位,第二个参数不传即默认不限制小数位数

    DataValidator.isDouble(data, deci = Infinity)

6)必须是浮点数,且大于0.00

    DataValidator.isPositiveDouble(data)

7)大于某值

    DataValidator.greaterThan(data, base)

8)小于某值

    DataValidator.lessThan(data, base)

9)最大支持的字符长度

    DataValidator.maxLength(data, length)

10)邮箱类型

    DataValidator.isEmail(data)

11)电话类型

    DataValidator.validPhone(data)

12)日期类型

    DataValidator.validDate(date)

13)仅支持汉字和字母

    DataValidator.validStrA(str)

14)支持中文、数字、字母、括号、逗号、斜杠及下划线

    DataValidator.validStrB(str)

15)1-30个字符,中文、数字、字母及下划线;(一个中文、一个数字、一个字母、下划线均代表一个字符)

    DataValidator.validStrC(str)

16)4~15位数字/中英文/下划线,不能以数字开头

    DataValidator.validStrD(str)

17)长度6-20字符,至少含大小写字母、数字、特殊符号两组任意组合

    DataValidator.validStrE(str)

18)长度在6-20个字符,至少包含大小写字母、数字两组的任意组合

    DataValidator.validStrF(str)

19)最大支持字符数256,内容仅支持0-9 A-Z,特殊字符仅支持_

    DataValidator.validStrG(str)

20)内容仅支持字母、数字

    DataValidator.validStrH(str)