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

libjv_jwd

v0.6.30

Published

Es6的单页应用常用扩展

Readme

libjv

Es6的单页应用常用扩展 https://github.com/krasimir/webpack-library-starter

验证

<div ref="form">
  <div chk="" chk_msg="">
    <input  />
  </div>
  
  <div chk="" chk_msg="">
    <input  />
  </div>
</div>
if (document.querySelector("[ref=form]").chk() == false) {
  return;
}

//验证通过的逻辑

验证规则:

  • document.querySelector("[ref=form]") 表示要验证的区域.
  • 对每一个chk属性,验证里面的 v-model 绑定 或 input,textarea 元素. 优先使用 v-model值.
  • chk函数返回 验证是否通过.

chk验证表达式

  • 函数写法,参数:value, inputDom,这是最灵活的方式.

    value 表示chk元素内部 v-model的值或 input 或 textarea 的value 值. inputDom 表示 chk元素内部第一个input或textarea 函数返回合法的false值,表示验证通过. 返回的字符串,将以验证失败的样式出现.

: if( value.length < 3) return '请输入名称';
  • 正则表达式写法
reg{值}:正则表达式

如:
reg{value.code}:/^\d{9,11}$/   表示value.code 必须是9到11位数字.
  • 枚举写法
enum(红,黄,蓝)
  • 内置类型写法 目前插件有以下内置类型 int,float,date,time,datetime,email
公式:
chk_type{值表达式}(开始值,结束值)

其中:
chk_type后面跟 问号 表示可空.
开始值,结束值:
 使用 () 表示大于开始值,小于结束值.
 使用 [] 表示大于等于开始值,小于等于结束值.
 
如:
{value.length}(3,5]   //表示字符串类型,长度大于3,小于等于5
int[20,79]            //表示是int类型,大于等于20,小于等于79
{value.length}(3)     //表示字符串类型,长度大于3,不设上限.
  • 扩展类型 如果需要重复使用某一个通用的类型,可以扩展,如下:
 jv.chk_types["mobile"] = function(chk_body, value, inputDom){
    //对value进行验证
    //通过返回 true
    //失败返回 false
 }
 
写法:
mobile{value[0]}[1]  //手机号格式,第一位必须是1