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

jvalidator

v1.0.0

Published

fekit_modules to node_modules 原项目:https://github.com/rinh/jvalidator

Readme

jvalidator

原项目地址 https://github.com/rinh/jvalidator

fekit工具逐渐废弃,之前fekit插件转换成npm模块方便管理

插件直接绑定在jquery上, jquery直接在页面上引入

Change Log

0.3.0 去除jquery依赖 0.3.3 简化 parser, 不再使用 jison 0.3.5 修正 validatorAll 的 callback 执行顺序,并添加接口 $.jvalidator.PATTERNS 0.3.6 修正 radio,checkbox 不触发事件的问题 0.3.7 理论支持任何元素验证,只要扩展该元素的 value 属性 0.3.9 修正读取pattern属性时的cache

基本使用

第1步

设置好表单,为需要验证的字段设置 data-jvalidator-pattern ,该内容是你可以使用的验证器

<form id="form1">
    <input name="name" data-jvalidator-pattern="required" />
</form>
第2步

写 javascript 代码

var jv = $("#form1").jvalidator();
jv.validateAll(function( result , elements ){
    alert( result ? '验证成功' : '验证失败' );
});

恭喜,你已经完成表单的基本验证功能。

  • 针对表单使用
  • 为需要验证的元素加上 data-jvalidator-pattern
  • 即可整个表单验证,也可以单独触发某个字段的验证
你可以使用的验证器

关于参数的值:(普通值为任意字符,引用值为 @xxx,即指代 [name=xxx]的元素,下同)

  • required 无参数

    必须填写,如果字段还有其它验证器,则可以省略

  • non-required

    非必填

  • match 普通值,引用值

    与参数相同 如:match[1] 就是字段的值等于1 再如:match[@xxx] 就是字段的值等于[name=xxx]元素的值

  • contain 普通值,引用值

    包含参数中的内容

  • email

    验证邮箱格式

  • min_length 数字

    字段值的长度最小为参数设置 如:min_length[5]

  • max_length 数字

    字段值的长度最大为参数设置 如:max_length[5]

  • length 数字

    字段值的长度应等于参数设置 如:length[5]

  • greater_than 数字,引用值

    字段值的数字必须大于参数设置 如:greater_than[5]

  • less_than 数字,引用值

    字段值的数字必须小于参数设置 如:less_than[5]

  • equal 数字,引用值

    字段值的数字必须等于参数设置 如:equal[5]

  • alpha

    字母

  • alpha_numeric

    字母和数字

  • alpha_dash

    字母,数字,下划线,连接符

  • chs

    中文

  • chs_numeric

    中文,数字

  • chs_dash

    中文,数字,下划线,连接符

  • numeric

    数字

  • int

    整数,包括负数

  • decimal

    浮点数

  • idcard

    15及18位身份证格式

  • passport

    护照

  • ip

    IP地址

  • @(element) 普通值,引用

    引用验证器,使用上比较特殊。 如:@city[北京],即为验证 [name=city]的字段的值是否为北京。 或者 @city[@city2],即验证 city 和 city2 两个字段是否一致

如何看 demo

http://gist.corp.qunar.com/hao.lin/jvalidator/demo/index.html

将源码下载,解压后进入目录

fekit install
fekit min -f src/index.js -o demo/jvalidator.min.js

直接查看 demo/index.html

编译源码

jvalidator的规则解析器依赖了jison,需要修改的时候请重新执行

jison src/RuleParser.jison -m js -o src/RuleParser.js