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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@dgteam/validator

v0.2.5

Published

1、支持在 rule 中设置自定义验证规则(先不支持异步) 2、支持接受 return Error 对象 3、一些特殊字段比如 int 在基础判断和辅助判断中错误提示不够精确的问题

Downloads

37

Readme

开发中

1、支持在 rule 中设置自定义验证规则(先不支持异步)
2、支持接受 return Error 对象
3、一些特殊字段比如 int 在基础判断和辅助判断中错误提示不够精确的问题

0.2.5

1、调整 Rules.mobile 规则,对国际手机号检测有更多可配置项
2、调整部分 .split(',') 为 .split(/\s*,\s*/) 用于兼容空格

0.2.4

1、在 rule.allowNull = true 的情况下,null 会作为有效值,不会触发 required 检验,否则 null 等于与 undefined 处理
2、增加更多测试用例

0.2.3

1、整理转义预期与相关测试
2、调整数组在某些情况下转义不正确导致不会校验失败的问题
3、修复无法传空字符串的问题,新增 stringEmpty 配置,默认为 true 即允许传空字符串

0.2.2

1、修复 int、float 验证成功后不会自动转换的问题

0.2.1

1、修复 Rules.length 验证规则兼容性问题
2、增加 lint 规则

[重大更新] 0.2.0

1、项目已改变使用 rollup.js 进行开发(未来会增加 typescript 支持)
2、项目已经支持 cjs、mjs 导出,分别对应前后端
3、项目使用 mocha、power-assert 进行测试
4、升级基础验证库 validator 的版本
4、[重要API调整] 修改验证方法、改动了参数传入与验证完成返回结果的对象、调整了验证核心逻辑
5、验证不会修改原对象(params、rules)验证结果会返回已验证完成的数据对象(自动过滤未验证的字段)
6、增加严格模式
7、增加对象、数组深层验证的支持
8、增加国际化方案

0.1.0

[新增] allowNull 字段,允许 null 值,仅 json 格式支持,仅拥有 ctx 后端支持  
[新增] placeholder 字段在免检字段中  

0.0.7

调整 array 方法的验证不规范,和错误提示  
[新增] test 测试文件  

0.0.6

如果是空参数(空字符串),在 rule.string = true 规则成立时会设置为 '', 其他情况下会以 undefined 处理
在 int float 等与 length 混用时,若验证失败应该返回更为精确的错误信息
- 以增加规则,但是需要修改字符串

0.0.5

增加 - dateRange
增加 - datetimeRange

0.0.4

调整 - 调整 date 的规则
新增 - 新增 time 的规则
新增 - 新增 datetime 的规则

0.0.3

修复 array 方式验证引发的错误

0.0.2

修复 regexp 方式验证引发的错误

0.0.1

表单验证插件,支持前端、后端(koa体系)验证