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

ray-validate

v1.0.4

Published

ray validate

Downloads

7

Readme

ray-validate

author

ilex.h

useage

npm install --save ray-validate

api

method

|name|params|description| |------|------|------| |validate|(r, value, cb, error = ERROR_TIP)|校验| |encodeUrl|(url)|将url中特殊的字符进行转换| |isIp|(ip)|判断string是否是ip| |isPhone|(phoneNumber)|带区号的电话号码| |isMobile|(m)|移动电话,匹配 13/15/18| |isNotEmpty|(value)|不为空| |isNum|(value)|数字| |isInt|isInt(value)|整数| |isDecimal|(value)|大数| |isArray|(value)|数组| |isRegExp|(value)|正则| |isObject|(value)|对象| |isFunc|(value)|function| |isEmail|(value)|邮箱| |isUrl|(value)|url| |isFullUrl|(value)|full url| |isOnlyIpUrl|(value)|only ip url| |isHex|(value)|16进制| |isIdCard|(value)|身份证| |isCNMobile|(value)|中国电话号码| |isLng|(value)|检验是经度,(整数部分为0-180小数部分为0到7位),可以为负数,| |isLat|(value)|检验是纬度,(整数部分为0-90小数部分为0到7位),可以为负数| |isPassword|(value, options:{pwdMaxLen, pwdMinLen})|密码判断| |isMidPassword|(value, options:{pwdMaxLen, pwdMinLen})|密码判断, 中等密码强度判断(字母、数字、下杠至少包含两种)| |isHighPassword|(value, options:{pwdMaxLen, pwdMinLen})|密码判断, 高强度密码判断,必须包含字母、数字、特殊字符| |isCustomPwd|(value, options:{pwdMaxLen, pwdMinLen, reg})|密码判断,支持自定义正则,默认 (字母、数字、特殊字符: ~!@#$%^&*()_<>)任选两种| |isUsername|(value)|用户名判断| |formatMoney|(str, delimiter = ' ', fixedNum)|格式化 钱| |formatMobile|(str, delimiter = ' ')|格式化 电话号码| |formatCard|(str, delimiter = ' ')|格式化 card(身份证)| |formatDate|(str, pattern)|格式化date|

REGEXS

  • regexs list
  /**
   * 带区号的电话号码
   */
  PHONE

  /**
   * 移动电话,匹配 13/15/18
   */
  MOBILE

  /**
   * email
   */
  EMAIL

  /**
   * url
   */
  URL

  /**
   * ip url
   */
  ONLY_IP_URL

  /**
   * full url
   */
  FULL_URL

  /**
   * IP
   */
  IP

  /**
   * hex 16进制
   */
  HEX

  /**
   * 数字
   */
  NUM

  /**
   * 身份证
   */
  ID_CARD

  /**
   * 电话
   */
  CN_MOBILE

  /**
   * 用户名 1-16位 字母、数字、下划线、横杠
   */
  USER_NAME

  /**
   * 字母、字符、非字母字符至少包含1种
   */
  PWD_L

  /**
   * 字母、字符、非字母字符至少包含2种
   */
  PWD_M

  /**
   * 字母、字符、非字母字符至少包含3种
   */
  PWD_H
  • 使用:

REGEXS.PHONE